summaryrefslogtreecommitdiff
path: root/lib/ansible/cli
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2020-01-10 05:24:36 +1000
committerSam Doran <sdoran@redhat.com>2020-01-09 14:24:36 -0500
commitaba8f12495376557f23ef412a72cb932441bb454 (patch)
tree8489d8f0e4c48b48ce207794c327fc6a5547fb3d /lib/ansible/cli
parent609c3d0e366feae3b57c3c309bf538fc2b3355f9 (diff)
downloadansible-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.py5
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)