Commit 79b52e25 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Rename plugin to client.

parent 3f42100d
from .cli import cli_generator
from .client import Kamaki_plugin
from .cli import kamaki_cli
from .client import kamaki_client
......@@ -5,18 +5,18 @@ from kamaki.cli import command
from kamaki.cli.command_tree import CommandTree
from kamaki.cli.errors import CLIError
class cli_generator(object):
class kamaki_cli(object):
api_spec = None
appname = None
plugin = None
client = None
add_context = False
ctree = None
description = None
def __init__(self):
self.api_spec = self.plugin.api_spec
self.appname = self.plugin.appname
self.api_spec = self.client.api_spec
self.appname = self.client.appname
self.ctree = CommandTree(self.appname, self.description)
def generate_all(self):
......@@ -34,7 +34,7 @@ class cli_generator(object):
this.config.get('global', 'token'))
this.base_url = (this.config.get(self.appname, 'url') or
this.config.get('global', 'url'))
this.client = self.plugin(this.base_url, this.token)
this.client = self.client(this.base_url, this.token)
def call(this, method, args):
ctx = '=null ' if self.add_context else ''
......@@ -6,10 +6,10 @@ from kamaki.clients import Client
from json import loads as json_loads, dumps as json_dumps
class Kamaki_plugin(Callpoint):
class kamaki_client(Callpoint):
def __init__(self, base_url, token):
super(Kamaki_plugin, self).__init__()
super(kamaki_client, self).__init__()
self._kc = Client(base_url, token)
def do_make_call(self, api_call, data):
from .client import quotaholder_plugin
from .client import quotaholder_client
from .cli import quotaholder_cli
#!/usr/bin/env python
from commissioning.lib.kamaki import cli_generator
from . import quotaholder_plugin
from commissioning.lib.kamaki import kamaki_cli
from . import quotaholder_client
class quotaholder_cli(cli_generator):
class quotaholder_cli(kamaki_cli):
def __init__(self):
self.plugin = quotaholder_plugin
self.client = quotaholder_client
self.add_context = True
self.description = 'Quotaholder description'
super(self.__class__, self).__init__()
#!/usr/bin/env python
from quotaholder.api import QuotaholderAPI
from commissioning.lib.kamaki import Kamaki_plugin
from commissioning.lib.kamaki import kamaki_client
class quotaholder_plugin(Kamaki_plugin):
class quotaholder_client(kamaki_client):
api_spec = QuotaholderAPI()
appname = 'quotaholder'
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