2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-21 09:02:07 +00:00

Remove kwargs to provide forward compatibility, it doesn't seem to be workable in python

This commit is contained in:
Jarrod Johnson 2013-09-09 15:42:00 -04:00
parent 91c0f01b61
commit 996e19752b
2 changed files with 14 additions and 16 deletions

18
API.txt
View File

@ -1,22 +1,20 @@
Each layer has API implications.
For now, I'll start with plugin api.
The practice is for plugin entry points to have a **kwargs argument to allow
future optional arguments.
Arguments are always passed in keyword style
plugins should implement:
create(nodes, element, configmanager, **kwargs)
retrieve(nodes, element, configmanager, **kwargs)
update(nodes, element, configmanager, **kwargs)
delete(nodes, element, configmanager, **kwargs)
create(nodes, element, configmanager)
retrieve(nodes, element, configmanager)
update(nodes, element, configmanager)
delete(nodes, element, configmanager)
For the element '_console/session', the return should be an object
implementing:
open(callback, **kwargs)
read(**kwargs)
write(data, **kwargs)
close(**kwargs)
connect(callback)
read()
write(data)
close()
For all other elements for now, the caller should get an iterable.
This means a plugin may elect to return a tuple, list,

View File

@ -43,14 +43,14 @@ def get_conn_params(node, config):
class Console(object):
def __init__(node, config, **kwargs):
def __init__(node, config):
crypt = config.decrypt
config.decrypt = True
configdata = config.get_node_attributes([node],
['secret.ipmiuser', 'secret.ipmipassphrase',
'secret.managementuser', 'secret.managementpassphrase',
'hardwaremanagement.manager'])
connparams = get_conn_params(node, configdata)
connparams = get_conn_params(node, configdata[node])
self.username = connparams['username']
self.password = connparams['passphrase']
self.kg = connparams['kg']
@ -58,7 +58,7 @@ class Console(object):
self.port = connparams['port']
# Cannot actually create console until 'connect', when we get callback
def connect(callback, **kwargs):
def connect(self,callback):
self.solconnection = console.Console(bmc=self.bmc,
port=self.port,
username=self.username,
@ -68,11 +68,11 @@ class Console(object):
if _loopthread is None:
_loopthread = eventlet.spawn(_ipmi_evtloop)
def write(self, data, **kwargs):
def write(self, data):
self.solconnection.send_data(data)
def create(nodes, element, configmanager, **kwargs):
def create(nodes, element, configmanager):
if element == '_console/session':
if len(nodes) > 1:
raise Exception("_console/session does not support multiple nodes")
@ -82,5 +82,5 @@ def create(nodes, element, configmanager, **kwargs):
"TODO(jbjohnso): ipmi api implementation of %s" % element)
def retrieve(nodes, element, configmanager, **kwargs):
def retrieve(nodes, element, configmanager):
raise Exception("TODO(jbjohnso): ipmi get implementation of %s" % element)