Пример #1
0
    def __post_workflow(self, graph_name, nodes, body=None):
        # check if NODE_INDEX is set
        index = None
        try:
            index = int(NODE_INDEX)
        except:
            LOG.info('NODE_INDEX env is not set')
            workflows().post_workflows(graph_name, timeout_sec=DEFAULT_TIMEOUT_SEC, nodes=nodes, data=body)
            return

        # check if index is in the array range
        if index >= len(self.__nodes):
            raise Exception('index is outside the array range index: {0} vs nodes len {1}'.format(index, len(nodes)))
            return
        LOG.info('node index is set to {0}'.format(index))
        node = self.__nodes[index]
        id = node.get('id')
        # delete active workflow on the selected node
        try:
            Api().nodes_workflow_action_by_id(id, {'command': 'cancel'})
        except ApiException as e:
            assert_equal(404, e.status, message='status should be 404')
        Api().nodes_post_workflow_by_id(id, name=graph_name, body=body)
        log_context = self.__get_data().get('logContext')
        if log_context is None:
            raise Exception('Could not find logContext in {0}'.format(self.__get_data()))
            return
        # load graph instance id
        graph_instance = log_context.get('graphInstance')
        return self.__wait_for_completion(node, graph_name, graph_instance)
Пример #2
0
    def __post_workflow(self, graph_name, nodes, body):
        # check if NODE_INDEX is set
        index = None
        try:
            index = int(NODE_INDEX)
        except:
            LOG.info('NODE_INDEX env is not set')
            workflows().post_workflows(graph_name, timeout_sec=DEFAULT_TIMEOUT_SEC, nodes=nodes, data=body)
            return

        # check if index is in the array range
        nodes = self.__get_compute_nodes()
        if index >= len(nodes):
            raise Exception('index is outside the array range index: {0} vs nodes len {1}'.format(index, len(nodes)))
            return
        LOG.info('node index is set to {0}'.format(index))
        node = nodes[index]
        id = node.get('id')
        # delete active workflow on the selected node
        try:
            Api().nodes_workflow_action_by_id(id, {'command': 'cancel'})
        except ApiException as e:
            assert_equal(404, e.status, message='status should be 404')
        Api().nodes_post_workflow_by_id(id, name=graph_name, body=body)
        log_context = self.__get_data().get('logContext')
        if log_context is None:
            raise Exception('Could not find logContext in {0}'.format(self.__get_data()))
            return
        # load graph instance id
        graph_instance = log_context.get('graphInstance')
        return self.__wait_for_completion(node, graph_name, graph_instance)
Пример #3
0
 def __set_bmc_credentials(self, nodes=[], user=None, password=None):
     nodes = nodes if len(nodes) != 0 else self.__nodes
     _workflows = workflows()
     body = {
         'name': 'Graph.Bootstrap.With.BMC.Credentials.Setup',
         'options': {
             'defaults': {
                 'graphOptions': {
                     'target': '',
                     'generate-pass': {
                         'user': user,
                         'password': password
                     }
                 },
                 'nodeId': ''
             }
         }
     }
     for node in nodes:
         body['options']['defaults']['graphOptions']['target'] = \
                 body['options']['defaults']['nodeId'] = \
                 node['id']
         _workflows.post_unbound_workflow(
             'Graph.Bootstrap.With.BMC.Credentials.Setup',
             data=body,
             run_now=False)
     _workflows.run_workflow_tasks(None, DEFAULT_TIMEOUT)
     LOG.info('finiished post bmc set')
Пример #4
0
 def __set_bmc_credentials(self, nodes=[], user=None, password=None):
     nodes = nodes if len(nodes) != 0 else self.__nodes
     _workflows = workflows()
     body = {
         'name': 'Graph.Bootstrap.With.BMC.Credentials.Setup',
         'options': {
             'defaults': {
                 'graphOptions': {
                     'target': '',
                     'generate-pass': {
                         'user': user,
                         'password': password
                     }
                 },
                 'nodeId': ''
             }
         }
     }
     try:
         index = int(NODE_INDEX)
     except:
         for node in nodes:
             body['options']['defaults']['graphOptions']['target'] = \
                 body['options']['defaults']['nodeId'] = \
                 node['id']
             _workflows.post_unbound_workflow(
                 'Graph.Bootstrap.With.BMC.Credentials.Setup',
                 data=body,
                 run_now=False)
         _workflows.run_workflow_tasks(None, DEFAULT_TIMEOUT_SEC)
         LOG.info('finished post bmc set')
         return
     # if node index is set
     body['options']['defaults']['graphOptions']['target'] = \
         body['options']['defaults']['nodeId'] = \
         nodes[index]['id']
     try:
         Api().nodes_workflow_action_by_id(nodes[index]['id'],
                                           {'command': 'cancel'})
     except ApiException as e:
         assert_equal(404, e.status, message='status should be 404')
     Api().workflows_post(body=body)
     log_context = self.__get_data().get('logContext')
     if log_context is None:
         raise Exception('Could not find logContext in {0}'.format(
             self.__get_data()))
         return
     # load graph instance id
     graph_instance = log_context.get('graphInstance')
     # LOG.info('graph instance {0}'.format(graph_instance))
     return self.__wait_for_completion(
         nodes[index], 'Graph.Bootstrap.With.BMC.Credentials.Setup',
         graph_instance)
Пример #5
0
 def __set_bmc_credentials(self, nodes=[], user=None, password=None):
     nodes = nodes if len(nodes) != 0 else self.__nodes
     _workflows = workflows()
     body = {
         'name': 'Graph.Bootstrap.With.BMC.Credentials.Setup',
         'options': {
             'defaults': {
                 'graphOptions': {
                     'target': '',
                     'generate-pass': {'user': user, 'password': password}
                 },
                 'nodeId': ''
             }
         }
     }
     try:
         index = int(NODE_INDEX)
     except:
         for node in nodes:
             body['options']['defaults']['graphOptions']['target'] = \
                 body['options']['defaults']['nodeId'] = \
                 node['id']
             _workflows.post_unbound_workflow('Graph.Bootstrap.With.BMC.Credentials.Setup', data=body, run_now=False)
         _workflows.run_workflow_tasks(None, DEFAULT_TIMEOUT_SEC)
         LOG.info('finished post bmc set')
         return
     # if node index is set
     body['options']['defaults']['graphOptions']['target'] = \
         body['options']['defaults']['nodeId'] = \
         nodes[index]['id']
     try:
         Api().nodes_workflow_action_by_id(nodes[index]['id'], {'command': 'cancel'})
     except ApiException as e:
         assert_equal(404, e.status, message='status should be 404')
     Api().workflows_post(body=body)
     log_context = self.__get_data().get('logContext')
     if log_context is None:
         raise Exception('Could not find logContext in {0}'.format(self.__get_data()))
         return
     # load graph instance id
     graph_instance = log_context.get('graphInstance')
     # LOG.info('graph instance {0}'.format(graph_instance))
     return self.__wait_for_completion(nodes[index], 'Graph.Bootstrap.With.BMC.Credentials.Setup', graph_instance)
Пример #6
0
 def __set_bmc_credentials(self, nodes=[], user=None, password=None):
     nodes = nodes if len(nodes) != 0 else self.__nodes
     _workflows = workflows()
     body = {
             'name': 'Graph.Bootstrap.With.BMC.Credentials.Setup',
             'options': {
                 'defaults': {
                     'graphOptions': {
                         'target': '',
                         'generate-pass':{ 'user': user, 'password': password }
                         },
                     'nodeId': ''
                     }
                 }
             }
     for node in nodes:
         body['options']['defaults']['graphOptions']['target'] = \
                 body['options']['defaults']['nodeId'] = \
                 node['id']
         _workflows.post_unbound_workflow('Graph.Bootstrap.With.BMC.Credentials.Setup',data=body,run_now=False)
     _workflows.run_workflow_tasks(None,  DEFAULT_TIMEOUT)
     LOG.info('finiished post bmc set')
Пример #7
0
 def __post_workflow(self, graph_name, nodes, body):
     workflows().post_workflows(graph_name,
                                timeout_sec=DEFAULT_TIMEOUT_SEC,
                                nodes=nodes,
                                data=body)
Пример #8
0
 def __post_workflow(self, graph_name, nodes, body):
     workflows().post_workflows(graph_name, timeout_sec=DEFAULT_TIMEOUT, nodes=nodes, data=body)         
Пример #9
0
 def __post_workflow(self, graph_name, nodes, body):
     workflows().post_workflows(graph_name, timeout_sec=3600, nodes=nodes, data=body)         
Пример #10
0
 def __post_workflow(self, graph_name, nodes, body):
     workflows().post_workflows(graph_name,
                                timeout_sec=3600,
                                nodes=nodes,
                                data=body)