-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from themaxbelov/refactor-work-with-oa
Refactor OA and package operations
- Loading branch information
Showing
9 changed files
with
1,027 additions
and
714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.8.0 | ||
1.8.1 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.