From 30c8870dbc6ed77bfe9a88b4a292ec12510f71be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= <sebastien.luttringer@smartjog.com> Date: Thu, 5 Mar 2015 16:46:25 +0100 Subject: [PATCH] Implement cloudcontrol namespaces --- bin/cc-cli | 8 ++++---- cloudcontrol/__init__.py | 17 +++++++++++++++++ {cccli => cloudcontrol/cli}/__init__.py | 0 {cccli => cloudcontrol/cli}/cli.py | 14 +++++++------- {cccli => cloudcontrol/cli}/command.py | 10 +++++----- .../cli}/commands/__init__.py | 0 {cccli => cloudcontrol/cli}/commands/account.py | 6 +++--- .../cli}/commands/addforward.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/alias.py | 5 +++-- .../cli}/commands/attachment.py | 4 ++-- {cccli => cloudcontrol/cli}/commands/cancel.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/console.py | 6 +++--- .../cli}/commands/delforward.py | 4 ++-- {cccli => cloudcontrol/cli}/commands/execute.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/expert.py | 6 +++--- .../cli}/commands/forwards.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/kill.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/list.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/migrate.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/purge.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/right.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/server.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/shell.py | 14 +++++++------- .../cli}/commands/shutdown.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/tag.py | 6 +++--- .../cli}/commands/tagdisplay.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/time.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/vm.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/vnc.py | 6 +++--- {cccli => cloudcontrol/cli}/commands/watch.py | 6 +++--- {cccli => cloudcontrol/cli}/exception.py | 0 {cccli => cloudcontrol/cli}/handler.py | 9 +++++---- {cccli => cloudcontrol/cli}/printer.py | 6 +++--- {cccli => cloudcontrol/cli}/tagdisplay.py | 5 +++-- {cccli => cloudcontrol/cli}/tunnel.py | 3 ++- setup.py | 5 +++-- 36 files changed, 123 insertions(+), 101 deletions(-) create mode 100644 cloudcontrol/__init__.py rename {cccli => cloudcontrol/cli}/__init__.py (100%) rename {cccli => cloudcontrol/cli}/cli.py (96%) rename {cccli => cloudcontrol/cli}/command.py (98%) rename {cccli => cloudcontrol/cli}/commands/__init__.py (100%) rename {cccli => cloudcontrol/cli}/commands/account.py (97%) rename {cccli => cloudcontrol/cli}/commands/addforward.py (95%) rename {cccli => cloudcontrol/cli}/commands/alias.py (96%) rename {cccli => cloudcontrol/cli}/commands/attachment.py (94%) rename {cccli => cloudcontrol/cli}/commands/cancel.py (89%) rename {cccli => cloudcontrol/cli}/commands/console.py (96%) rename {cccli => cloudcontrol/cli}/commands/delforward.py (94%) rename {cccli => cloudcontrol/cli}/commands/execute.py (92%) rename {cccli => cloudcontrol/cli}/commands/expert.py (91%) rename {cccli => cloudcontrol/cli}/commands/forwards.py (93%) rename {cccli => cloudcontrol/cli}/commands/kill.py (89%) rename {cccli => cloudcontrol/cli}/commands/list.py (98%) rename {cccli => cloudcontrol/cli}/commands/migrate.py (96%) rename {cccli => cloudcontrol/cli}/commands/purge.py (89%) rename {cccli => cloudcontrol/cli}/commands/right.py (96%) rename {cccli => cloudcontrol/cli}/commands/server.py (94%) rename {cccli => cloudcontrol/cli}/commands/shell.py (92%) rename {cccli => cloudcontrol/cli}/commands/shutdown.py (92%) rename {cccli => cloudcontrol/cli}/commands/tag.py (95%) rename {cccli => cloudcontrol/cli}/commands/tagdisplay.py (97%) rename {cccli => cloudcontrol/cli}/commands/time.py (92%) rename {cccli => cloudcontrol/cli}/commands/vm.py (98%) rename {cccli => cloudcontrol/cli}/commands/vnc.py (96%) rename {cccli => cloudcontrol/cli}/commands/watch.py (94%) rename {cccli => cloudcontrol/cli}/exception.py (100%) rename {cccli => cloudcontrol/cli}/handler.py (93%) rename {cccli => cloudcontrol/cli}/printer.py (99%) rename {cccli => cloudcontrol/cli}/tagdisplay.py (98%) rename {cccli => cloudcontrol/cli}/tunnel.py (98%) diff --git a/bin/cc-cli b/bin/cc-cli index dc2a5a7..1963034 100755 --- a/bin/cc-cli +++ b/bin/cc-cli @@ -29,10 +29,10 @@ import re import warnings from xdg import BaseDirectory -import cccli -from cccli.cli import Cli -from cccli.printer import Printer -from cccli.exception import * +import cloudcontrol.cli as cccli +from cloudcontrol.cli.cli import Cli +from cloudcontrol.cli.printer import Printer +from cloudcontrol.cli.exception import * settings = { "port": "1984", diff --git a/cloudcontrol/__init__.py b/cloudcontrol/__init__.py new file mode 100644 index 0000000..5496c70 --- /dev/null +++ b/cloudcontrol/__init__.py @@ -0,0 +1,17 @@ +# This file is part of CloudControl. +# +# CloudControl is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# CloudControl is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with CloudControl. If not, see <http://www.gnu.org/licenses/>. + + +__import__('pkg_resources').declare_namespace(__name__) diff --git a/cccli/__init__.py b/cloudcontrol/cli/__init__.py similarity index 100% rename from cccli/__init__.py rename to cloudcontrol/cli/__init__.py diff --git a/cccli/cli.py b/cloudcontrol/cli/cli.py similarity index 96% rename from cccli/cli.py rename to cloudcontrol/cli/cli.py index 3fa267a..ee2582a 100644 --- a/cccli/cli.py +++ b/cloudcontrol/cli/cli.py @@ -19,12 +19,12 @@ CloudControl CLI main module ''' -import cccli -from cccli.exception import * -from cccli.printer import Printer, color -from cccli.command import Commands, Aliases -from cccli.handler import CliHandler -from cccli.tagdisplay import TagDisplay +from cloudcontrol.cli import debug +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Commands, Aliases +from cloudcontrol.cli.handler import CliHandler +from cloudcontrol.cli.tagdisplay import TagDisplay from sjrpc.core import RpcConnection from sjrpc.utils import RpcHandler import threading @@ -188,7 +188,7 @@ class Cli(object): except EOFError: self.printer.out("") except Exception as e: - if cccli.debug: raise + if debug: raise self.printer.error("%s: %s"%(type(e), str(e))) self.printer.warn("This is a not expected error, please report it!") diff --git a/cccli/command.py b/cloudcontrol/cli/command.py similarity index 98% rename from cccli/command.py rename to cloudcontrol/cli/command.py index 9690c26..499ae63 100644 --- a/cccli/command.py +++ b/cloudcontrol/cli/command.py @@ -26,11 +26,11 @@ import shlex import imp import sys -from cccli.exception import * -from sjrpc.core import RpcError -from cccli.printer import Printer, color +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color from optparse import OptionParser -import cccli.commands +from sjrpc.core import RpcError +import cloudcontrol.cli.commands as commands class Commands(object): '''Command manager''' @@ -39,7 +39,7 @@ class Commands(object): # save cli context self.cli = cli # build command list - self.cmds = self.load_commands(cccli.commands.__path__[0], Command) + self.cmds = self.load_commands(commands.__path__[0], Command) # build remote function list try: self.functions = set([ c["name"] for c in self.cli.rpc.call("functions") ]) diff --git a/cccli/commands/__init__.py b/cloudcontrol/cli/commands/__init__.py similarity index 100% rename from cccli/commands/__init__.py rename to cloudcontrol/cli/commands/__init__.py diff --git a/cccli/commands/account.py b/cloudcontrol/cli/commands/account.py similarity index 97% rename from cccli/commands/account.py rename to cloudcontrol/cli/commands/account.py index 72b4da6..1e16825 100644 --- a/cccli/commands/account.py +++ b/cloudcontrol/cli/commands/account.py @@ -19,10 +19,10 @@ CloudControl accounts related commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand class Command_addaccount(TqlCommand): '''Create an account''' diff --git a/cccli/commands/addforward.py b/cloudcontrol/cli/commands/addforward.py similarity index 95% rename from cccli/commands/addforward.py rename to cloudcontrol/cli/commands/addforward.py index 184ab73..9b7c57b 100644 --- a/cccli/commands/addforward.py +++ b/cloudcontrol/cli/commands/addforward.py @@ -19,9 +19,9 @@ CloudControl addforward command ''' -from cccli.command import TqlCommand -from cccli.tunnel import Forward -from cccli.exception import * +from cloudcontrol.cli.command import TqlCommand +from cloudcontrol.cli.tunnel import Forward +from cloudcontrol.cli.exception import * class Command_addforward(TqlCommand): '''Create a forward''' diff --git a/cccli/commands/alias.py b/cloudcontrol/cli/commands/alias.py similarity index 96% rename from cccli/commands/alias.py rename to cloudcontrol/cli/commands/alias.py index 0cf4ad2..41154ff 100644 --- a/cccli/commands/alias.py +++ b/cloudcontrol/cli/commands/alias.py @@ -19,8 +19,9 @@ CloudControl alias related command ''' -from cccli.exception import * -from cccli.command import OptionCommand +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.command import OptionCommand + import re class Command_alias(OptionCommand): diff --git a/cccli/commands/attachment.py b/cloudcontrol/cli/commands/attachment.py similarity index 94% rename from cccli/commands/attachment.py rename to cloudcontrol/cli/commands/attachment.py index 23db245..3eee51c 100644 --- a/cccli/commands/attachment.py +++ b/cloudcontrol/cli/commands/attachment.py @@ -22,8 +22,8 @@ CloudControl attachment command import os import subprocess -from cccli.exception import * -from cccli.command import TqlCommand +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.command import TqlCommand class Command_attachment(TqlCommand): '''Retrieve an attachment''' diff --git a/cccli/commands/cancel.py b/cloudcontrol/cli/commands/cancel.py similarity index 89% rename from cccli/commands/cancel.py rename to cloudcontrol/cli/commands/cancel.py index 2c40809..c271ca3 100644 --- a/cccli/commands/cancel.py +++ b/cloudcontrol/cli/commands/cancel.py @@ -19,10 +19,10 @@ CloudControl cancel command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_cancel(TqlCommand): '''Cancel a job''' diff --git a/cccli/commands/console.py b/cloudcontrol/cli/commands/console.py similarity index 96% rename from cccli/commands/console.py rename to cloudcontrol/cli/commands/console.py index b947260..926f179 100644 --- a/cccli/commands/console.py +++ b/cloudcontrol/cli/commands/console.py @@ -19,9 +19,9 @@ CloudControl Console related commands ''' -from cccli.command import TqlCommand -from cccli.exception import * -from cccli.printer import FakeTtySocket +from cloudcontrol.cli.command import TqlCommand +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import FakeTtySocket from sjrpc.core.exceptions import * import fcntl import signal diff --git a/cccli/commands/delforward.py b/cloudcontrol/cli/commands/delforward.py similarity index 94% rename from cccli/commands/delforward.py rename to cloudcontrol/cli/commands/delforward.py index 0db7cfe..66caee1 100644 --- a/cccli/commands/delforward.py +++ b/cloudcontrol/cli/commands/delforward.py @@ -19,8 +19,8 @@ CloudControl delforward command ''' -from cccli.command import Command -from cccli.exception import * +from cloudcontrol.cli.command import Command +from cloudcontrol.cli.exception import * class Command_delforward(Command): '''Delete forwarded connection''' diff --git a/cccli/commands/execute.py b/cloudcontrol/cli/commands/execute.py similarity index 92% rename from cccli/commands/execute.py rename to cloudcontrol/cli/commands/execute.py index 55ea6a9..f720613 100644 --- a/cccli/commands/execute.py +++ b/cloudcontrol/cli/commands/execute.py @@ -19,10 +19,10 @@ CloudControl execute command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_execute(TqlCommand): '''Execute a command on the remote host''' diff --git a/cccli/commands/expert.py b/cloudcontrol/cli/commands/expert.py similarity index 91% rename from cccli/commands/expert.py rename to cloudcontrol/cli/commands/expert.py index 4de7ff5..171e5ce 100644 --- a/cccli/commands/expert.py +++ b/cloudcontrol/cli/commands/expert.py @@ -18,9 +18,9 @@ ''' CloudControl expert command ''' -from cccli.exception import * -from cccli.printer import Printer, color -from cccli.command import Command +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Command from sjrpc.utils import ConnectionProxy import code diff --git a/cccli/commands/forwards.py b/cloudcontrol/cli/commands/forwards.py similarity index 93% rename from cccli/commands/forwards.py rename to cloudcontrol/cli/commands/forwards.py index c3846a8..8b9ffc1 100644 --- a/cccli/commands/forwards.py +++ b/cloudcontrol/cli/commands/forwards.py @@ -19,9 +19,9 @@ CloudControl forwards command ''' -from cccli.command import Command -from cccli.printer import color -from cccli.exception import * +from cloudcontrol.cli.command import Command +from cloudcontrol.cli.printer import color +from cloudcontrol.cli.exception import * class Command_forwards(Command): '''List open forwards''' diff --git a/cccli/commands/kill.py b/cloudcontrol/cli/commands/kill.py similarity index 89% rename from cccli/commands/kill.py rename to cloudcontrol/cli/commands/kill.py index 28ab7ab..307d0df 100644 --- a/cccli/commands/kill.py +++ b/cloudcontrol/cli/commands/kill.py @@ -19,10 +19,10 @@ CloudControl Connection related commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_kill(TqlCommand): '''Kill a server connection''' diff --git a/cccli/commands/list.py b/cloudcontrol/cli/commands/list.py similarity index 98% rename from cccli/commands/list.py rename to cloudcontrol/cli/commands/list.py index 4125ca9..4f5f587 100644 --- a/cccli/commands/list.py +++ b/cloudcontrol/cli/commands/list.py @@ -19,10 +19,10 @@ CloudControl list command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand import math import os diff --git a/cccli/commands/migrate.py b/cloudcontrol/cli/commands/migrate.py similarity index 96% rename from cccli/commands/migrate.py rename to cloudcontrol/cli/commands/migrate.py index fe87714..cd2e4c7 100644 --- a/cccli/commands/migrate.py +++ b/cloudcontrol/cli/commands/migrate.py @@ -19,10 +19,10 @@ CloudControl migrate command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_migrate(TqlCommand): '''Migrate vm''' diff --git a/cccli/commands/purge.py b/cloudcontrol/cli/commands/purge.py similarity index 89% rename from cccli/commands/purge.py rename to cloudcontrol/cli/commands/purge.py index d01c495..d37fc8b 100644 --- a/cccli/commands/purge.py +++ b/cloudcontrol/cli/commands/purge.py @@ -19,10 +19,10 @@ CloudControl cancel command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_purge(TqlCommand): '''Purge a job (delete it)''' diff --git a/cccli/commands/right.py b/cloudcontrol/cli/commands/right.py similarity index 96% rename from cccli/commands/right.py rename to cloudcontrol/cli/commands/right.py index 1be1654..b0e5f1e 100644 --- a/cccli/commands/right.py +++ b/cloudcontrol/cli/commands/right.py @@ -25,10 +25,10 @@ import os import re import pprint -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import Command, RemoteCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Command, RemoteCommand class Command_rights(RemoteCommand): '''List account rights''' diff --git a/cccli/commands/server.py b/cloudcontrol/cli/commands/server.py similarity index 94% rename from cccli/commands/server.py rename to cloudcontrol/cli/commands/server.py index 62016d8..866d844 100644 --- a/cccli/commands/server.py +++ b/cloudcontrol/cli/commands/server.py @@ -18,10 +18,10 @@ ''' CloudControl server command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import RemoteCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import RemoteCommand class Command_server(RemoteCommand): '''Server manipulation command''' diff --git a/cccli/commands/shell.py b/cloudcontrol/cli/commands/shell.py similarity index 92% rename from cccli/commands/shell.py rename to cloudcontrol/cli/commands/shell.py index 1e8424f..c5e9501 100644 --- a/cccli/commands/shell.py +++ b/cloudcontrol/cli/commands/shell.py @@ -19,9 +19,9 @@ CloudControl shells related commands ''' -from cccli.exception import * -from cccli.printer import Printer, color -from cccli.command import Command +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Command class Command_quit(Command): '''Quit application with respect''' @@ -36,8 +36,8 @@ class Command_version(Command): def __call__(self, argv): if len(argv) != 1: raise cmdBadArgument() - import cccli - self.printer.out(cccli.version) + import cloudcontrol.cli + self.printer.out(cloudcontrol.cli.version) class Command_debug(Command): @@ -45,8 +45,8 @@ class Command_debug(Command): def __call__(self, argv): if len(argv) != 1: raise cmdBadArgument() - import cccli - cccli.debug = not cccli.debug + import cloudcontrol.cli + cloudcontrol.cli.debug = not cloudcontrol.cli.debug class Command_whoami(Command): diff --git a/cccli/commands/shutdown.py b/cloudcontrol/cli/commands/shutdown.py similarity index 92% rename from cccli/commands/shutdown.py rename to cloudcontrol/cli/commands/shutdown.py index e408a97..a5c18f4 100644 --- a/cccli/commands/shutdown.py +++ b/cloudcontrol/cli/commands/shutdown.py @@ -19,10 +19,10 @@ CloudControl physical host related commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_shutdown(TqlCommand): '''Shutdown a physical host''' diff --git a/cccli/commands/tag.py b/cloudcontrol/cli/commands/tag.py similarity index 95% rename from cccli/commands/tag.py rename to cloudcontrol/cli/commands/tag.py index ac89325..2da3e1a 100644 --- a/cccli/commands/tag.py +++ b/cloudcontrol/cli/commands/tag.py @@ -19,10 +19,10 @@ CloudControl tag releated commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand from optparse import OptionParser diff --git a/cccli/commands/tagdisplay.py b/cloudcontrol/cli/commands/tagdisplay.py similarity index 97% rename from cccli/commands/tagdisplay.py rename to cloudcontrol/cli/commands/tagdisplay.py index 2a9d731..81d5810 100644 --- a/cccli/commands/tagdisplay.py +++ b/cloudcontrol/cli/commands/tagdisplay.py @@ -18,10 +18,10 @@ ''' CloudControl tagdisplay command ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import OptionCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import OptionCommand class Command_tagdisplay(OptionCommand): '''Tagdisplay tool''' diff --git a/cccli/commands/time.py b/cloudcontrol/cli/commands/time.py similarity index 92% rename from cccli/commands/time.py rename to cloudcontrol/cli/commands/time.py index 935e894..109106e 100644 --- a/cccli/commands/time.py +++ b/cloudcontrol/cli/commands/time.py @@ -22,10 +22,10 @@ CloudControl time command import time as systime import datetime -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import Command +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import Command class Command_time(Command): diff --git a/cccli/commands/vm.py b/cloudcontrol/cli/commands/vm.py similarity index 98% rename from cccli/commands/vm.py rename to cloudcontrol/cli/commands/vm.py index 0048be6..9ffed64 100644 --- a/cccli/commands/vm.py +++ b/cloudcontrol/cli/commands/vm.py @@ -19,10 +19,10 @@ CloudControl VM related commands ''' -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import TqlCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import TqlCommand class Command_start(TqlCommand): '''Start a stopped vm''' diff --git a/cccli/commands/vnc.py b/cloudcontrol/cli/commands/vnc.py similarity index 96% rename from cccli/commands/vnc.py rename to cloudcontrol/cli/commands/vnc.py index eb779c1..9ec7c5d 100644 --- a/cccli/commands/vnc.py +++ b/cloudcontrol/cli/commands/vnc.py @@ -19,9 +19,9 @@ CloudControl vnc command ''' -from cccli.command import TqlCommand -from cccli.exception import * -from cccli.tunnel import Forward +from cloudcontrol.cli.command import TqlCommand +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.tunnel import Forward import os import subprocess import threading diff --git a/cccli/commands/watch.py b/cloudcontrol/cli/commands/watch.py similarity index 94% rename from cccli/commands/watch.py rename to cloudcontrol/cli/commands/watch.py index 7b66845..2173771 100644 --- a/cccli/commands/watch.py +++ b/cloudcontrol/cli/commands/watch.py @@ -22,10 +22,10 @@ CloudControl watch command import sys import time -from cccli.exception import * +from cloudcontrol.cli.exception import * from sjrpc.core.exceptions import * -from cccli.printer import Printer, color -from cccli.command import OptionCommand +from cloudcontrol.cli.printer import Printer, color +from cloudcontrol.cli.command import OptionCommand from cStringIO import StringIO class Command_watch(OptionCommand): diff --git a/cccli/exception.py b/cloudcontrol/cli/exception.py similarity index 100% rename from cccli/exception.py rename to cloudcontrol/cli/exception.py diff --git a/cccli/handler.py b/cloudcontrol/cli/handler.py similarity index 93% rename from cccli/handler.py rename to cloudcontrol/cli/handler.py index 4df2316..a94113b 100644 --- a/cccli/handler.py +++ b/cloudcontrol/cli/handler.py @@ -19,10 +19,11 @@ CloudControl CLI RPC Handler ''' -from cccli.exception import * -from cccli.printer import Printer, color +from cloudcontrol.cli import version +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color from sjrpc.utils import RpcHandler -import cccli + import os, os.path import subprocess import platform @@ -50,7 +51,7 @@ class CliHandler(RpcHandler): def _get_tag_version(self): '''Return tag version''' - return cccli.version + return version def _get_tag_os(self): '''Return Operating system tag''' diff --git a/cccli/printer.py b/cloudcontrol/cli/printer.py similarity index 99% rename from cccli/printer.py rename to cloudcontrol/cli/printer.py index b767337..34a60b4 100644 --- a/cccli/printer.py +++ b/cloudcontrol/cli/printer.py @@ -19,8 +19,8 @@ CloudControl CLI Printer module ''' -import cccli -from cccli.exception import * +import cloudcontrol.cli as cli +from cloudcontrol.cli.exception import * import fcntl import os @@ -123,7 +123,7 @@ class Printer(object): @staticmethod def debug(message, fd=None, nl=os.linesep): - if cccli.debug: + if cli.debug: Printer.err("%s%s%s"%(color["lgrey"],message,color["reset"]), fd, nl) def isinteractive(self): diff --git a/cccli/tagdisplay.py b/cloudcontrol/cli/tagdisplay.py similarity index 98% rename from cccli/tagdisplay.py rename to cloudcontrol/cli/tagdisplay.py index 1299a97..7ada5d1 100644 --- a/cccli/tagdisplay.py +++ b/cloudcontrol/cli/tagdisplay.py @@ -19,8 +19,9 @@ CloudControl Tag displaying stuff ''' -from cccli.exception import * -from cccli.printer import Printer, color +from cloudcontrol.cli.exception import * +from cloudcontrol.cli.printer import Printer, color + import os import re import math diff --git a/cccli/tunnel.py b/cloudcontrol/cli/tunnel.py similarity index 98% rename from cccli/tunnel.py rename to cloudcontrol/cli/tunnel.py index 784870f..7cadd77 100644 --- a/cccli/tunnel.py +++ b/cloudcontrol/cli/tunnel.py @@ -23,7 +23,8 @@ import os import select import socket import threading -from cccli.printer import Printer + +from cloudcontrol.cli.printer import Printer from sjrpc.core import RpcError diff --git a/setup.py b/setup.py index 6da7f80..80f9f55 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with CloudControl. If not, see <http://www.gnu.org/licenses/>. -from setuptools import setup +from setuptools import setup, find_packages import cccli import os @@ -30,7 +30,8 @@ setup( author='Sébastien Luttringer', author_email='sebastien.luttringer@smartjog.com', license='GPL2', - packages=['cccli', 'cccli.commands'], + packages=find_packages(), + namespace_packages=['cloudcontrol'], scripts=['bin/cc-cli'], classifiers=[ 'Operating System :: Unix', -- GitLab