def set_state_task():
     node_state = get_node_instance(self.id)
     node_state.state = state
     if runtime_properties is not None:
         node_state.runtime_properties.update(runtime_properties)
     update_node_instance(node_state)
     return node_state
Beispiel #2
0
def discover_dependent_hosts():
    '''Find any dependent node hosts of the Facilitator module'''
    host_list = []

    # Use the REST API to get the list of all nodes in this deployment
    client = manager.get_rest_client()
    rnodes = client.node_instances.list(deployment_id=ctx.deployment.id)

    # Iterate through each node and find ones that
    # have our Facilitator as a depends_on relationship
    for rnode in rnodes:
        node = manager.get_node_instance(rnode.id)

        for rel in node.relationships:
            ctx.logger.info('Relationship: {0}' . format(rel))
            if rel.get('type') == 'cloudify.relationships.depends_on':
                if rel.get('target_id') == ctx.instance.id:
                    # Find the dependent nodes' host (VM)
                    host_list.append(manager.get_node_instance(node.host_id))

    return host_list
 def _derive(property_name):
     executor = workflow_task.cloudify_context['executor']
     host_id = workflow_task.cloudify_context['host_id']
     if executor == 'host_agent':
         if len(runtime_props) == 0:
             host_node_instance = get_node_instance(host_id)
             cloudify_agent = host_node_instance.runtime_properties.get(
                 'cloudify_agent')
             if not cloudify_agent:
                 raise exceptions.NonRecoverableError(
                     'Missing cloudify_agent runtime information. '
                     'This most likely means that the Compute node '
                     'never started successfully')
             runtime_props.append(cloudify_agent)
         return runtime_props[0][property_name]
     return self.workflow_ctx.deployment.id
Beispiel #4
0
 def _derive(self, property_name):
     executor = self.cloudify_context['executor']
     host_id = self.cloudify_context['host_id']
     if executor == 'host_agent':
         if self._cloudify_agent is None:
             host_node_instance = get_node_instance(host_id)
             cloudify_agent = host_node_instance.runtime_properties.get(
                 'cloudify_agent', {})
             if property_name not in cloudify_agent:
                 raise exceptions.NonRecoverableError(
                     'Missing cloudify_agent.{0} runtime information. '
                     'This most likely means that the Compute node was '
                     'never started successfully'.format(property_name))
             self._cloudify_agent = cloudify_agent
         return self._cloudify_agent[property_name]
     else:
         return MGMTWORKER_QUEUE
 def _derive(self, property_name):
     executor = self.cloudify_context['executor']
     host_id = self.cloudify_context['host_id']
     if executor == 'host_agent':
         if self._cloudify_agent is None:
             host_node_instance = get_node_instance(host_id)
             cloudify_agent = host_node_instance.runtime_properties.get(
                 'cloudify_agent', {})
             if property_name not in cloudify_agent:
                 raise exceptions.NonRecoverableError(
                     'Missing cloudify_agent.{0} runtime information. '
                     'This most likely means that the Compute node was '
                     'never started successfully'.format(property_name))
             self._cloudify_agent = cloudify_agent
         return self._cloudify_agent[property_name]
     else:
         return MGMTWORKER_QUEUE
 def get_node_instance(self, node_instance_id):
     return manager.get_node_instance(node_instance_id)
Beispiel #7
0
 def remote(self):
     return get_node_instance(self._node_instance_id).state
Beispiel #8
0
 def remote(self):
     node_instance = get_node_instance(self._node_instance_id)
     node_instance.state = self._state
     update_node_instance(node_instance)
     return node_instance
Beispiel #9
0
 def remote(self):
     return get_node_instance(self.kwargs['node_instance_id']).state
 def get_state_task():
     return get_node_instance(workflow_node_instance.id).state
 def set_state_task():
     node_state = get_node_instance(workflow_node_instance.id)
     node_state.state = state
     update_node_instance(node_state)
     return node_state
 def get_state_task():
     return get_node_instance(workflow_node_instance.id).state
 def get_node_instance(self, node_instance_id):
     return manager.get_node_instance(node_instance_id,
                                      evaluate_functions=True)
Beispiel #14
0
 def get_node_instance(self, node_instance_id):
     return manager.get_node_instance(node_instance_id,
                                      evaluate_functions=True,
                                      client=self.rest_client)
Beispiel #15
0
 def get_node_instance(self, node_instance_id):
     return manager.get_node_instance(node_instance_id,
                                      evaluate_functions=True)
 def get_state_task():
     return get_node_instance(self.id).state
 def get_node_instance(self, node_instance_id):
     return manager.get_node_instance(node_instance_id)
 def set_state_task():
     node_state = get_node_instance(workflow_node_instance.id)
     node_state.state = state
     update_node_instance(node_state)
     return node_state