summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-08-06 16:17:00 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-08-06 16:17:00 +0000
commit92a7d555ff99e187d4583559f6abe82739221de9 (patch)
tree6a283c7810674fd908413231d77bb4fffea55552 /src/lib
parent5d69ff7e966c4ffa911c78d11a6879b48e90aef8 (diff)
downloadbcfg2-92a7d555ff99e187d4583559f6abe82739221de9.tar.gz
bcfg2-92a7d555ff99e187d4583559f6abe82739221de9.tar.bz2
bcfg2-92a7d555ff99e187d4583559f6abe82739221de9.zip
Don't run Actions when client is in dryrun mode
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5400 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Client/Tools/Action.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/lib/Client/Tools/Action.py b/src/lib/Client/Tools/Action.py
index 0fe198444..0731ec191 100644
--- a/src/lib/Client/Tools/Action.py
+++ b/src/lib/Client/Tools/Action.py
@@ -17,18 +17,21 @@ class Action(Bcfg2.Client.Tools.Tool):
def RunAction(self, entry):
'''This method handles command execution and status return'''
- if self.setup['interactive']:
- prompt = 'Run Action %s, %s: (y/N): ' % (entry.get('name'), entry.get('command'))
- if raw_input(prompt) not in ['y', 'Y']:
- return False
- self.logger.debug("Running Action %s" % (entry.get('name')))
- rc = self.cmd.run(entry.get('command'))[0]
- self.logger.debug("Action: %s got rc %s" % (entry.get('command'), rc))
- entry.set('rc', str(rc))
- if entry.get('status', 'check') == 'ignore':
- return True
+ if not self.setup['dryrun']:
+ if self.setup['interactive']:
+ prompt = 'Run Action %s, %s: (y/N): ' % (entry.get('name'), entry.get('command'))
+ if raw_input(prompt) not in ['y', 'Y']:
+ return False
+ self.logger.debug("Running Action %s" % (entry.get('name')))
+ rc = self.cmd.run(entry.get('command'))[0]
+ self.logger.debug("Action: %s got rc %s" % (entry.get('command'), rc))
+ entry.set('rc', str(rc))
+ if entry.get('status', 'check') == 'ignore':
+ return True
+ else:
+ return rc == 0
else:
- return rc == 0
+ return False
def VerifyAction(self, dummy, _):
'''Actions always verify true'''