BIND 10 trac384, updated. b6bce27baf454101b3755d46877ac84c5eef20f2 [trac384] addressed two comments from jeremy

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Feb 17 10:57:43 UTC 2011


The branch, trac384 has been updated
       via  b6bce27baf454101b3755d46877ac84c5eef20f2 (commit)
       via  6bbb42b7fa668d7a8fcc3cf3809365179705a3a2 (commit)
       via  cad6c0a62b3c5cace703d9863d64dbdb1e047046 (commit)
      from  086b420bfba5b31f13e2828ca1be842a8faad4aa (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b6bce27baf454101b3755d46877ac84c5eef20f2
Author: Jelte Jansen <jelte at isc.org>
Date:   Thu Feb 17 11:55:08 2011 +0100

    [trac384] addressed two comments from jeremy
    
    - only set a prompt if we have an interactive terminal
    - be a bit less verbose on errors
    
    in case of a socket error, only print that error, and not the extra (is it running?) message.
    FailToLogin() exception is no longer printed (the methods that raise it already print the real error themselves)
    Unexpected Exceptions are now printed *more* verbose, i.e. with a full stacktrace instead of just a message. If we want to 'expect' more error types (and only print a short message that speaks for itself, to look more userfriendly), we should add those explicitely, and not use 'except Exception'.

commit 6bbb42b7fa668d7a8fcc3cf3809365179705a3a2
Author: Jelte Jansen <jelte at isc.org>
Date:   Thu Feb 17 11:23:12 2011 +0100

    [trac384] Revert "[trac384] removed an unused if branch"
    
    This reverts commit 086b420bfba5b31f13e2828ca1be842a8faad4aa.
    
    Conflicts:
    
    	src/bin/bindctl/bindcmd.py

commit cad6c0a62b3c5cace703d9863d64dbdb1e047046
Author: Jelte Jansen <jelte at isc.org>
Date:   Thu Feb 17 11:20:08 2011 +0100

    [trac384] fix the config go command
    
    It had stopped working for any identifier that did not start with /, this should fix that

-----------------------------------------------------------------------

Summary of changes:
 src/bin/bindctl/bindcmd.py           |   23 +++++++++++++++--------
 src/bin/bindctl/bindctl-source.py.in |   17 +++++++----------
 2 files changed, 22 insertions(+), 18 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bindctl/bindcmd.py b/src/bin/bindctl/bindcmd.py
index 4b091e2..a9060e2 100644
--- a/src/bin/bindctl/bindcmd.py
+++ b/src/bin/bindctl/bindcmd.py
@@ -51,7 +51,6 @@ except ImportError:
     my_readline = sys.stdin.readline
 
 CSV_FILE_NAME = 'default_user.csv'
-FAIL_TO_CONNECT_WITH_CMDCTL = "Fail to connect with b10-cmdctl module, is it running?"
 CONFIG_MODULE_NAME = 'config'
 CONST_BINDCTL_HELP = """
 usage: <module name> <command name> [param1 = value1 [, param2 = value2]]
@@ -92,7 +91,10 @@ class BindCmdInterpreter(Cmd):
         Cmd.__init__(self)
         self.location = ""
         self.prompt_end = '> '
-        self.prompt = self.prompt_end
+        if sys.stdin.isatty():
+            self.prompt = self.prompt_end
+        else:
+            self.prompt = ""
         self.ruler = '-'
         self.modules = OrderedDict()
         self.add_module_info(ModuleInfo("help", desc = "Get help for bindctl"))
@@ -119,8 +121,8 @@ class BindCmdInterpreter(Cmd):
 
             self.cmdloop()
         except FailToLogin as err:
-            print(err)
-            print(FAIL_TO_CONNECT_WITH_CMDCTL)
+            # error already printed when this was raised, ignoring
+            pass
         except KeyboardInterrupt:
             print('\nExit from bindctl')
 
@@ -270,8 +272,10 @@ class BindCmdInterpreter(Cmd):
         return line 
 
     def postcmd(self, stop, line):
-        '''Update the prompt after every command'''
-        self.prompt = self.location + self.prompt_end
+        '''Update the prompt after every command, but only if we
+           have a tty as output'''
+        if sys.stdin.isatty():
+            self.prompt = self.location + self.prompt_end
         return stop
 
     def _prepare_module_commands(self, module_spec):
@@ -525,8 +529,7 @@ class BindCmdInterpreter(Cmd):
             self._validate_cmd(cmd)
             self._handle_cmd(cmd)
         except (IOError, http.client.HTTPException) as err:
-            print('Error!', err)
-            print(FAIL_TO_CONNECT_WITH_CMDCTL)
+            print('Error: ', err)
         except BindCtlException as err:
             print("Error! ", err)
             self._print_correct_usage(err)
@@ -569,6 +572,10 @@ class BindCmdInterpreter(Cmd):
                 identifier += "/"
             if cmd.params['identifier'].startswith("/"):
                 identifier = cmd.params['identifier']
+            else:
+                if cmd.params['identifier'].startswith('['):
+                    identifier = identifier[:-1]
+                identifier += cmd.params['identifier']
 
             # Check if the module is known; for unknown modules
             # we currently deny setting preferences, as we have
diff --git a/src/bin/bindctl/bindctl-source.py.in b/src/bin/bindctl/bindctl-source.py.in
index 38b649d..ffb77bf 100644
--- a/src/bin/bindctl/bindctl-source.py.in
+++ b/src/bin/bindctl/bindctl-source.py.in
@@ -124,15 +124,12 @@ def set_bindctl_options(parser):
                       help = 'PEM formatted server certificate validation chain file')
 
 if __name__ == '__main__':
-    try:
-        parser = OptionParser(version = VERSION)
-        set_bindctl_options(parser)
-        (options, args) = parser.parse_args()
-        server_addr = options.addr + ':' + str(options.port)
-        tool = BindCmdInterpreter(server_addr, pem_file=options.cert_chain)
-        prepare_config_commands(tool)
-        tool.run()
-    except Exception as e:
-        print(e, "\nFailed to connect with b10-cmdctl module, is it running?")
+    parser = OptionParser(version = VERSION)
+    set_bindctl_options(parser)
+    (options, args) = parser.parse_args()
+    server_addr = options.addr + ':' + str(options.port)
+    tool = BindCmdInterpreter(server_addr, pem_file=options.cert_chain)
+    prepare_config_commands(tool)
+    tool.run()
 
 




More information about the bind10-changes mailing list