Commit c4a6ec1b authored by Stavros Sachtouris's avatar Stavros Sachtouris

Rename class _command_init --> CommandInit

Class is located at kamaki.cli.cmds
parent aa8c69ec
......@@ -96,7 +96,7 @@ application to load the list of commands from the *_commands* array.
The command decorator
---------------------
All commands are specified by subclasses of *kamaki.cli.cmds._command_init*
All commands are specified by subclasses of *kamaki.cli.cmds.CommandInit*
These classes are called "command specifications".
The *command* decorator mines all the information needed to build namespaces
......@@ -229,7 +229,7 @@ or more usually and elegantly:
Accessing run-time arguments
----------------------------
To access run-time arguments, command classes extend the *_command_init*
To access run-time arguments, command classes extend the *CommandInit*
interface, which implements *__item__* accessors to handle run-time argument
values. In other words, one may get the runtime value of an argument by calling
*self[<argument>]*.
......@@ -237,10 +237,10 @@ values. In other words, one may get the runtime value of an argument by calling
.. code-block:: python
from kamaki.cli.argument import ValueArgument
from kamaki.cli.commands import _command_init
from kamaki.cli.commands import CommandInit
@command(_mygrp1_commands)
class mygrp1_list_details(_command_init):
class mygrp1_list_details(CommandInit):
"""List of details"""
arguments = dict(
......@@ -266,7 +266,7 @@ required at command specification level:
...
@command(_mygrp1_commands)
class mygrp1_list_details(_command_init):
class mygrp1_list_details(CommandInit):
"""List of details"""
arguments = dict(
......@@ -370,7 +370,7 @@ Summary: create a command set
# File: grps.py
from kamaki.cli.cmds import _command_init
from kamaki.cli.cmds import CommandInit
from kamaki.cli.cmdtree import CommandTree
from kamaki.cli.argument import ValueArgument, FlagArgument
...
......@@ -388,14 +388,14 @@ Summary: create a command set
@command(_mygrp1_commands)
class mygrp1_list(_command_init):
class mygrp1_list(CommandInit):
"""List mygrp1 objects.
There are two versions: short and detailed
"""
@command(_mygrp1_commands)
class mygrp1_list_all(_command_init):
class mygrp1_list_all(CommandInit):
"""show a list"""
def _run():
......@@ -406,7 +406,7 @@ Summary: create a command set
@command(_mygrp1_commands)
class mygrp1_list_details(_command_init):
class mygrp1_list_details(CommandInit):
"""show list of details"""
arguments = dict(
......@@ -426,7 +426,7 @@ Summary: create a command set
@command(_mygrp2_commands)
class mygrp2_list_all(_command_init):
class mygrp2_list_all(CommandInit):
"""list all subjects"""
arguments = dict(
......@@ -445,7 +445,7 @@ Summary: create a command set
@command(_mygrp2_commands)
class mygrp2_info(_command_init):
class mygrp2_info(CommandInit):
"""get information for subject with id"""
def _run(self, grp_id, grp_name):
......
......@@ -311,8 +311,8 @@ def init_cached_authenticator(config_argument, cloud, logger):
auth_base.authenticate(token)
else:
tmp_base = CachedAstakosClient(url, token)
from kamaki.cli.cmds import _command_init
fake_cmd = _command_init(dict(config=config_argument))
from kamaki.cli.cmds import CommandInit
fake_cmd = CommandInit(dict(config=config_argument))
fake_cmd.client = auth_base
fake_cmd._set_log_params()
tmp_base.authenticate(token)
......
......@@ -74,7 +74,7 @@ def dataModification(func):
return wrap
class _command_init(object):
class CommandInit(object):
# self.arguments (dict) contains all non-positional arguments
# self.required (list or tuple) contains required argument keys
......
......@@ -37,7 +37,7 @@ from os.path import abspath
from kamaki.cli import command
from kamaki.clients.astakos import LoggedAstakosClient
from kamaki.cli.cmds import (
_command_init, errors, _optional_json, addLogSettings, _name_filter)
CommandInit, errors, _optional_json, addLogSettings, _name_filter)
from kamaki.cli.cmdtree import CommandTree
from kamaki.cli.errors import (
CLIBaseUrlError, CLISyntaxError, CLIError, CLIInvalidArgument)
......@@ -88,7 +88,7 @@ def with_temp_token(func):
return wrap
class _init_synnefo_astakosclient(_command_init):
class _init_synnefo_astakosclient(CommandInit):
@errors.generic.all
@errors.user.load
......
......@@ -33,7 +33,7 @@
from kamaki.cli import command
from kamaki.cli.argument import FlagArgument
from kamaki.cli.cmds import _command_init, errors
from kamaki.cli.cmds import CommandInit, errors
from kamaki.cli.cmdtree import CommandTree
from kamaki.cli.errors import CLIError, CLISyntaxError
......@@ -58,7 +58,7 @@ about_options = '\nAbout options:\
@command(config_cmds)
class config_list(_command_init):
class config_list(CommandInit):
"""List all configuration options
FAQ:
Q: I haven't set any options!
......@@ -84,7 +84,7 @@ class config_list(_command_init):
@command(config_cmds)
class config_get(_command_init):
class config_get(CommandInit):
"""Show a configuration option"""
__doc__ += about_options
......@@ -118,7 +118,7 @@ class config_get(_command_init):
@command(config_cmds)
class config_set(_command_init):
class config_set(CommandInit):
"""Set a configuration option"""
__doc__ += about_options
......@@ -152,7 +152,7 @@ class config_set(_command_init):
@command(config_cmds)
class config_delete(_command_init):
class config_delete(CommandInit):
"""Delete a configuration option
Default values are not removed by default. To alter this behavior in a
session, use --default.
......
......@@ -47,7 +47,7 @@ from kamaki.cli.argument import (
FlagArgument, ValueArgument, KeyValueArgument, RepeatableArgument,
ProgressBarArgument, DateArgument, IntArgument, StatusArgument)
from kamaki.cli.cmds import (
_command_init, errors, addLogSettings, dataModification,
CommandInit, errors, addLogSettings, dataModification,
_optional_output_cmd, _optional_json, _name_filter, _id_filter)
......@@ -112,7 +112,7 @@ class _server_wait(_service_wait):
timeout=timeout if current_status not in ('BUILD', ) else 100)
class _init_cyclades(_command_init):
class _init_cyclades(CommandInit):
@errors.generic.all
@addLogSettings
def _run(self):
......
......@@ -35,14 +35,14 @@ from kamaki.cli.cmdtree import CommandTree
from kamaki.cli.argument import ValueArgument
from kamaki.cli.history import History
from kamaki.cli import command
from kamaki.cli.cmds import _command_init, errors
from kamaki.cli.cmds import CommandInit, errors
history_cmds = CommandTree('history', 'Kamaki command history')
_commands = [history_cmds]
class _init_history(_command_init):
class _init_history(CommandInit):
@errors.generic.all
@errors.history.init
def _run(self):
......
......@@ -49,8 +49,8 @@ from kamaki.cli.argument import (
from kamaki.cli.cmds.cyclades import _init_cyclades
from kamaki.cli.errors import CLIError, raiseCLIError, CLIInvalidArgument
from kamaki.cli.cmds import (
_command_init, errors, addLogSettings, _optional_output_cmd,
_optional_json, _name_filter, _id_filter)
CommandInit, errors, addLogSettings, _optional_output_cmd, _optional_json,
_name_filter, _id_filter)
image_cmds = CommandTree('image', 'Cyclades/Plankton API image commands')
......@@ -75,7 +75,7 @@ about_image_id = ['To see a list of available image ids: /image list']
log = getLogger(__name__)
class _init_image(_command_init):
class _init_image(CommandInit):
@errors.generic.all
@addLogSettings
def _run(self):
......
......@@ -44,7 +44,7 @@ from kamaki.cli.argument import (
FlagArgument, ValueArgument, RepeatableArgument, IntArgument,
StatusArgument)
from kamaki.cli.cmds import (
_command_init, errors, addLogSettings, _optional_output_cmd,
CommandInit, errors, addLogSettings, _optional_output_cmd,
_optional_json, _name_filter, _id_filter)
from kamaki.cli.cmds.cyclades import _service_wait
......@@ -72,7 +72,7 @@ class _port_wait(_service_wait):
timeout=timeout)
class _init_network(_command_init):
class _init_network(CommandInit):
@errors.generic.all
@addLogSettings
def _run(self):
......
......@@ -41,7 +41,7 @@ from kamaki.clients.pithos import PithosClient, ClientError
from kamaki.cli import command
from kamaki.cli.cmdtree import CommandTree
from kamaki.cli.cmds import (
_command_init, errors, addLogSettings, DontRaiseKeyError, _optional_json,
CommandInit, errors, addLogSettings, DontRaiseKeyError, _optional_json,
_name_filter, _optional_output_cmd)
from kamaki.cli.errors import (
CLIBaseUrlError, CLIError, CLIInvalidArgument, raiseCLIError,
......@@ -61,7 +61,7 @@ group_cmds = CommandTree('group', 'Pithos+/Storage user groups')
_commands = [file_cmds, container_cmds, sharer_cmds, group_cmds]
class _pithos_init(_command_init):
class _pithos_init(CommandInit):
"""Initilize a pithos+ client
There is always a default account (current user uuid)
There is always a default container (pithos)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment