Re: can plugins get access to "cfg"?
This archive was generated by
One approach to this is to pass in the credentials from your plugin
setup_class = myplugin.MySetupClass
aws_access_key = your aws access key
aws_secret_key = #your aws_secret key
aws_access_key and aws_secret_key would then be arguments in your
plugin's constructor (__init__):
def __init__(aws_access_key, aws_secret_key):
self.aws_access_key = aws_access_key
self.aws_secret_key = aws_secret_key
def run(self, nodes, master, user, user_shell, volumes):
Another approach is to import the StarClusterConfig class in your plugin:
from starcluster import config
def run(self, ...):
cfg = config.StarClusterConfig().load()
This will give you access to the cfg object for the default config
location (~/.starcluster/config). The only problem with this code is
that if the user passed in the -c option (alternate config location)
then you would not be reading the right config file. The first approach
does not have this problem.
On 10/31/10 2:05 PM, Dan Tenenbaum wrote:
> I would like to be able to pass my AWS credentials to a cluster node
> inside a plugin.
> I'd use this to copy my output data to S3 (I want the cluster
> operation to be totally automatic).
> Is there a way to get access to the "cfg" object from within a plugin,
> so that I can do this?
Received on Sun Oct 31 2010 - 16:32:57 EDT