Info command: support tilde expansion
This commit is contained in:
parent
11f569959d
commit
3f133dbc17
4 changed files with 13 additions and 10 deletions
|
@ -24,6 +24,7 @@ import os
|
|||
from tempfile import TemporaryFile
|
||||
|
||||
import cdist
|
||||
import cdist.configuration
|
||||
|
||||
|
||||
# IMPORTANT:
|
||||
|
@ -200,3 +201,9 @@ def resolve_conf_dirs(configuration, add_conf_dirs):
|
|||
conf_dirs.extend(add_conf_dirs)
|
||||
conf_dirs = set(conf_dirs)
|
||||
return conf_dirs
|
||||
|
||||
|
||||
def resolve_conf_dirs_from_config_and_args(args):
|
||||
cfg = cdist.configuration.Configuration(args)
|
||||
configuration = cfg.get_config(section='GLOBAL')
|
||||
return resolve_conf_dirs(configuration, args.conf_dir)
|
||||
|
|
|
@ -53,10 +53,7 @@ class Info(object):
|
|||
|
||||
@classmethod
|
||||
def commandline(cls, args):
|
||||
cfg = cdist.configuration.Configuration(args)
|
||||
configuration = cfg.get_config(section='GLOBAL')
|
||||
conf_dirs = util.resolve_conf_dirs(configuration,
|
||||
args.conf_dir)
|
||||
conf_dirs = util.resolve_conf_dirs_from_config_and_args(args)
|
||||
c = cls(conf_dirs, args)
|
||||
c.run()
|
||||
|
||||
|
@ -170,7 +167,8 @@ class Info(object):
|
|||
|
||||
def run(self):
|
||||
rv = []
|
||||
for conf_path in self.conf_dirs:
|
||||
for cp in self.conf_dirs:
|
||||
conf_path = os.path.expanduser(cp)
|
||||
if self.all or self.display_global_explorers:
|
||||
rv.extend((x, 'E', ) for x in self._get_global_explorers(
|
||||
conf_path))
|
||||
|
|
|
@ -101,13 +101,10 @@ class PreOS(object):
|
|||
action='store_true', default=False)
|
||||
parser.add_argument('remainder_args', nargs=argparse.REMAINDER)
|
||||
args = parser.parse_args(argv[1:])
|
||||
cdist.argparse.handle_loglevel(args)
|
||||
st.argparse.handle_loglevel(args)
|
||||
log.debug("preos args : {}".format(args))
|
||||
|
||||
cfg = cdist.configuration.Configuration(args)
|
||||
configuration = cfg.get_config(section='GLOBAL')
|
||||
conf_dirs = util.resolve_conf_dirs(configuration,
|
||||
args.conf_dir)
|
||||
conf_dirs = util.resolve_conf_dirs_from_config_and_args(args)
|
||||
|
||||
extend_plugins_path(conf_dirs)
|
||||
sys.path.extend(_PLUGINS_PATH)
|
||||
|
|
|
@ -4,6 +4,7 @@ Changelog
|
|||
next:
|
||||
* Type __acl: Add --entry parameter to replace --acl, deprecate --acl (Ander Punnar)
|
||||
* Core: preos: Fix missing configuration file usage, support -g, --config-file option (Darko Poljak)
|
||||
* Core info command: Support tilde expansion of conf directories (Darko Poljak)
|
||||
|
||||
6.4.0: 2020-01-04
|
||||
* Type __consul_agent: Don't deploy init script on Alpine anymore, it ships with one itself (Nico Schottelius)
|
||||
|
|
Loading…
Reference in a new issue