ansible-pull handlle empty node/hostname return (#76965)

pull/76974/head
Brian Coca 2 years ago committed by GitHub
parent 6d2d476113
commit d4c9c103e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- ansible-pull handle case where hostname and nodename are empty

@ -168,7 +168,11 @@ class PullCLI(CLI):
# Now construct the ansible command
node = platform.node()
host = socket.getfqdn()
limit_opts = 'localhost,%s,127.0.0.1' % ','.join(set([host, node, host.split('.')[0], node.split('.')[0]]))
hostnames = ','.join(set([host, node, host.split('.')[0], node.split('.')[0]]))
if hostnames:
limit_opts = 'localhost,%s,127.0.0.1' % hostnames
else:
limit_opts = 'localhost,127.0.0.1'
base_opts = '-c local '
if context.CLIARGS['verbosity'] > 0:
base_opts += ' -%s' % ''.join(["v" for x in range(0, context.CLIARGS['verbosity'])])

Loading…
Cancel
Save