move 0.9 binding to a versioned module

This commit is contained in:
vicenteg 2013-11-19 23:05:34 -05:00
parent e7f53adb98
commit 0f1e405277
3 changed files with 7 additions and 6 deletions

View File

@ -1,3 +1,3 @@
from seamicro_api import SeaMicroAPI, SeaMicroAPIError from seamicro_api_v0_9 import SeaMicroAPI_v0_9, SeaMicroAPIError
__version__ = "0.9" __version__ = "0.9"

View File

@ -11,13 +11,13 @@ class SeaMicroAPIError(Exception):
def __str__(self): def __str__(self):
return repr(self.value) return repr(self.value)
LOGGER = logging.getLogger('SeaMicroAPI') LOGGER = logging.getLogger(__name__)
LOGGER.addHandler(logging.StreamHandler()) LOGGER.addHandler(logging.StreamHandler())
LOGGER.setLevel(logging.INFO) LOGGER.setLevel(logging.INFO)
SERVER_POWER_STATES = Enum('on', 'off', 'reset') SERVER_POWER_STATES = Enum('on', 'off', 'reset')
class SeaMicroAPI: class SeaMicroAPI_v0_9:
RESPONSE_CODES = { RESPONSE_CODES = {
200: 'OK', 200: 'OK',
202: 'Accepted', 202: 'Accepted',

View File

@ -3,7 +3,8 @@ import sys
import pprint import pprint
import time import time
import requests import requests
from seamicro_api import SeaMicroAPI, SeaMicroAPIError from seamicro_api import SeaMicroAPI_v0_9 as SeaMicroAPI
from seamicro_api import SeaMicroAPIError
SERVER_TO_POWER_TEST = "3/0" SERVER_TO_POWER_TEST = "3/0"
CHASSIS_HOSTNAME = "192.168.142.10" CHASSIS_HOSTNAME = "192.168.142.10"
@ -31,7 +32,7 @@ class TestCardsAll(SeaMicroAPITestCase):
self.do_good_login() self.do_good_login()
cards_all = self.api.cards_all() cards_all = self.api.cards_all()
pprint.pprint(cards_all, stream=sys.stderr) #pprint.pprint(cards_all, stream=sys.stderr)
class TestServersAll(SeaMicroAPITestCase): class TestServersAll(SeaMicroAPITestCase):
@ -42,7 +43,7 @@ class TestServersAll(SeaMicroAPITestCase):
def func(x,y): def func(x,y):
return int(x['serverId'].split('/')[0]) - int(y['serverId'].split('/')[0]) return int(x['serverId'].split('/')[0]) - int(y['serverId'].split('/')[0])
pprint.pprint([(s['serverId'], s['serverMacAddr']) for s in sorted(servers.values(), cmp=func) if s['serverNIC'] == '0'], stream=sys.stderr) #pprint.pprint([(s['serverId'], s['serverMacAddr']) for s in sorted(servers.values(), cmp=func) if s['serverNIC'] == '0'], stream=sys.stderr)
class TestSeaMicroAPIAuthentication(SeaMicroAPITestCase): class TestSeaMicroAPIAuthentication(SeaMicroAPITestCase):