diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2014-08-01 02:13:35 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2014-08-01 02:38:11 +0200 |
commit | f35ae1868a9bf04e7e995f502afb34e275e62564 (patch) | |
tree | 3b0d1eefcecaaf7e0699f94906b300329472bd80 /src/lib | |
parent | 7193a42822d1aa1ec8165297246b9260eda6c68f (diff) | |
download | bcfg2-f35ae1868a9bf04e7e995f502afb34e275e62564.tar.gz bcfg2-f35ae1868a9bf04e7e995f502afb34e275e62564.tar.bz2 bcfg2-f35ae1868a9bf04e7e995f502afb34e275e62564.zip |
Client: support dryrun mode and only-important
Add support for displaying the skipped entries in dryrun mode when using
the --only-important command line flag.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Bcfg2/Client/__init__.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Client/__init__.py b/src/lib/Bcfg2/Client/__init__.py index 138c17546..ef4f1c33f 100644 --- a/src/lib/Bcfg2/Client/__init__.py +++ b/src/lib/Bcfg2/Client/__init__.py @@ -562,7 +562,9 @@ class Client(object): if x not in b_to_rem] # take care of important entries first - if not Bcfg2.Options.setup.dry_run: + if (not Bcfg2.Options.setup.dry_run or + Bcfg2.Options.setup.only_important): + important_installs = set() for parent in self.config.findall(".//Path/.."): name = parent.get("name") if (name and (name in Bcfg2.Options.setup.only_bundles or @@ -577,6 +579,9 @@ class Client(object): if t.handlesEntry(cfile) and t.canVerify(cfile)] if not tools: continue + if Bcfg2.Options.setup.dry_run: + important_installs.add(cfile) + continue if (Bcfg2.Options.setup.interactive and not self.promptFilter("Install %s: %s? (y/N):", [cfile])): @@ -592,6 +597,11 @@ class Client(object): cfile.set('qtext', '') if tools[0].VerifyPath(cfile, []): self.whitelist.remove(cfile) + if Bcfg2.Options.setup.dry_run and len(important_installs) > 0: + self.logger.info("In dryrun mode: " + "suppressing entry installation for:") + self.logger.info(["%s:%s" % (e.tag, e.get('name')) + for e in important_installs]) def Inventory(self): """ |