Example #1
0
 def get_node_instance(self, node_instance_id, evaluate_functions=False):
     instance = self._load_instance(node_instance_id)
     if instance is None:
         raise KeyError(
             'Instance {0} does not exist'.format(node_instance_id))
     instance = copy.deepcopy(instance)
     if evaluate_functions:
         dsl_functions.evaluate_node_instance_functions(instance, self)
     return instance
Example #2
0
 def get_node_instances(self, node_id=None, evaluate_functions=False):
     instances = list(self._node_instances.values())
     if node_id:
         instances = [i for i in instances if i.node_id == node_id]
     instances = copy.deepcopy(instances)
     if evaluate_functions:
         for instance in instances:
             dsl_functions.evaluate_node_instance_functions(instance, self)
     return instances
Example #3
0
 def get_node_instances(self, node_id=None, evaluate_functions=False):
     instances = [
         self.get_node_instance(instance_id)
         for instance_id in self._instance_ids()
     ]
     if node_id:
         instances = [i for i in instances if i.node_id == node_id]
     if evaluate_functions:
         for instance in instances:
             dsl_functions.evaluate_node_instance_functions(instance, self)
     return instances
Example #4
0
 def get_node_instances(self,
                        node_id=None,
                        evaluate_functions=False,
                        deployment_id=None):
     if deployment_id is None:
         deployment_id = self.name
     instances = copy.deepcopy(
         self._storage.get_node_instances(deployment_id, node_id=node_id))
     if evaluate_functions:
         for instance in instances:
             dsl_functions.evaluate_node_instance_functions(instance, self)
     return instances
Example #5
0
def evaluate_node_instance(instance):
    deployment_id = instance['deployment_id']
    sm = get_storage_manager()
    sm.get(Deployment, deployment_id, include=['id'])
    storage = FunctionEvaluationStorage(deployment_id, sm)

    try:
        return functions.evaluate_node_instance_functions(instance, storage)
    except parser_exceptions.FunctionEvaluationError as e:
        raise FunctionsEvaluationError(str(e))