Skip to content

Commit

Permalink
set parameter type on $hostnameitem
Browse files Browse the repository at this point in the history
add test to fail if hostinterfaceitem is set to fqdn
  • Loading branch information
Braxton Schafer committed Mar 23, 2021
1 parent d7d1425 commit 7d9e083
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
Stdlib::Ensure::Service $service_ensure = $zabbix::params::agent_service_ensure,
Boolean $service_enable = $zabbix::params::agent_service_enable,
$hostname = $zabbix::params::agent_hostname,
$hostnameitem = $zabbix::params::agent_hostnameitem,
Optional[String[1]] $hostnameitem = $zabbix::params::agent_hostnameitem,
$hostmetadata = $zabbix::params::agent_hostmetadata,
$hostmetadataitem = $zabbix::params::agent_hostmetadataitem,
Optional[Stdlib::Fqdn] $hostinterface = $zabbix::params::agent_hostinterface,
Expand Down
10 changes: 10 additions & 0 deletions spec/classes/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@
it { is_expected.to contain_file(config_path).with_content %r{^HostInterfaceItem=system.hostname$} }
end

context 'configuration file with hostinterfaceitem set to fqdn' do
let :params do
{
hostinterfaceitem: 'zabbix.example.com'
}
end

it { is_expected.to compile.and_raise_error(%r{.*}) }
end

context 'configuration file with hostinterface' do
let :params do
{
Expand Down

0 comments on commit 7d9e083

Please sign in to comment.