Skip to content

Commit

Permalink
Pass return code through when registration fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Varga committed Aug 6, 2015
1 parent b455e74 commit 784f754
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions redhat_access_insights/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _test_urls(self, url, method):
if last_ex:
raise last_ex

def test_connection(self):
def test_connection(self, rc=0):
"""
Test connection to Red Hat
"""
Expand All @@ -236,7 +236,7 @@ def test_connection(self):
logger.error('Additional information may be in'
' /var/log/' + APP_NAME + "/" + APP_NAME + ".log")
sys.exit(1)
sys.exit()
sys.exit(rc)

def handle_fail_rcs(self, req):
"""
Expand Down Expand Up @@ -323,14 +323,14 @@ def create_system(self, options, new_machine_id=False):
logger.error("ERROR: Could not determine branch information, exiting!")
logger.error("See %s for more information", constants.default_log_file)
logger.error("Could not register system, running configuration test")
self.test_connection()
self.test_connection(1)

except requests.ConnectionError as e:
logger.debug(e)
logger.error("ERROR: Could not determine branch information, exiting!")
logger.error("See %s for more information", constants.default_log_file)
logger.error("Could not register system, running configuration test")
self.test_connection()
self.test_connection(1)

data = {'machine_id': machine_id,
'remote_branch': remote_branch,
Expand All @@ -352,7 +352,7 @@ def create_system(self, options, new_machine_id=False):
except requests.ConnectionError as e:
logger.debug(e)
logger.error("Could not register system, running configuration test")
self.test_connection()
self.test_connection(1)
return system

def do_group(self, group_id):
Expand Down

0 comments on commit 784f754

Please sign in to comment.