summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-25 08:55:20 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-25 08:55:20 -0500
commitaddb374b3388c7faa33ff5664293348874dd295d (patch)
treea376438b84cccf4c26c4e1c92deeccd7ce92ce28 /src
parentc31d8664f0c1bf78c085f0e6d83db44c81c81372 (diff)
downloadbcfg2-addb374b3388c7faa33ff5664293348874dd295d.tar.gz
bcfg2-addb374b3388c7faa33ff5664293348874dd295d.tar.bz2
bcfg2-addb374b3388c7faa33ff5664293348874dd295d.zip
prompt for interactive install of pre and both actions (#1052)
Diffstat (limited to 'src')
-rw-r--r--src/lib/Client/Frame.py42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py
index eca8960c1..d17f70f1b 100644
--- a/src/lib/Client/Frame.py
+++ b/src/lib/Client/Frame.py
@@ -240,25 +240,25 @@ class Frame:
if self.setup['remove'] == 'all':
self.removal = self.extra
elif self.setup['remove'] in ['services', 'Services']:
- self.removal = [entry for entry in self.extra \
+ self.removal = [entry for entry in self.extra
if entry.tag == 'Service']
elif self.setup['remove'] in ['packages', 'Packages']:
- self.removal = [entry for entry in self.extra \
+ self.removal = [entry for entry in self.extra
if entry.tag == 'Package']
- candidates = [entry for entry in self.states \
+ candidates = [entry for entry in self.states
if not self.states[entry]]
if self.dryrun:
if self.whitelist:
self.logger.info("In dryrun mode: suppressing entry installation for:")
- self.logger.info(["%s:%s" % (entry.tag, entry.get('name')) for entry \
- in self.whitelist])
+ self.logger.info(["%s:%s" % (entry.tag, entry.get('name'))
+ for entry in self.whitelist])
self.whitelist = []
if self.removal:
self.logger.info("In dryrun mode: suppressing entry removal for:")
- self.logger.info(["%s:%s" % (entry.tag, entry.get('name')) for entry \
- in self.removal])
+ self.logger.info(["%s:%s" % (entry.tag, entry.get('name'))
+ for entry in self.removal])
self.removal = []
return
# Here is where most of the work goes
@@ -270,13 +270,13 @@ class Frame:
for bundle in self.setup['bundle']:
if bundle not in all_bundle_names:
self.logger.info("Warning: Bundle %s not found" % bundle)
- bundles = [b for b in self.config.findall('./Bundle') \
+ bundles = [b for b in self.config.findall('./Bundle')
if b.get('name') in self.setup['bundle']]
- self.whitelist = [e for e in self.whitelist if \
- True in [e in b for b in bundles]]
+ self.whitelist = [e for e in self.whitelist
+ if True in [e in b for b in bundles]]
elif self.setup['indep']:
- bundles = [nb for nb in self.config.getchildren() if nb.tag != \
- 'Bundle']
+ bundles = [nb for nb in self.config.getchildren()
+ if nb.tag != 'Bundle']
else:
bundles = self.config.getchildren()
@@ -284,22 +284,24 @@ class Frame:
for bundle in bundles[:]:
if bundle.tag != 'Bundle':
continue
- actions = [a for a in bundle.findall('./Action') \
- if a.get('timing') != 'post']
- # now we process all "always actions"
bmodified = len([item for item in bundle if item in self.whitelist])
- for action in actions:
- if bmodified or action.get('when') == 'always':
- self.DispatchInstallCalls([action])
+ actions = [a for a in bundle.findall('./Action')
+ if (a.get('timing') != 'post' and
+ (bmodified or a.get('when') == 'always'))]
+ # now we process all "always actions"
+ if self.setup['interactive']:
+ promptFilter(prompt, actions)
+ self.DispatchInstallCalls(actions)
+
# need to test to fail entries in whitelist
if False in [self.states[a] for a in actions]:
# then display bundles forced off with entries
- self.logger.info("Bundle %s failed prerequisite action" % \
+ self.logger.info("Bundle %s failed prerequisite action" %
(bundle.get('name')))
bundles.remove(bundle)
b_to_remv = [ent for ent in self.whitelist if ent in bundle]
if b_to_remv:
- self.logger.info("Not installing entries from Bundle %s" % \
+ self.logger.info("Not installing entries from Bundle %s" %
(bundle.get('name')))
self.logger.info(["%s:%s" % (e.tag, e.get('name'))
for e in b_to_remv])