From e9109af2f686862975a77d0f10be9d0fb7dc4295 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 1 Dec 2016 17:24:56 +0000 Subject: [PATCH 1/2] Only perform the copy if the original namespace is present. --- roles/distgit/templates/genacls.pkgdb | 6 ++++-- roles/distgit/templates/genacls.pkgdb.stg | 6 ++++-- roles/distgit/templates/pkgdb_sync_git_branches.py | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/roles/distgit/templates/genacls.pkgdb b/roles/distgit/templates/genacls.pkgdb index 3d10da84f6..5d70d122ef 100644 --- a/roles/distgit/templates/genacls.pkgdb +++ b/roles/distgit/templates/genacls.pkgdb @@ -77,10 +77,12 @@ if __name__ == '__main__': # https://github.com/fedora-infra/pkgdb2/issues/329#issuecomment-207050233 # And then, this got renamed from rpms-checks to test-rpms # https://pagure.io/fedora-infrastructure/issue/5570 - data['test-rpms'] = copy.copy(data['rpms']) + if 'rpms' in data: + data['test-rpms'] = copy.copy(data['rpms']) # Also, modules are a thing # https://pagure.io/fedora-infrastructure/issue/5571 - data['test-modules'] = copy.copy(data['modules']) + if 'modules' in data: + data['test-modules'] = copy.copy(data['modules']) # Get a list of all the packages for key in data: diff --git a/roles/distgit/templates/genacls.pkgdb.stg b/roles/distgit/templates/genacls.pkgdb.stg index 196282afa2..d871bb8f0b 100644 --- a/roles/distgit/templates/genacls.pkgdb.stg +++ b/roles/distgit/templates/genacls.pkgdb.stg @@ -293,10 +293,12 @@ if __name__ == '__main__': # https://github.com/fedora-infra/pkgdb2/issues/329#issuecomment-207050233 # And then, this got renamed from rpms-checks to test-rpms # https://pagure.io/fedora-infrastructure/issue/5570 - data['test-rpms'] = copy.copy(data['rpms']) + if 'rpms' in data: + data['test-rpms'] = copy.copy(data['rpms']) # Also, modules are a thing # https://pagure.io/fedora-infrastructure/issue/5571 - data['test-modules'] = copy.copy(data['modules']) + if 'modules' in data: + data['test-modules'] = copy.copy(data['modules']) # Get a list of all the packages for key in data: diff --git a/roles/distgit/templates/pkgdb_sync_git_branches.py b/roles/distgit/templates/pkgdb_sync_git_branches.py index dad409cd9e..f5ee7ce9cf 100644 --- a/roles/distgit/templates/pkgdb_sync_git_branches.py +++ b/roles/distgit/templates/pkgdb_sync_git_branches.py @@ -256,10 +256,12 @@ def main(): # https://github.com/fedora-infra/pkgdb2/issues/329#issuecomment-207050233 # And then, this got renamed from rpms-checks to test-rpms # https://pagure.io/fedora-infrastructure/issue/5570 - pkgdb_info['test-rpms'] = copy.copy(pkgdb_info['rpms']) + if 'rpms' in pkgdb_info: + pkgdb_info['test-rpms'] = copy.copy(pkgdb_info['rpms']) # Also, modules are a thing # https://pagure.io/fedora-infrastructure/issue/5571 - pkgdb_info['test-modules'] = copy.copy(pkgdb_info['modules']) + if 'modules' in pkgdb_info: + pkgdb_info['test-modules'] = copy.copy(pkgdb_info['modules']) for ns in pkgdb_info: namespace = ns From 5579d8e76b36f4ada001f5e53c8f937280aa71b6 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 1 Dec 2016 17:30:13 +0000 Subject: [PATCH 2/2] Make this pretty, for readability. --- .../manual/staging-sync/scripts/export-pkgdb-stg-modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/manual/staging-sync/scripts/export-pkgdb-stg-modules.py b/playbooks/manual/staging-sync/scripts/export-pkgdb-stg-modules.py index a82fe677ef..8e06096cb5 100644 --- a/playbooks/manual/staging-sync/scripts/export-pkgdb-stg-modules.py +++ b/playbooks/manual/staging-sync/scripts/export-pkgdb-stg-modules.py @@ -16,6 +16,6 @@ response = requests.get( ) data = response.json() with open(filename, 'wb') as f: - f.write(json.dumps(data).encode('utf-8')) + f.write(json.dumps(data, indent=2).encode('utf-8')) print "Wrote %s" % filename