#439 Do not create Temporary/odcs-$id.repo file for raw_config composes.
Merged 3 years ago by lsedlar. Opened 3 years ago by jkaluza.
jkaluza/odcs cts-empty-string  into  master

@@ -969,7 +969,11 @@ 

          pungi = Pungi(compose.id, pungi_cfg, koji_event, old_compose)

          pungi.run(compose)

  

-         _write_repo_file(compose)

+         # Write the Compose.result_repofile_path. This makes sense only for

+         # non raw_config composes, because we have no idea what variants

+         # do exist for raw_config composes.

+         if compose.source_type != PungiSourceType.RAW_CONFIG:

+             _write_repo_file(compose)

  

      # Raises an exception if invalid

      validate_pungi_compose(compose)

@@ -41,6 +41,7 @@ 

      INVERSE_COMPOSE_STATES,

      COMPOSE_FLAGS,

      COMPOSE_RESULTS,

+     PungiSourceType,

  )

  

  from sqlalchemy import event, or_
@@ -346,6 +347,10 @@ 

          if not self.on_default_target_dir:

              return ""

  

+         # There is no repofile for Raw config composes.

+         if self.source_type == PungiSourceType.RAW_CONFIG:

+             return ""

+ 

          return (

              conf.target_dir_url

              + "/"

file modified
+3 -1
@@ -1316,8 +1316,9 @@ 

      @patch("os.symlink")

      @patch("os.unlink")

      @patch("odcs.server.pungi.PungiLogs.get_config_dump")

+     @patch("odcs.server.backend._write_repo_file")

      def test_generate_pungi_compose_raw_config(

-         self, config_dump, unlink, symlink, makedirs

+         self, write_repo_file, config_dump, unlink, symlink, makedirs

      ):

          config_dump.return_value = "fake\npungi\nconf\n"

          c = Compose.create(
@@ -1368,6 +1369,7 @@ 

          unlink.assert_called_with(

              AnyStringWith("/test_composes/production/latest-compose-1")

          )

+         write_repo_file.assert_not_called()

  

  

  class TestValidatePungiCompose(ModelsBaseTest):

@@ -2094,6 +2094,7 @@ 

          self.assertEqual(c.source, "pungi_cfg#hash")

          self.assertEqual(c.label, "Beta-1.2")

          self.assertEqual(c.compose_type, "nightly")

+         self.assertEqual(c.json()["result_repofile"], "")

  

  

  class TestViewsCancelCompose(ViewBaseTest):

This .repo file is useful only for other source_types. For raw_config,
it points to non-existing location and can confuse compose users.

pretty please pagure-ci rebuild

3 years ago

Should the model be changed to not include the URL for the repofile in the JSON output?

rebased onto 64d75ad

3 years ago

@lsedlar, good point. repofile URL is set to an empty string in latest update of this PR.

Pull-Request has been merged by lsedlar

3 years ago