Skip to content

Commit

Permalink
Pass argument directly to get_hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bouchare committed Aug 20, 2019
1 parent 408bff9 commit c8a2b18
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
3 changes: 0 additions & 3 deletions datadog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ def initialize(api_key=None, app_key=None, host_name=None, api_host=None,
:param api_host: Datadog API endpoint
:type api_host: url
:param config_lookup: Hostname resolution using the Datadog agent configuration file
:type config_lookup: boolean
:param statsd_host: Host of DogStatsd server or statsd daemon
:type statsd_host: address
Expand Down
3 changes: 0 additions & 3 deletions datadog/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
_backoff_period = 300
_mute = True

# Agent config settings
config_lookup = True

# Resources
from datadog.api.comments import Comment
from datadog.api.dashboard_lists import DashboardList
Expand Down
4 changes: 2 additions & 2 deletions datadog/util/hostname.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def is_valid_hostname(hostname):
return True


def get_hostname():
def get_hostname(from_config=True):
"""
Get the canonical host name this agent should identify as. This is
the authoritative source of the host name for the agent.
Expand All @@ -53,7 +53,7 @@ def get_hostname():

# first, try the config
try:
if config_lookup:
if from_config:
config = get_config()
config_hostname = config.get('hostname')
if config_hostname and is_valid_hostname(config_hostname):
Expand Down

0 comments on commit c8a2b18

Please sign in to comment.