summaryrefslogtreecommitdiff
path: root/dotbot/plugins/shell.py
diff options
context:
space:
mode:
Diffstat (limited to 'dotbot/plugins/shell.py')
-rw-r--r--dotbot/plugins/shell.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/dotbot/plugins/shell.py b/dotbot/plugins/shell.py
index f0121e6..75d4dca 100644
--- a/dotbot/plugins/shell.py
+++ b/dotbot/plugins/shell.py
@@ -11,7 +11,7 @@ class Shell(dotbot.Plugin):
_directive = 'shell'
- def handle(self, directive, data):
+ def handle(self, directive, data, dry_run):
success = True
defaults = self._context.defaults().get('shell', {})
for item in data:
@@ -38,6 +38,10 @@ class Shell(dotbot.Plugin):
self._log.info('%s' % msg)
else:
self._log.info('%s [%s]' % (msg, cmd))
+
+ if dry_run:
+ continue
+
ret = dotbot.util.shell_command(
cmd,
cwd=self._context.base_directory(),
@@ -48,8 +52,13 @@ class Shell(dotbot.Plugin):
if ret != 0:
success = False
self._log.warning('Command [%s] failed' % cmd)
- if success:
+
+ if dry_run:
+ self._log.verbose('shell/dry run: commands not executed')
+ success = False
+ elif success:
self._log.verbose('All commands have been executed')
else:
self._log.error('Some commands were not successfully executed')
+
return success