Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #42 from transacid/master
Browse files Browse the repository at this point in the history
Throw an exception when alppaca is not reachable
  • Loading branch information
programmieramt committed Aug 9, 2017
2 parents 498110a + d61ad95 commit e06fca7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/python/afp_alppaca/main.py
Expand Up @@ -106,14 +106,15 @@ def launch_scheduler(self):
def status(self):
succubus_status = super(AlppacaDaemon, self).status()
if succubus_status != 0:
print("succubus_status is {0}".format(str(succubus_status)))
return succubus_status

conn = HTTPConnection('169.254.169.254', timeout=0.1)
try:
conn.request("GET", "/")
conn.getresponse()
except Exception:
print("Error: alppaca is not reachable via IP 169.254.169.254.")
except Exception as e:
print("Error: alppaca is not reachable via IP 169.254.169.254. {0}".format(e))
return 3
else:
return 0

0 comments on commit e06fca7

Please sign in to comment.