Re: can plugins get access to "cfg"?
One approach to this is to pass in the credentials from your plugin
section:
[plugin myplugin]
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__):
class MyPlugin(ClusterSetup):
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
class MyPlugin(ClusterSetup):
....
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.
HTH,
~Justin
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?
>
> Thanks
> Dan
>
>
>
Received on Sun Oct 31 2010 - 16:32:57 EDT
This archive was generated by
hypermail 2.3.0.