From e33505cbae486db7e2faec943bf30925f413ef6a Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Apr 21 2017 02:22:15 +0000 Subject: update pkgdb namespace, add error handling Fix the pkgdb query to go with the new container namespace as well as add error checking to make sure we don't return an empty list of containers (which should never happen). Signed-off-by: Adam Miller --- diff --git a/ansible/library/fedcontainer_rc.py b/ansible/library/fedcontainer_rc.py index dae467f..e789d14 100755 --- a/ansible/library/fedcontainer_rc.py +++ b/ansible/library/fedcontainer_rc.py @@ -162,7 +162,7 @@ def get_releasecandidates(release_num): # pkgdb2 api vars pkgdb_api_url = "https://admin.fedoraproject.org/pkgdb/api/packages/*" pkgdb_req_params = { - "namespace": "docker", + "namespace": "container", "branches": ["f{}".format(release_num)], "acls": True } @@ -191,13 +191,22 @@ def main(): supports_check_mode=False ) - # Technically this never changes anything on the system, so always mark - # changed=False - module.exit_json( - changed=False, - msg="Successfully gathered container release candidates, results in 'rclist'", - rclist=get_releasecandidates(module.params['release']) - ) + rclist = get_releasecandidates(module.params['release']) + + if rclist: + # Technically this never changes anything on the system, so always mark + # changed=False + module.exit_json( + changed=False, + msg="Successfully gathered container release candidates, results in 'rclist'", + rclist=rclist + ) + else: + module.fail_json( + changed=False, + msg="ERROR occurred, rclist returned empty list", + rclist=rclist + ) ################################################## # import module snippets