Пример #1
0
    def store(self, ctx):
        '''Store the profile into database and return its ID.'''
        timestamp = timeutils.utcnow()

        values = {
            'name': self.name,
            'type': self.type,
            'context': self.context,
            'spec': self.spec,
            'user': self.user,
            'project': self.project,
            'domain': self.domain,
            'meta_data': self.metadata,
        }

        if self.id:
            self.updated_at = timestamp
            values['updated_at'] = timestamp
            db_api.profile_update(ctx, self.id, values)
        else:
            self.created_at = timestamp
            values['created_at'] = timestamp
            profile = db_api.profile_create(ctx, values)
            self.id = profile.id

        return self.id
Пример #2
0
    def store(self, ctx):
        '''Store the profile into database and return its ID.'''
        timestamp = timeutils.utcnow()

        values = {
            'name': self.name,
            'type': self.type,
            'context': self.context,
            'spec': self.spec,
            'user': self.user,
            'project': self.project,
            'domain': self.domain,
            'meta_data': self.metadata,
        }

        if self.id:
            self.updated_at = timestamp
            values['updated_at'] = timestamp
            db_api.profile_update(ctx, self.id, values)
        else:
            self.created_at = timestamp
            values['created_at'] = timestamp
            profile = db_api.profile_create(ctx, values)
            self.id = profile.id

        return self.id
Пример #3
0
    def store(self, context):
        '''Store the profile into database and return its ID.'''
        timestamp = datetime.datetime.utcnow()

        values = {
            'name': self.name,
            'type': self.type,
            'context': self.context.to_dict(),
            'spec': self.spec,
            'permission': self.permission,
            'tags': self.tags,
        }

        if self.id:
            self.updated_time = timestamp
            values['updated_time'] = timestamp
            db_api.profile_update(self.context, self.id, values)
        else:
            self.created_time = timestamp
            values['created_time'] = timestamp
            profile = db_api.profile_create(self.context, values)
            self.id = profile.id

        return self.id
Пример #4
0
 def update(cls, context, obj_id, values):
     obj = db_api.profile_update(context, obj_id, values)
     return cls._from_db_object(context, cls(), obj)
Пример #5
0
 def update(cls, context, obj_id, values):
     values = cls._transpose_metadata(values)
     obj = db_api.profile_update(context, obj_id, values)
     return cls._from_db_object(context, cls(), obj)
Пример #6
0
 def update(cls, context, obj_id, values):
     obj = db_api.profile_update(context, obj_id, values)
     return cls._from_db_object(context, cls(), obj)