Typo.
[cdist.git] / cdist
diff --git a/cdist b/cdist
index 4c21cef55fc3847d33fc028fe2ac51835527db08..c68ee22fd3f56ca74d76f5b2ca50e55bdf72fe84 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -553,7 +553,8 @@ class DockerTarget(Target):
 
     def command(self, cmd):
         dir = os.path.join(self.directory, os.path.relpath(os.getcwd(), self.directory))
-        command('%s exec %s -i -t %s /bin/bash -c \'export %s; cd %s; %s\'' % (config.docker(), self._user_tag(), self.container, self.variables_string(), dir, cmd))
+        interactive_flag = '-i ' if sys.stdin.isatty() else ''
+        command('%s exec %s %s -t %s /bin/bash -c \'export %s; cd %s; %s\'' % (config.docker(), self._user_tag(), interactive_flag, self.container, self.variables_string(), dir, cmd))
 
     def cleanup(self):
         super(DockerTarget, self).cleanup()
@@ -933,7 +934,13 @@ class Tree(object):
     def add_defaults(self, options):
         """Add the defaults from this into a dict options"""
         if 'option_defaults' in self.cscript:
-            for k, v in self.cscript['option_defaults']().items():
+            from_cscript = self.cscript['option_defaults']
+            if isinstance(from_cscript, dict):
+                defaults_dict = from_cscript
+            else:
+                log("Deprecated cscript option_defaults method; replace with a dict")
+                defaults_dict = from_cscript()
+            for k, v in defaults_dict.items():
                 if not k in options:
                     options[k] = v