+ self.config = config
+ self.nova_shell = NovaShell(config)
+ self.access_key = None
+ self.secret_key = None
+
+ def init_context(self, project_name=None):
+
+ # use the context of the specified project's project
+ # manager.
+ if project_name:
+ project = self.nova_shell.auth_manager.get_project(project_name)
+ self.access_key = "%s:%s" % (
+ project.project_manager.name, project_name)
+ self.secret_key = project.project_manager.secret
+ else:
+ # use admin user's context
+ admin_user = self.nova_shell.auth_manager.get_user(
+ self.config.SFA_NOVA_USER)
+ #access_key = admin_user.access
+ self.access_key = '%s' % admin_user.name
+ self.secret_key = admin_user.secret