Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@
$local_integrations = $integrations
}

$_puppetversion = lookup({ 'name' => '::puppetversion', 'default_value' => 'unknown'})

include datadog_agent::params
case upcase($log_level) {
'CRITICAL': { $_loglevel = 'CRITICAL' }
Expand Down Expand Up @@ -558,6 +560,15 @@
order => '08',
}
}

file {'/etc/dd-agent/install_info':
owner => $dd_user,
group => $dd_group,
mode => '0640',
content => template('datadog_agent/install_info.erb'),
require => File['/etc/dd-agent'],
}

} else { #Agent 6/7

# notify of broken params on agent6/7
Expand Down Expand Up @@ -714,6 +725,14 @@
require => File['C:/ProgramData/Datadog'],
}

file { 'C:/ProgramData/Datadog/install_info':
owner => $dd_user,
group => $dd_group,
mode => '0660',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why different permissions? (640 or 660)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what the reason is for it but datadog.yaml has those permissions on Windows, so I guessed install_info should have the same. Should I change them on datadog.yaml too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it is used to give the administrator group access to the file (see #571)

content => template('datadog_agent/install_info.erb'),
require => File['C:/ProgramData/Datadog'],
}

} else {

file { '/etc/datadog-agent/datadog.yaml':
Expand All @@ -725,6 +744,14 @@
require => File['/etc/datadog-agent'],
}

file { '/etc/datadog-agent/install_info':
owner => $dd_user,
group => $dd_group,
mode => '0640',
content => template('datadog_agent/install_info.erb'),
require => File['/etc/datadog-agent'],
}

}

}
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$apt_backup_keyserver = 'hkp://pool.sks-keyservers.net:80'
$apt_keyserver = 'hkp://keyserver.ubuntu.com:80'
$sysprobe_service_name = 'datadog-agent-sysprobe'
$module_metadata = load_module_metadata($module_name)

case $::operatingsystem {
'Ubuntu','Debian' : {
Expand Down
20 changes: 20 additions & 0 deletions spec/classes/datadog_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1592,17 +1592,37 @@

config_dir = WINDOWS_OS.include?(operatingsystem) ? 'C:/ProgramData/Datadog' : '/etc/datadog-agent'
config_yaml_file = config_dir + '/datadog.yaml'
install_info_file = config_dir + '/install_info'
Comment thread
mx-psi marked this conversation as resolved.
Outdated
log_file = WINDOWS_OS.include?(operatingsystem) ? 'C:/ProgramData/Datadog/logs/agent.log' : '\/var\/log\/datadog\/agent.log'

it { is_expected.to contain_file(config_dir) }
it { is_expected.to contain_file(config_yaml_file) }
it { is_expected.to contain_file(install_info_file) }
it { is_expected.to contain_file(config_dir + '/conf.d').with_ensure('directory') }

# Agent 5 files
it { is_expected.not_to contain_file('/etc/dd-agent') }
it { is_expected.not_to contain_concat('/etc/dd-agent/datadog.conf') }
it { is_expected.not_to contain_file('/etc/dd-agent/conf.d').with_ensure('directory') }

describe 'install_info check' do
it {
is_expected.to contain_file(install_info_file).with(
Comment thread
mx-psi marked this conversation as resolved.
Outdated
'content' => %r{^\ \ tool:\s*puppet\n},
)
}
it {
is_expected.to contain_file(install_info_file).with(
'content' => %r{^\ \ tool_version:\s*puppet-(\d\.\d\.\d|unknown)\n},
)
}
it {
is_expected.to contain_file(install_info_file).with(
'content' => %r{^\ \ installer_version:\s*datadog_module-\d\.\d\.\d\n},
)
}
end

describe 'agent6 parameter check' do
context 'with defaults' do
context 'for basic beta settings' do
Expand Down
5 changes: 5 additions & 0 deletions templates/install_info.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
install_method:
tool: puppet
tool_version: puppet-<%= @_puppetversion %>
installer_version: datadog_module-<%= @module_metadata['version'] %>