Пример #1
0
 def store(self, context=None):
     '''Store the Template in the database and return its ID'''
     if self.id is None:
         rt = {'template': self.t}
         new_rt = db_api.raw_template_create(context, rt)
         self.id = new_rt.id
     return self.id
Пример #2
0
 def store(self, context=None):
     """Store the Template in the database and return its ID."""
     if self.id is None:
         rt = {"template": self.t, "files": self.files}
         new_rt = db_api.raw_template_create(context, rt)
         self.id = new_rt.id
     return self.id
Пример #3
0
 def store(self, context=None):
     '''Store the Template in the database and return its ID.'''
     if self.id is None:
         rt = {'template': self.t}
         new_rt = db_api.raw_template_create(context, rt)
         self.id = new_rt.id
     return self.id
Пример #4
0
 def store(self, context=None):
     '''Store the Template in the database and return its ID.'''
     rt = {'template': self.t, 'files': self.files}
     if self.id is None:
         new_rt = db_api.raw_template_create(context, rt)
         self.id = new_rt.id
     else:
         db_api.raw_template_update(context, self.id, rt)
     return self.id
Пример #5
0
 def store(self, context=None):
     '''Store the Template in the database and return its ID.'''
     if self.id is None:
         rt = {
             'template': self.t,
             'files': self.files
         }
         new_rt = db_api.raw_template_create(context, rt)
         self.id = new_rt.id
     else:
         db_api.raw_template_update_template(context, self.id, self.t)
     return self.id
Пример #6
0
 def store(self, context=None):
     '''Store the Template in the database and return its ID.'''
     rt = {
         'template': self.t,
         'files': self.files,
         'environment': self.env.user_env_as_dict(),
         'predecessor': self.predecessor
     }
     if self.id is None:
         new_rt = db_api.raw_template_create(context, rt)
         self.id = new_rt.id
     else:
         db_api.raw_template_update(context, self.id, rt)
     return self.id
Пример #7
0
    def create_stack(self, context, stack_name, template, params):
        """
        The create_stack method creates a new stack using the template
        provided.
        Note that at this stage the template has already been fetched from the
        heat-api process if using a template-url.
        arg1 -> RPC context.
        arg2 -> Name of the stack you want to create.
        arg3 -> Template of stack you want to create.
        arg4 -> Params passed from API.
        """
        logger.info("template is %s" % template)
        if db_api.stack_get(None, stack_name):
            return {"Error": "Stack already exists with that name."}

        metadata_server = config.FLAGS.heat_metadata_server_url
        # We don't want to reset the stack template, so we are making
        # an instance just for validation.
        template_copy = deepcopy(template)
        stack_validator = parser.Stack(stack_name, template_copy, 0, params, metadata_server=metadata_server)
        response = stack_validator.validate()
        stack_validator = None
        template_copy = None
        if "Malformed Query Response" in response["ValidateTemplateResult"]["Description"]:
            return response["ValidateTemplateResult"]["Description"]

        stack = parser.Stack(stack_name, template, 0, params, metadata_server=metadata_server)
        rt = {}
        rt["template"] = template
        rt["stack_name"] = stack_name
        new_rt = db_api.raw_template_create(None, rt)

        s = {}
        s["name"] = stack_name
        s["raw_template_id"] = new_rt.id
        new_s = db_api.stack_create(None, s)
        stack.id = new_s.id

        pt = {}
        pt["template"] = stack.t
        pt["raw_template_id"] = new_rt.id
        new_pt = db_api.parsed_template_create(None, pt)

        stack.parsed_template_id = new_pt.id
        stack.create()

        return {"stack": {"id": new_s.id, "name": new_s.name, "created_at": str(new_s.created_at)}}
Пример #8
0
 def create(cls, context, values):
     return cls._from_db_object(context, cls(),
                                db_api.raw_template_create(context, values))
Пример #9
0
 def create(cls, context, values):
     return db_api.raw_template_create(context, values)
Пример #10
0
 def create(cls, context, values):
     return cls._from_db_object(context, cls(),
                                db_api.raw_template_create(context, values))
Пример #11
0
 def create(cls, context, values):
     return db_api.raw_template_create(context, values)