Fix config-forget bug
authorStavros Sachtouris <saxtouri@admin.grnet.gr>
Mon, 19 Nov 2012 14:42:58 +0000 (16:42 +0200)
committerStavros Sachtouris <saxtouri@admin.grnet.gr>
Mon, 19 Nov 2012 14:42:58 +0000 (16:42 +0200)
kamaki/cli/__init__.py
kamaki/cli/argument.py
kamaki/cli/command_shell.py
kamaki/cli/commands/config_cli.py

index 52a1f99..0d4c9b2 100644 (file)
@@ -419,6 +419,7 @@ def main():
             exit(0)
 
         _init_session(_arguments)
+        print('ICN[%s]' % _arguments['config'].value)
 
         if unparsed:
             _history = History(_arguments['config'].get('history', 'file'))
index ab47010..786384f 100644 (file)
@@ -116,6 +116,8 @@ class Argument(object):
 
 
 class ConfigArgument(Argument):
+    _config_file = None
+
     @property
     def value(self):
         super(self.__class__, self).value
@@ -123,7 +125,13 @@ class ConfigArgument(Argument):
 
     @value.setter
     def value(self, config_file):
-        self._value = Config(config_file) if config_file else Config()
+        if config_file:
+            self._value = Config(config_file)
+            self._config_file = config_file
+        elif self._config_file:
+            self._value = Config(self._config_file)
+        else:
+            self._value = Config()
 
     def get(self, group, term):
         return self.value.get(group, term)
index e659a64..2c93ded 100644 (file)
@@ -37,7 +37,7 @@ from sys import stdout
 from argparse import ArgumentParser
 
 from kamaki.cli import _exec_cmd, _print_error_message
-from kamaki.cli.argument import _arguments, update_arguments
+from kamaki.cli.argument import update_arguments
 from kamaki.cli.utils import print_dict
 from kamaki.cli.history import History
 from kamaki.cli.errors import CLIError
@@ -47,6 +47,7 @@ def _init_shell(exe_string, arguments):
     arguments.pop('version', None)
     arguments.pop('options', None)
     arguments.pop('history', None)
+    print('SHELL? [%s]' % arguments['config'].value)
     shell = Shell()
     shell.set_prompt(exe_string)
     from kamaki import __version__ as version
index c726747..1c42c38 100644 (file)
@@ -37,7 +37,7 @@ from kamaki.cli.commands import _command_init
 from kamaki.cli.command_tree import CommandTree
 
 config_cmds = CommandTree('config', 'Configuration commands')
-_command = [config_cmds]
+_commands = [config_cmds]
 
 
 @command(config_cmds)