#102 Add an option for whether to publish changes.
Merged 5 years ago by pingou. Opened 5 years ago by qulogic.
qulogic/mdapi publish-config  into  master

file modified
+10 -2
@@ -59,6 +59,8 @@ 

  PKGDB2_VERIFY = True

  # Valid for both koji and the download server

  DL_VERIFY = True

+ # Whether to publish to Fedora Messaging.

+ PUBLISH_CHANGES = True

  

  

  repomd_xml_namespace = {
@@ -412,8 +414,12 @@ 

  

              download_db(name, repomd_url, archive)

              decompress_db(name, archive, tempdb)

-             packages = compare_dbs(name, tempdb, destfile, cache1, cache2)

-             publish_changes(name, packages, repomd_url)

+             if PUBLISH_CHANGES:

+                 packages = compare_dbs(name, tempdb, destfile, cache1, cache2)

+                 publish_changes(name, packages, repomd_url)

+             else:

+                 print(f'{name.ljust(padding)} Not publishing to Fedora '

+                       f'messaging; not comparing DBs.')

              install_db(name, tempdb, destfile)

  

  
@@ -436,11 +442,13 @@ 

          return 1

  

      global PKGDB2_URL, KOJI_REPO, DL_SERVER, PKGDB2_VERIFY, DL_VERIFY

+     global PUBLISH_CHANGES

      PKGDB2_URL = CONFIG.get('PKGDB2_URL', PKGDB2_URL)

      KOJI_REPO = CONFIG.get('KOJI_REPO', KOJI_REPO)

      DL_SERVER = CONFIG.get('DL_SERVER', DL_SERVER)

      PKGDB2_VERIFY = CONFIG.get('PKGDB2_VERIFY', PKGDB2_VERIFY)

      DL_VERIFY = CONFIG.get('DL_VERIFY', DL_VERIFY)

+     PUBLISH_CHANGES = CONFIG.get('PUBLISH_CHANGES', PUBLISH_CHANGES)

  

      if not DL_VERIFY or not PKGDB2_VERIFY:

          # Suppress urllib3's warning about insecure requests

Running locally, there's no need to publish changes, since you don't have access to Fedora Messaging. This breaks the script halfway through since this happens before installing the database.

Can we also skip compare_dbs if not publishing changes?

rebased onto d76ae44

5 years ago

Can we also skip compare_dbs if not publishing changes?

I think we could yes.

rebased onto 3254270

5 years ago

OK, rebased and added that.

The default in the script is True and the default in the config here is False. For the sake of consistency and avoid breaking backward compatibility, I think it should default to True here as well.

Yes, that is somewhat intentional, though I am operating under the assumption that production instances have their own config (or are they really writing to /var/tmp?). Local clones would use the instructions and get default_config.py (without publishing), while existing configs would use the script default (with publishing) because they wouldn't have it in their settings yet. Unless prod runs default config too?

I likely has its own config, but with this change, the default will go to False and if we're not careful suddenly it doesn't send notifications any more.

I prefer we stay backward compatible :)

rebased onto 27e0581

5 years ago

OK, it should be the same now.

Looks all good to me, thanks! :)

Pull-Request has been merged by pingou

5 years ago
Metadata