summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--schemas/types.xsd12
-rw-r--r--src/lib/Bcfg2/Client/Tools/Action.py16
2 files changed, 22 insertions, 6 deletions
diff --git a/schemas/types.xsd b/schemas/types.xsd
index 7bf46f4b7..4e3dfd70f 100644
--- a/schemas/types.xsd
+++ b/schemas/types.xsd
@@ -162,8 +162,16 @@
<xsd:attribute type='xsd:string' name='command' use='required'>
<xsd:annotation>
<xsd:documentation>
- The command to run. The command is executed within a shell,
- so flow control and other shell-specific things can be used.
+ The command to run.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:boolean' name='shell'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether the command string should be executeed within a shell.
+ If enabled flow control and other shell-specific things can
+ be used.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
diff --git a/src/lib/Bcfg2/Client/Tools/Action.py b/src/lib/Bcfg2/Client/Tools/Action.py
index da4412b1d..0166e4c00 100644
--- a/src/lib/Bcfg2/Client/Tools/Action.py
+++ b/src/lib/Bcfg2/Client/Tools/Action.py
@@ -32,10 +32,17 @@ class Action(Bcfg2.Client.Tools.Tool):
def RunAction(self, entry):
"""This method handles command execution and status return."""
+ shell = False
+ shell_string = ''
+ if entry.get('shell', 'false') == 'true':
+ shell = True
+ shell_string = '(in shell) '
+
if not self.setup['dryrun']:
if self.setup['interactive']:
- prompt = ('Run Action %s, %s: (y/N): ' %
- (entry.get('name'), entry.get('command')))
+ prompt = ('Run Action %s%s, %s: (y/N): ' %
+ (shell_string, entry.get('name'),
+ entry.get('command')))
# flush input buffer
while len(select.select([sys.stdin.fileno()], [], [],
0.0)[0]) > 0:
@@ -48,8 +55,9 @@ class Action(Bcfg2.Client.Tools.Tool):
self.logger.debug("Action: Deferring execution of %s due "
"to build mode" % entry.get('command'))
return False
- self.logger.debug("Running Action %s" % (entry.get('name')))
- rv = self.cmd.run(entry.get('command'))
+ self.logger.debug("Running Action %s %s" %
+ (shell_string, entry.get('name')))
+ rv = self.cmd.run(entry.get('command'), shell=shell)
self.logger.debug("Action: %s got return code %s" %
(entry.get('command'), rv.retval))
entry.set('rc', str(rv.retval))