#1254 Add scratch to the short JSON
Merged 4 years ago by mprahl. Opened 4 years ago by mprahl.

@@ -793,7 +793,7 @@ 

  

          return query.first()

  

-     def short_json(self, show_stream_version=False):

+     def short_json(self, show_stream_version=False, show_scratch=True):

          rv = {

              "id": self.id,

              "state": self.state,
@@ -805,6 +805,8 @@ 

          }

          if show_stream_version:

              rv["stream_version"] = self.stream_version

+         if show_scratch:

+             rv["scratch"] = self.scratch

          return rv

  

      def json(self, show_tasks=True):
@@ -818,7 +820,6 @@ 

              "owner": self.owner,

              "rebuild_strategy": self.rebuild_strategy,

              "scmurl": self.scmurl,

-             "scratch": self.scratch,

              "srpms": json.loads(self.srpms or "[]"),

              "siblings": self.siblings,

              "state_reason": self.state_reason,
@@ -845,7 +846,7 @@ 

              state_url = get_url_for("module_build", api_version=api_version, id=self.id)

  

          rv.update({

-             "base_module_buildrequires": [br.short_json(True) for br in self.buildrequires],

+             "base_module_buildrequires": [br.short_json(True, False) for br in self.buildrequires],

              "build_context": self.build_context,

              "modulemd": self.modulemd,

              "ref_build_context": self.ref_build_context,

@@ -191,6 +191,7 @@ 

          assert data["state_name"] == "ready"

          assert data["stream"] == "1"

          assert data["version"] == "2"

+         assert data["scratch"] is False

  

      def test_query_build_with_verbose_mode(self):

          rv = self.client.get("/module-build-service/1/module-builds/2?verbose=true")

@merlinm could you please review this?

Out of curiosity, what is the reason for these show_ kwargs here?

Out of curiosity, what is the reason for these show_ kwargs here?

They are there so that the base_module_buildrequires dictionary in the verbose JSON on the modules API endpoint shows the stream version but not if it's a scratch build (it's always not a scratch build). If you prefer, I can remove the new kwarg I added.

LGTM.

Now that scratch module builds are available in Fedora, I wondered why the MBS-UI didn't seem to notice them on the overview page. I would have spent ages tracking this down.

@jkaluza any objections to merging this?

rebased onto cdd102dbc5135636a756835111c9efc14475b0f0

4 years ago

Build cdd102dbc5135636a756835111c9efc14475b0f0 FAILED!
Rebase or make new commits to rebuild.

rebased onto 4b5618f

4 years ago

Pull-Request has been merged by mprahl

4 years ago