Skip to content

Commit

Permalink
Merge pull request #52 from themaxbelov/refactor-work-with-oa
Browse files Browse the repository at this point in the history
Refactor OA and package operations
  • Loading branch information
ToxicWar committed Mar 27, 2018
2 parents a2ec9ee + 981dff3 commit 437a664
Show file tree
Hide file tree
Showing 9 changed files with 1,027 additions and 714 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.0
1.8.1
527 changes: 36 additions & 491 deletions apsconnectcli/apsconnect.py

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions apsconnectcli/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from __future__ import print_function

import json
import os
import sys

CFG_FILE_PATH = os.path.expanduser('~/.apsconnect/.aps_config')
NULL_CFG_INFO = (None, None)


def get_config():
try:
with open(CFG_FILE_PATH) as f:
cfg = json.load(f)
except IOError as e:
if e.errno == 2:
print("Could not find connected hub data. "
"Please run the init-hub command to connect Odin Automation hub.")
else:
print("Could not open configuration file:\n{}".format(e))
sys.exit(1)
except ValueError:
print("Could not parse the configuration file, please re-run "
"the init-hub command to regenerate the configuration.")
sys.exit(1)
except Exception as e:
print("Failed to read connected hub configuration. Error message:\n{}".format(e))
sys.exit(1)
else:
return cfg
Loading

0 comments on commit 437a664

Please sign in to comment.