예제 #1
0
    def update(self, values):
        """
        :param values: a dict.
        """
        self._check_for_update(values)
        was_locked = self.locked

        for k, v in values.items():
            if k in self.allowed_update_keys:
                if k == 'vm_host':
                    vm_host_name = v
                    query = self.query.filter(Node.name == vm_host_name)
                    v = query.one()
                setattr(self, k, v)

        if 'locked' in values:
            if self.locked != was_locked:
                self.locked_since = datetime.utcnow() if self.locked else None
            if not self.locked:
                self.locked_by = None
        Session.flush()
예제 #2
0
파일: runs.py 프로젝트: kshtsk/paddles
 def _create_run(cls, name):
     log.info("Creating run: %s", name)
     Session.flush()
     return Run(name)
예제 #3
0
파일: jobs.py 프로젝트: kshtsk/paddles
 def update(self, json_data):
     self.set_or_update(json_data)
     Session.flush()