summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Client/Frame.py14
-rw-r--r--src/lib/Options.py2
-rwxr-xr-xsrc/sbin/bcfg211
3 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py
index a54760b12..009ee61ec 100644
--- a/src/lib/Client/Frame.py
+++ b/src/lib/Client/Frame.py
@@ -148,6 +148,20 @@ class Frame:
candidates = [entry for entry in self.states if not self.states[entry]]
self.whitelist = [entry for entry in self.states if not self.states[entry]]
+ # Need to process decision stuff early, so that dryrun mode works with it
+ if self.setup['decision'] == 'whitelist':
+ dwl = self.setup['decision_list'][0]
+ self.whitelist = [e for e in self.whitelist \
+ if (e.tag, e.get('name')) in dwl or \
+ (e.tag, '*') in dwl or \
+ ('*', e.get('name')) in dwl]
+ elif self.setup['decision'] == 'blacklist':
+ dbl = self.setup['decision_list'][1]
+ self.whitelist = [e for e in self.whitelist \
+ if (e.tag, e.get('name')) not in dbl and \
+ (e.tag, '*') not in dbl and \
+ ('*', e.get('name')) not in dbl]
+
if self.dryrun:
if self.whitelist:
self.logger.info("In dryrun mode: suppressing entry installation for:")
diff --git a/src/lib/Options.py b/src/lib/Options.py
index bea1e4178..54ff8bbcb 100644
--- a/src/lib/Options.py
+++ b/src/lib/Options.py
@@ -227,6 +227,8 @@ CLIENT_BUNDLE = Option('only configure the given bundle', default=[],
cmd='-b', odesc='<bundle>', cook=colon_split)
CLIENT_KEVLAR = Option('run in kevlar (bulletproof) mode', default=False,
cmd='-k', )
+CLIENT_DLIST = Option('run client in server decision list mode', default=False,
+ cmd='-l', odesc='<whitelist|blacklist>')
CLIENT_BUILD = Option('run in build mode', default=False, cmd='-B', )
CLIENT_FILE = Option('configure from a file rather than querying the server',
default=False, cmd='-f', odesc='<specification path>')
diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2
index 42371009f..a151b9fd8 100755
--- a/src/sbin/bcfg2
+++ b/src/sbin/bcfg2
@@ -121,6 +121,7 @@ class Client:
'encoding': Bcfg2.Options.ENCODING,
'omit-lock-check': Bcfg2.Options.OMIT_LOCK_CHECK,
'filelog': Bcfg2.Options.LOGGING_FILE_PATH,
+ 'decision': Bcfg2.Options.CLIENT_DLIST,
}
self.setup = Bcfg2.Options.OptionParser(optinfo)
@@ -256,6 +257,16 @@ class Client:
times['probe_upload'] = time.time()
+ if self.setup['decision'] in ['whitelist', 'blacklist']:
+ try:
+ self.setup['decision_list'] = proxy.GetDecisionList()
+ except xmlrpclib.Fault, f:
+ if f.faultCode == 1:
+ print "GetDecisionList method not supported by server"
+ else:
+ self.logger.error("Failed to de", exc_info=1)
+ raise SystemExit(1)
+
try:
rawconfig = proxy.GetConfig()
except xmlrpclib.Fault: