Skip to content

Commit

Permalink
Merge pull request #7 from DevOps/add_logging
Browse files Browse the repository at this point in the history
Add logging
  • Loading branch information
Marc Abramowitz committed Sep 29, 2014
2 parents d8b5426 + 8b3f055 commit 2a77862
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bambino/appenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def _hostname():

@staticmethod
def _site(hostname):
log.info("bambino.appenv.Node._site: hostname = %r", hostname)
sites = {'mktest3-py': 'mt3', 'mktest2-py': 'mt2'}
if(hostname in sites):
return sites[hostname]
Expand All @@ -109,11 +110,13 @@ def _site(hostname):

@staticmethod
def get_machine_info():
return {
ret = {
'ip': Node._ip(),
'name': Node._hostname(),
'site': Node._site(Node._hostname())
}
log.info("bambino.appenv.Node.get_machine_info: ret = %r", ret)
return ret


class WebAppDir(pathd):
Expand Down
4 changes: 4 additions & 0 deletions bambino/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def register_this_bambino():
"""
try:
payload = {'node': json.dumps(node), 'action': 'register'}
log.info(
"bambino.registration.register_this_bambino: "
"Posting to %s with payload: %r",
registration_url, payload)
requests.post(registration_url, data=payload)
except requests.exceptions.ConnectionError as e:
log.error(e.message)
Expand Down

0 comments on commit 2a77862

Please sign in to comment.