Emit an error message if the host doesn't exist in azure

This commit is contained in:
Matthew Jones
2015-01-19 12:04:58 -05:00
parent a7e6d62e2c
commit a8c7b0dc41

View File

@@ -117,6 +117,8 @@ class AzureInventory(object):
"""Return information about the given hostname, based on what """Return information about the given hostname, based on what
the Windows Azure API provides. the Windows Azure API provides.
""" """
if hostname not in self.host_metadata:
return "No host found: %s" % hostname
if jsonify: if jsonify:
return json.dumps(self.host_metadata[hostname]) return json.dumps(self.host_metadata[hostname])
return self.host_metadata[hostname] return self.host_metadata[hostname]