Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
14 changes: 10 additions & 4 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,22 @@
value => $trusted_node_data,
}

if $environment != undef

Choose a reason for hiding this comment

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

for clarity, it would be nice to use if $environment == undef instead of if $environment != undef.
the != syntax is like a double-negative.

wrt undef semantics, @stephenrjohnson should clarify in README what undef should mean within context of configs. see thread at #63

Copy link
Author

Choose a reason for hiding this comment

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

I agree. I was just following conventions used elsewhere in the manifest.

{
$environment_ensure = 'present'
} else {
$environment_ensure = 'absent'
}
ini_setting {'puppetagentenvironment':
ensure => present,
ensure => $environment_ensure,
setting => 'environment',
value => $environment,
}

ini_setting {'puppetagentmaster':
ensure => present,
setting => 'server',
value => $puppet_server,
ensure => present,
setting => 'server',
value => $puppet_server,
}

ini_setting {'puppetagentuse_srv_records':
Expand Down
20 changes: 20 additions & 0 deletions spec/classes/puppet_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -574,5 +574,25 @@
)
}
end
context 'with environment set to undef' do
let(:params) do
{
:environment => 'undef',
}
end

it {
should contain_ini_setting('puppetagentenvironment').with(
:ensure => 'present',
:section => 'agent',
:path => '/etc/puppet/puppet.conf'
)
}
it {
should contain_ini_setting('puppetagentenvironment').without(
:environment => 'production'
)
}
end
end
end