From 7d9e0830a59030b1507d1a927666f2a4101b44e1 Mon Sep 17 00:00:00 2001 From: Braxton Schafer Date: Tue, 23 Mar 2021 11:43:53 -0500 Subject: [PATCH] set parameter type on $hostnameitem add test to fail if hostinterfaceitem is set to fqdn --- manifests/agent.pp | 2 +- spec/classes/agent_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/manifests/agent.pp b/manifests/agent.pp index 8134c000c..0d1e36645 100644 --- a/manifests/agent.pp +++ b/manifests/agent.pp @@ -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, diff --git a/spec/classes/agent_spec.rb b/spec/classes/agent_spec.rb index 7e69ab5d2..de46e046c 100644 --- a/spec/classes/agent_spec.rb +++ b/spec/classes/agent_spec.rb @@ -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 {