mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
Avoid default inventory proccessing for pull (#32135)
* Avoid default inventory proccessing for pull - now pull's own special inventory processing should work correctly - also removed ineffective set_defaults fixes #31449 * use class property instead * only do localhost for adhoc (cherry picked from commit aad5d1432583c4aa4105b774f38c80498e85de59)
This commit is contained in:
parent
11153df0a1
commit
ca71a50459
2 changed files with 8 additions and 11 deletions
|
@ -67,6 +67,8 @@ class PullCLI(CLI):
|
|||
"look for a playbook based on the host's fully-qualified domain name,"
|
||||
'on the host hostname and finally a playbook named *local.yml*.', }
|
||||
|
||||
SKIP_INVENTORY_DEFAULTS = True
|
||||
|
||||
def _get_inv_cli(self):
|
||||
|
||||
inv_opts = ''
|
||||
|
@ -77,9 +79,6 @@ class PullCLI(CLI):
|
|||
elif ',' in inv or os.path.exists(inv):
|
||||
inv_opts += ' -i %s ' % inv
|
||||
|
||||
if not inv_opts:
|
||||
inv_opts = " -i localhost, "
|
||||
|
||||
return inv_opts
|
||||
|
||||
def parse(self):
|
||||
|
@ -125,9 +124,6 @@ class PullCLI(CLI):
|
|||
self.parser.add_option("--check", default=False, dest='check', action='store_true',
|
||||
help="don't make any changes; instead, try to predict some of the changes that may occur")
|
||||
|
||||
# for pull we don't want a default
|
||||
self.parser.set_defaults(inventory=None)
|
||||
|
||||
super(PullCLI, self).parse()
|
||||
|
||||
if not self.options.dest:
|
||||
|
@ -177,6 +173,8 @@ class PullCLI(CLI):
|
|||
# Attempt to use the inventory passed in as an argument
|
||||
# It might not yet have been downloaded so use localhost as default
|
||||
inv_opts = self._get_inv_cli()
|
||||
if not inv_opts:
|
||||
inv_opts = " -i localhost, "
|
||||
|
||||
# FIXME: enable more repo modules hg/svn?
|
||||
if self.options.module_name == 'git':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue