Remove config from shell arguments (careful!)
authorStavros Sachtouris <saxtouri@admin.grnet.gr>
Mon, 10 Dec 2012 16:18:20 +0000 (18:18 +0200)
committerStavros Sachtouris <saxtouri@admin.grnet.gr>
Mon, 10 Dec 2012 16:18:20 +0000 (18:18 +0200)
config module is needed for initializing stuff, but should not be
allowd *after* shell is up and running

kamaki/cli/argument.py
kamaki/cli/command_shell.py

index b95f87c..048567d 100644 (file)
@@ -452,13 +452,14 @@ class ArgumentParseManager(object):
             self._unparsed += split_input(' \'%s\' ' % term)
         self._parser_modified = False
 
-
+"""
 def update_arguments(parser, arguments):
-    """Update arguments dict from user input
+    ""Update arguments dict from user input
 
-    """
+    ""
     for name, argument in arguments.items():
         try:
             argument.update_parser(parser, name)
         except ArgumentError:
             pass
+"""
\ No newline at end of file
index 3bcd097..52fdaf4 100644 (file)
@@ -168,6 +168,9 @@ class Shell(Cmd):
                 cmd_parser.syntax = '%s %s' % (
                     subcmd.path.replace('_', ' '), cls.syntax)
                 cmd_parser.update_arguments(instance.arguments)
+                instance.arguments.pop('config')
+                cmd_parser = ArgumentParseManager(cmd_parser.syntax,
+                    instance.arguments)
                 if '-h' in cmd_args or '--help' in cmd_args:
                     cmd_parser.parser.print_help()
                     return