mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
now verbose mode shows config file used
This commit is contained in:
parent
67671e328a
commit
5f791329ce
8 changed files with 22 additions and 6 deletions
|
@ -99,7 +99,9 @@ class CLI(object):
|
|||
raise Exception("Need to implement!")
|
||||
|
||||
def run(self):
|
||||
raise Exception("Need to implement!")
|
||||
|
||||
if self.options.verbosity > 0:
|
||||
self.display.display("Using %s as config file" % C.CONFIG_FILE)
|
||||
|
||||
@staticmethod
|
||||
def ask_vault_passwords(ask_vault_pass=False, ask_new_vault_pass=False, confirm_vault=False, confirm_new=False):
|
||||
|
|
|
@ -76,6 +76,9 @@ class AdHocCLI(CLI):
|
|||
def run(self):
|
||||
''' use Runner lib to do SSH things '''
|
||||
|
||||
super(AdHocCLI, self).run()
|
||||
|
||||
|
||||
# only thing left should be host pattern
|
||||
pattern = self.args[0]
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ class DocCLI(CLI):
|
|||
|
||||
def run(self):
|
||||
|
||||
super(DocCLI, self).run()
|
||||
|
||||
if self.options.module_path is not None:
|
||||
for i in self.options.module_path.split(os.pathsep):
|
||||
module_loader.add_directory(i)
|
||||
|
|
|
@ -124,6 +124,8 @@ class GalaxyCLI(CLI):
|
|||
|
||||
def run(self):
|
||||
|
||||
super(GalaxyCLI, self).run()
|
||||
|
||||
# if not offline, get connect to galaxy api
|
||||
if self.action in ("info","install") or (self.action == 'init' and not self.options.offline):
|
||||
api_server = self.options.api_server
|
||||
|
|
|
@ -81,6 +81,8 @@ class PlaybookCLI(CLI):
|
|||
|
||||
def run(self):
|
||||
|
||||
super(PlaybookCLI, self).run()
|
||||
|
||||
# Note: slightly wrong, this is written so that implicit localhost
|
||||
# Manage passwords
|
||||
sshpass = None
|
||||
|
|
|
@ -98,6 +98,8 @@ class PullCLI(CLI):
|
|||
def run(self):
|
||||
''' use Runner lib to do SSH things '''
|
||||
|
||||
super(PullCLI, self).run()
|
||||
|
||||
# log command line
|
||||
now = datetime.datetime.now()
|
||||
self.display.display(now.strftime("Starting Ansible Pull at %F %T"))
|
||||
|
|
|
@ -70,6 +70,8 @@ class VaultCLI(CLI):
|
|||
|
||||
def run(self):
|
||||
|
||||
super(VaultCLI, self).run()
|
||||
|
||||
if self.options.vault_password_file:
|
||||
# read vault_pass from a file
|
||||
self.vault_pass = read_vault_file(self.options.vault_password_file)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
from __future__ import (absolute_import, division)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
|
@ -26,6 +26,8 @@ import sys
|
|||
from six.moves import configparser
|
||||
from string import ascii_letters, digits
|
||||
|
||||
from ansible.errors import AnsibleOptionsError
|
||||
|
||||
# copied from utils, avoid circular reference fun :)
|
||||
def mk_boolean(value):
|
||||
if value is None:
|
||||
|
@ -81,9 +83,8 @@ def load_config_file():
|
|||
try:
|
||||
p.read(path)
|
||||
except configparser.Error as e:
|
||||
print("Error reading config file: \n{0}".format(e))
|
||||
sys.exit(1)
|
||||
return p
|
||||
raise AnsibleOptionsError("Error reading config file: \n{0}".format(e))
|
||||
return p, path
|
||||
return None
|
||||
|
||||
def shell_expand_path(path):
|
||||
|
@ -93,7 +94,7 @@ def shell_expand_path(path):
|
|||
path = os.path.expanduser(os.path.expandvars(path))
|
||||
return path
|
||||
|
||||
p = load_config_file()
|
||||
p, CONFIG_FILE = load_config_file()
|
||||
|
||||
active_user = pwd.getpwuid(os.geteuid())[0]
|
||||
|
||||
|
|
Loading…
Reference in a new issue