Commit 30c8870d authored by Sébastien Luttringer's avatar Sébastien Luttringer
Browse files

Implement cloudcontrol namespaces

parent 5f5b1c0b
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -29,10 +29,10 @@ import re
import warnings
import warnings
from xdg import BaseDirectory
from xdg import BaseDirectory


import cccli
import cloudcontrol.cli as cccli
from cccli.cli import Cli
from cloudcontrol.cli.cli import Cli
from cccli.printer import Printer
from cloudcontrol.cli.printer import Printer
from cccli.exception import *
from cloudcontrol.cli.exception import *


settings = {
settings = {
    "port": "1984",
    "port": "1984",
+17 −0
Original line number Original line Diff line number Diff line
# 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__)
+0 −0

File moved.

+7 −7
Original line number Original line Diff line number Diff line
@@ -19,12 +19,12 @@
CloudControl CLI main module
CloudControl CLI main module
'''
'''


import cccli
from cloudcontrol.cli import debug
from cccli.exception import *
from cloudcontrol.cli.exception import *
from cccli.printer import Printer, color
from cloudcontrol.cli.printer import Printer, color
from cccli.command import Commands, Aliases
from cloudcontrol.cli.command import Commands, Aliases
from cccli.handler import CliHandler
from cloudcontrol.cli.handler import CliHandler
from cccli.tagdisplay import TagDisplay
from cloudcontrol.cli.tagdisplay import TagDisplay
from sjrpc.core import RpcConnection
from sjrpc.core import RpcConnection
from sjrpc.utils import RpcHandler
from sjrpc.utils import RpcHandler
import threading
import threading
@@ -188,7 +188,7 @@ class Cli(object):
        except EOFError:
        except EOFError:
            self.printer.out("")
            self.printer.out("")
        except Exception as e:
        except Exception as e:
            if cccli.debug: raise
            if debug: raise
            self.printer.error("%s: %s"%(type(e), str(e)))
            self.printer.error("%s: %s"%(type(e), str(e)))
            self.printer.warn("This is a not expected error, please report it!")
            self.printer.warn("This is a not expected error, please report it!")


+5 −5
Original line number Original line Diff line number Diff line
@@ -26,11 +26,11 @@ import shlex
import imp
import imp
import sys
import sys


from cccli.exception import *
from cloudcontrol.cli.exception import *
from sjrpc.core import RpcError
from cloudcontrol.cli.printer import Printer, color
from cccli.printer import Printer, color
from optparse import OptionParser
from optparse import OptionParser
import cccli.commands
from sjrpc.core import RpcError
import cloudcontrol.cli.commands as commands


class Commands(object):
class Commands(object):
    '''Command manager'''
    '''Command manager'''
@@ -39,7 +39,7 @@ class Commands(object):
        # save cli context
        # save cli context
        self.cli = cli
        self.cli = cli
        # build command list
        # 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
        # build remote function list
        try:
        try:
            self.functions = set([ c["name"]  for c in self.cli.rpc.call("functions") ])
            self.functions = set([ c["name"]  for c in self.cli.rpc.call("functions") ])
Loading