Skip to content

Commit

Permalink
Merge pull request #53 from themaxbelov/init-hub-fix
Browse files Browse the repository at this point in the history
Fix for init-hub command
  • Loading branch information
ToxicWar committed Apr 2, 2018
2 parents 437a664 + 4bddf28 commit d2d09a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.1
1.8.2
12 changes: 8 additions & 4 deletions apsconnectcli/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def configure(hub_host, user='admin', pwd='1q2w3e', use_tls=False, port=8440, ap
print("Connectivity with Hub RPC API [ok]")
Hub._assert_supported_version(hub_version)
print("Hub version {}".format(hub_version))
aps = APS(Hub._get_user_token(hub, 1))
aps_url = '{}://{}:{}'.format('https' if use_tls_aps else 'http', aps_host, aps_port)
aps = APS(Hub._get_user_token(hub, 1), aps_url)
response = aps.get('aps/2/applications/')
response.raise_for_status()
print("Connectivity with Hub APS API [ok]")
Expand Down Expand Up @@ -362,9 +363,12 @@ class APS(object):
url = None
token = None

def __init__(self, token):
config = get_config()
self.url = APS._get_aps_url(**{k: config[k] for k in APS_CONNECT_PARAMS})
def __init__(self, token, url=None):
if url:
self.url = url
else:
config = get_config()
self.url = APS._get_aps_url(**{k: config[k] for k in APS_CONNECT_PARAMS})
self.token = token

@staticmethod
Expand Down

0 comments on commit d2d09a6

Please sign in to comment.