Exemplo n.º 1
0
 def prepare_and_create_workflow(self, resource, action,
                                 kwargs, auth_dict=None):
     mistral_client = self.get_mistral_client(auth_dict)
     wg = workflow_generator.WorkflowGenerator(resource, action)
     wg.task(**kwargs)
     if not wg.get_tasks():
         raise nfvo.NoTasksException(resource=resource, action=action)
     definition_yaml = yaml.safe_dump(wg.definition)
     workflow = mistral_client.workflows.create(definition_yaml)
     return {'id': workflow[0].id, 'input': wg.get_input_dict()}
Exemplo n.º 2
0
 def prepare_and_create_workflow(self,
                                 resource,
                                 action,
                                 vim_auth,
                                 kwargs,
                                 auth_token=None):
     if not auth_token:
         LOG.warning(_("auth token required to create mistral workflows"))
         raise EnvironmentError('auth token required for'
                                ' mistral workflow driver')
     mistral_client = MistralClient(
         self.keystone.initialize_client('2', **vim_auth),
         auth_token).get_client()
     wg = workflow_generator.WorkflowGenerator(resource, action)
     wg.task(**kwargs)
     definition_yaml = yaml.dump(wg.definition)
     workflow = mistral_client.workflows.create(definition_yaml)
     return {'id': workflow[0].id, 'input': wg.get_input_dict()}
Exemplo n.º 3
0
 def __init__(self, context, client, resource, action):
     self.context = context
     self.client = client
     self.wg = workflow_generator.WorkflowGenerator(resource, action)