Skip to content

Commit 7d9e083

Browse files
author
Braxton Schafer
committed
set parameter type on $hostnameitem
add test to fail if hostinterfaceitem is set to fqdn
1 parent d7d1425 commit 7d9e083

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

manifests/agent.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@
275275
Stdlib::Ensure::Service $service_ensure = $zabbix::params::agent_service_ensure,
276276
Boolean $service_enable = $zabbix::params::agent_service_enable,
277277
$hostname = $zabbix::params::agent_hostname,
278-
$hostnameitem = $zabbix::params::agent_hostnameitem,
278+
Optional[String[1]] $hostnameitem = $zabbix::params::agent_hostnameitem,
279279
$hostmetadata = $zabbix::params::agent_hostmetadata,
280280
$hostmetadataitem = $zabbix::params::agent_hostmetadataitem,
281281
Optional[Stdlib::Fqdn] $hostinterface = $zabbix::params::agent_hostinterface,

spec/classes/agent_spec.rb

+10
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@
154154
it { is_expected.to contain_file(config_path).with_content %r{^HostInterfaceItem=system.hostname$} }
155155
end
156156

157+
context 'configuration file with hostinterfaceitem set to fqdn' do
158+
let :params do
159+
{
160+
hostinterfaceitem: 'zabbix.example.com'
161+
}
162+
end
163+
164+
it { is_expected.to compile.and_raise_error(%r{.*}) }
165+
end
166+
157167
context 'configuration file with hostinterface' do
158168
let :params do
159169
{

0 commit comments

Comments
 (0)