Skip to content

Commit

Permalink
Second warning is covered anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bouchare committed Oct 28, 2019
1 parent ec6504f commit ded4cee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions datadog/util/hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ def get_hostname(hostname_from_config):
config = None

# first, try the config if hostname_from_config is set to True
if hostname_from_config:
try:
try:
if hostname_from_config:
config = get_config()
config_hostname = config.get('hostname')
if config_hostname and is_valid_hostname(config_hostname):
log.warning("Hostname lookup from agent configuration will be deprecated "
"in an upcoming version of datadogpy. Set hostname_from_config to False "
"to get rid of this warning")
return config_hostname
except CfgNotFound:
log.warning("No agent or invalid configuration file found")
except CfgNotFound:
log.warning("No agent or invalid configuration file found")

# Try to get GCE instance name
if hostname is None:
Expand Down

0 comments on commit ded4cee

Please sign in to comment.