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