summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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'''