From 92a7d555ff99e187d4583559f6abe82739221de9 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Thu, 6 Aug 2009 16:17:00 +0000 Subject: Don't run Actions when client is in dryrun mode Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5400 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Tools/Action.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src') 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''' -- cgit v1.2.3-1-g7c22