Skip to content

Commit 3f67a5f

Browse files
committed
[agent6] fix hostname override tag support
1 parent f20bec0 commit 3f67a5f

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

manifests/init.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@
566566
$_agent_config = {
567567
'api_key' => $api_key,
568568
'dd_url' => $dd_url,
569+
'hostname' => $host,
569570
'cmd_port' => 5001,
570571
'conf_path' => $datadog_agent::params::conf6_dir,
571572
'enable_metadata_collection' => $collect_instance_metadata,

spec/classes/datadog_agent_spec.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,18 @@
922922
end
923923
end
924924

925-
context 'with apm_extra_config' do
925+
context 'with modified defaults' do
926+
context 'hostname override' do
927+
let(:params) {{
928+
:host => 'my_custom_hostname',
929+
}}
930+
it { should contain_file('/etc/datadog-agent/datadog.yaml').with(
931+
'content' => /^hostname: my_custom_hostname\n/,
932+
)}
933+
end
934+
end
935+
936+
context 'with additional agents config' do
926937
context 'with extra_options and APM enabled' do
927938
let(:params) {{
928939
:apm_enabled => true,

0 commit comments

Comments
 (0)