def get(self, **kwargs): releases = release_list(connexion.request) if not connexion.request.args.get("names_only"): requirements = dbo.releases.getPotentialRequiredSignoffs(releases) for release in releases: release["required_signoffs"] = serialize_signoff_requirements(requirements[release["name"]]) return serialize_releases(connexion.request, releases)
def get(self, **kwargs): releases = release_list(connexion.request) if not connexion.request.args.get('names_only'): for release in releases: requirements = dbo.releases.getPotentialRequiredSignoffs([release]) release['required_signoffs'] = serialize_signoff_requirements(requirements) return serialize_releases(connexion.request, releases)
def set_required_signoffs_for_product(sc): if sc["change_type"] == "update" and not sc["required_signoffs"] and not sc[ "read_only"] and dbo.releases.isReadOnly(sc["name"]): potential_rs = dbo.releases.getPotentialRequiredSignoffsForProduct( sc["product"]) sc["required_signoffs"] = serialize_signoff_requirements( potential_rs["rs"])
def get(self, release): releases = dbo.releases.getReleases(name=release, limit=1) if not releases: return problem(404, "Not Found", f"Release: {release} not found") release = releases[0] potential_rs = dbo.releases.getPotentialRequiredSignoffsForProduct( release["product"]) rs = { "required_signoffs": serialize_signoff_requirements(potential_rs["rs"]) } return jsonify(rs)
def get(self): if connexion.request.args.get("all"): rows = self.sc_table.select() else: rows = self.sc_table.select(where={"complete": False}) ret = {"count": len(rows), "scheduled_changes": []} for row in rows: scheduled_change = {"signoffs": {}, "required_signoffs": {}} base_row = {} base_pk = {} for k, v in row.iteritems(): if k == "data_version": scheduled_change["sc_data_version"] = v else: if k.startswith("base_"): k = k.replace("base_", "") base_row[k] = v if getattr(self.table, k).primary_key: base_pk[k] = v scheduled_change[k] = v for signoff in self.sc_table.signoffs.select( {"sc_id": row["sc_id"]}): scheduled_change["signoffs"][ signoff["username"]] = signoff["role"] # No point in retrieving this for completed scheduled changes... if not row["complete"]: affected_rows = [] # We don't need to consider the existing version of a row for # inserts, because it doesn't exist yet! if row["change_type"] != "insert": original_row = self.table.select(where=base_pk)[0] scheduled_change["original_row"] = original_row affected_rows.append(original_row) # We don't need to consider the future version of the row when # looking for required signoffs, because it won't exist when # enacted. if row["change_type"] != "delete": affected_rows.append(base_row) signoff_requirements = [ obj for v in self.table.getPotentialRequiredSignoffs( affected_rows).values() for obj in v ] scheduled_change[ "required_signoffs"] = serialize_signoff_requirements( signoff_requirements) ret["scheduled_changes"].append(scheduled_change) return jsonify(ret)
def get(self): if connexion.request.args.get("all"): rows = self.sc_table.select() else: rows = self.sc_table.select(where={"complete": False}) ret = {"count": len(rows), "scheduled_changes": []} for row in rows: scheduled_change = {"signoffs": {}, "required_signoffs": {}} base_row = {} base_pk = {} for k, v in row.iteritems(): if k == "data_version": scheduled_change["sc_data_version"] = v else: if k.startswith("base_"): k = k.replace("base_", "") base_row[k] = v if getattr(self.table, k).primary_key: base_pk[k] = v scheduled_change[k] = v for signoff in self.sc_table.signoffs.select({"sc_id": row["sc_id"]}): scheduled_change["signoffs"][signoff["username"]] = signoff["role"] # No point in retrieving this for completed scheduled changes... if not row["complete"]: affected_rows = [] # We don't need to consider the existing version of a row for # inserts, because it doesn't exist yet! if row["change_type"] != "insert": original_row = self.table.select(where=base_pk)[0] scheduled_change["original_row"] = original_row affected_rows.append(original_row) # We don't need to consider the future version of the row when # looking for required signoffs, because it won't exist when # enacted. if row["change_type"] != "delete": affected_rows.append(base_row) signoff_requirements = self.table.getPotentialRequiredSignoffs(affected_rows) scheduled_change["required_signoffs"] = serialize_signoff_requirements(signoff_requirements) ret["scheduled_changes"].append(scheduled_change) return jsonify(ret)