Browse Source

[1843] don't revert local config on execute failure

instead, just print some advice
Jelte Jansen 13 years ago
parent
commit
3de6e881f6
2 changed files with 5 additions and 26 deletions
  1. 5 6
      src/bin/bindctl/bindcmd.py
  2. 0 20
      tests/lettuce/features/bindctl_commands.feature

+ 5 - 6
src/bin/bindctl/bindcmd.py

@@ -782,10 +782,6 @@ class BindCmdInterpreter(Cmd):
            The execution is stopped if there are any errors.
         '''
         verbose = False
-        # Keep a copy of the original local changes, in case the
-        # given command set changes things but fails later
-        local_changes_backup =\
-            copy.deepcopy(self.config_data.get_local_changes())
         try:
             for line in commands:
                 line = line.strip()
@@ -813,8 +809,11 @@ class BindCmdInterpreter(Cmd):
                 isc.cc.data.DataAlreadyPresentError,
                 KeyError) as err:
             print('Error: ', err)
-            # revert changes
-            self.config_data.set_local_changes(local_changes_backup)
+            print()
+            print('Depending on the contents of the script, and which')
+            print('commands it has called, there can be committed and')
+            print('local changes. It is advised to check your settings,')
+            print('and revert local changes with "config revert".')
 
     def apply_cmd(self, cmd):
         '''Handles a general module command'''

+ 0 - 20
tests/lettuce/features/bindctl_commands.feature

@@ -101,26 +101,6 @@ Feature: control with bindctl
         send bind10 the command config show Boss/components
         last bindctl output should not contain b10-auth
 
-        # the bad command should also keep existing changes intact,
-        # i.e. if we add something, then run a failing script, our
-        # addition should still be there, but those from the script
-        # should not
-        When I send bind10 the following commands:
-        """
-        config add Boss/components b10-resolver
-        config set Boss/components/b10-resolver/kind dispensable
-        config set Boss/components/b10-resolver/special resolver
-        execute file data/commands/bad_command
-        config commit
-        """
-        last bindctl output should contain shouldshow
-        last bindctl output should contain Error
-        last bindctl output should not contain shouldnotshow
-        # This would fail if the entire list was passed, or the configuratio
-        send bind10 the command config show Boss/components
-        last bindctl output should not contain b10-auth
-        last bindctl output should contain b10-resolver
-
         # nested_command contains another execute script
         When I send bind10 the command execute file data/commands/nested
         last bindctl output should contain shouldshow