diff options
author | Jordan Borean <jborean93@gmail.com> | 2020-01-10 05:24:36 +1000 |
---|---|---|
committer | Sam Doran <sdoran@redhat.com> | 2020-01-09 14:24:36 -0500 |
commit | aba8f12495376557f23ef412a72cb932441bb454 (patch) | |
tree | 8489d8f0e4c48b48ce207794c327fc6a5547fb3d /lib/ansible/cli | |
parent | 609c3d0e366feae3b57c3c309bf538fc2b3355f9 (diff) | |
download | ansible-aba8f12495376557f23ef412a72cb932441bb454.tar.gz |
ansible-galaxy ignore empty server_list (#65986)
* ansible-galaxy ignore empty server_list
Diffstat (limited to 'lib/ansible/cli')
-rw-r--r-- | lib/ansible/cli/galaxy.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py index 9cf3a8e87e..73255bc0ba 100644 --- a/lib/ansible/cli/galaxy.py +++ b/lib/ansible/cli/galaxy.py @@ -320,7 +320,10 @@ class GalaxyCLI(CLI): ('auth_url', False)] config_servers = [] - for server_key in (C.GALAXY_SERVER_LIST or []): + + # Need to filter out empty strings or non truthy values as an empty server list env var is equal to ['']. + server_list = [s for s in C.GALAXY_SERVER_LIST or [] if s] + for server_key in server_list: # Config definitions are looked up dynamically based on the C.GALAXY_SERVER_LIST entry. We look up the # section [galaxy_server.<server>] for the values url, username, password, and token. config_dict = dict((k, server_config_def(server_key, k, req)) for k, req in server_def) |