コード例 #1
0
ファイル: projects.py プロジェクト: yanghonggang/shaman
 def index_post(self):
     if not self.project:
         self.project = models.get_or_create(Project, name=self.project_name)
     chacra_url = request.json["chacra_url"]
     repo = Repo.query.filter_by(chacra_url=chacra_url).first()
     if not repo:
         data = dict(
             project=self.project,
             ref=request.json["ref"],
             sha1=request.json["sha1"],
             flavor=request.json["flavor"],
             distro=request.json["distro"],
             distro_version=request.json["distro_version"],
             chacra_url=chacra_url,
         )
         repo = models.get_or_create(Repo, **data)
     if request.json["status"] == "deleted":
         repo.delete()
         return {}
     update_data = dict(
         status=request.json["status"],
         url=request.json.get("url", ""),
         extra=request.json.get("extra", dict()),
     )
     repo.update_from_json(update_data)
     archs = request.json.get("archs", [])
     for arch in archs:
         models.get_or_create(Arch, name=arch, repo=repo)
     return {}
コード例 #2
0
ファイル: projects.py プロジェクト: ceph/shaman
 def index_post(self):
     if not self.project:
         self.project = models.get_or_create(Project, name=self.project_name)
     chacra_url = request.json["chacra_url"]
     repo = Repo.query.filter_by(chacra_url=chacra_url).first()
     if not repo:
         data = dict(
             project=self.project,
             ref=request.json["ref"],
             sha1=request.json["sha1"],
             flavor=request.json["flavor"],
             distro=request.json["distro"],
             distro_version=request.json["distro_version"],
             chacra_url=chacra_url,
         )
         repo = models.get_or_create(Repo, **data)
     if request.json["status"] == "deleted":
         repo.delete()
         return {}
     update_data = dict(
         status=request.json["status"], url=request.json.get("url", ""), extra=request.json.get("extra", dict())
     )
     repo.update_from_json(update_data)
     archs = request.json.get("archs", [])
     for arch in archs:
         models.get_or_create(Arch, name=arch, repo=repo)
     return {}
コード例 #3
0
ファイル: __init__.py プロジェクト: ceph/shaman
 def index_post(self):
     if not self.node:
         self.node = models.get_or_create(Node, host=self.host)
     self.node.last_check = datetime.datetime.utcnow()
     if not check_node_health(self.node):
         self.node.healthy = False
     else:
         self.node.down_count = 0
         self.node.healthy = True
     return {}
コード例 #4
0
 def index_post(self):
     if not self.node:
         self.node = models.get_or_create(Node, host=self.host)
     self.node.last_check = datetime.datetime.utcnow()
     if not check_node_health(self.node):
         self.node.healthy = False
     else:
         self.node.down_count = 0
         self.node.healthy = True
     return {}
コード例 #5
0
 def index_post(self):
     if not self.project:
         self.project = models.get_or_create(Project,
                                             name=self.project_name)
     url = request.json["url"]
     # check if there is an existing build that is queued, where the URL
     # wouldn't match
     queued_build = models.Build.query.filter_by(
         project=self.project,
         sha1=request.json['sha1'],
         ref=request.json['ref'],
         status='queued',
     ).first()
     if queued_build:
         build = queued_build
     else:
         build = models.Build.query.filter_by(url=url).first()
     data = dict(
         project=self.project,
         ref=request.json["ref"],
         sha1=request.json["sha1"],
         flavor=request.json.get("flavor", "default"),
         extra=request.json.get('extra', dict()),
         distro=request.json.get('distro'),
         distro_version=request.json.get('distro_version'),
         url=request.json.get("url"),
         log_url=request.json.get("log_url"),
         build_id=request.json.get("build_id"),
         status=request.json.get("status"),
         distro_arch=request.json.get("distro_arch"),
     )
     if request.json["status"] == "completed":
         data["completed"] = datetime.datetime.utcnow()
     if not build:
         build = models.get_or_create(Build, **data)
     else:
         build.update_from_json(data)
     return {}
コード例 #6
0
ファイル: projects.py プロジェクト: ceph/shaman
 def index_post(self):
     if not self.project:
         self.project = models.get_or_create(Project, name=self.project_name)
     url = request.json["url"]
     # check if there is an existing build that is queued, where the URL
     # wouldn't match
     queued_build = models.Build.query.filter_by(
         project=self.project,
         sha1=request.json['sha1'],
         ref=request.json['ref'],
         status='queued',
     ).first()
     if queued_build:
         build = queued_build
     else:
         build = models.Build.query.filter_by(url=url).first()
     data = dict(
         project=self.project,
         ref=request.json["ref"],
         sha1=request.json["sha1"],
         flavor=request.json.get("flavor", "default"),
         extra=request.json.get('extra', dict()),
         distro=request.json.get('distro'),
         distro_version=request.json.get('distro_version'),
         url=request.json.get("url"),
         log_url=request.json.get("log_url"),
         build_id=request.json.get("build_id"),
         status=request.json.get("status"),
         distro_arch=request.json.get("distro_arch"),
     )
     if request.json["status"] == "completed":
         data["completed"] = datetime.datetime.utcnow()
     if not build:
         build = models.get_or_create(Build, **data)
     else:
         build.update_from_json(data)
     return {}