Permalink
Browse files

fix bug where prompt fails while using node:all and parallel

  • Loading branch information...
1 parent c6fc584 commit 8fe97a129de23d067f20866a9967eaf288e36c39 @chrismoos chrismoos committed Mar 12, 2013
Showing with 10 additions and 1 deletion.
  1. +9 −0 littlechef/lib.py
  2. +1 −1 littlechef/runner.py
View
@@ -20,6 +20,7 @@
from fabric import colors
from fabric.api import env, settings
+from fabric.contrib.console import confirm
from fabric.utils import abort
from littlechef import cookbook_paths
@@ -419,6 +420,14 @@ def get_cookbook_path(cookbook_name):
return path
raise IOError('Can\'t find cookbook with name "{0}"'.format(cookbook_name))
+def global_confirm(question, default=True):
+ """Shows a confirmation that applies to all hosts
+ by temporarily disabling parallel execution in Fabric"""
+ original_parallel = env.parallel
+ env.parallel = False
+ result = confirm(question, default)
+ env.parallel = original_parallel
+ return result
def _pprint(dic):
"""Prints a dictionary with one indentation level"""
@@ -113,7 +113,7 @@ def node(*nodes):
message += " in the {0} environment".format(env.chef_environment)
message += "?"
if not __testing__:
- if not confirm(message):
+ if not lib.global_confirm(message):
abort('Aborted by user')
else:
# A list of nodes was given

0 comments on commit 8fe97a1

Please sign in to comment.