Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Add parameter package source, needed when using rpm/dpkg package provider #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
# @param debug Set to 'true' to enable modules debugging
# @param package_provider The Provider to use for the package resource
# @param package The name of zabbix_agent package
# @param package_source The full path and filename. Needed when using dpkg or rpm package provider
# @param service The name of zabbix_agent service
# @param service_status If the zabbix_agent service init script supports status argument
# @param process The name of zabbix_agent process
Expand Down Expand Up @@ -100,6 +101,7 @@
String $data_dir = '',
String[1] $log_dir = '/var/log/zabbix',
String[1] $log_file = '/var/log/zabbix/zabbix_agentd.log',
Optional[Stdlib::Absolutepath] $package_source = undef,
){

### Definition of some variables used in the module
Expand Down Expand Up @@ -181,6 +183,10 @@
default => $package_provider,
}

if ($real_package_provider in ['rpm', 'dpkg'] and $package_source == undef) {
fail('When using rpm/dpkg package provider, you must specify package_source')
}

### Managed resources
### DEPENDENCIES class
if $dependencies_class != '' {
Expand Down
1 change: 1 addition & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
ensure => $zabbix_agent::manage_package,
name => $zabbix_agent::package,
provider => $zabbix_agent::real_package_provider,
source => $zabbix_agent::package_source,
}
}

Expand Down
8 changes: 4 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "example42-zabbix_agent",
"version": "3.0.3",
"version": "3.1.0",
"author": "example42",
"summary": "Puppet module for zabbix_agent",
"license": "Apache-2.0",
Expand Down Expand Up @@ -70,7 +70,7 @@
"version_requirement": ">= 4.10.0 < 7.0.0"
}
],
"pdk-version": "1.14.0",
"template-url": "pdk-default#1.14.0",
"template-ref": "1.14.0-0-g1bf3a4e"
"pdk-version": "1.14.1",
"template-url": "pdk-default#1.14.1",
"template-ref": "1.14.1-0-g0b5b39b"
}
15 changes: 15 additions & 0 deletions spec/classes/standard42_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
let(:node) { 'rspec.example42.com' }

describe 'Test standard installation' do
let(:params) do
{
package_source: '/opt/package/zabbix_agent.rpm',
}
end

it { is_expected.to contain_package('zabbix_agent') }
it { is_expected.to contain_service('zabbix_agent').with_ensure('running') }
it { is_expected.to contain_service('zabbix_agent').with_enable('true') }
Expand All @@ -21,6 +27,7 @@
{
install: 'package',
version: '1.0.42',
package_source: '/opt/package/zabbix_agent.rpm',
}
end

Expand All @@ -32,6 +39,7 @@
{
install: 'package',
absent: true,
package_source: '/opt/package/zabbix_agent.rpm',
}
end

Expand All @@ -54,6 +62,7 @@
{
install: 'package',
disable: true,
package_source: '/opt/package/zabbix_agent.rpm',
}
end

Expand All @@ -72,6 +81,7 @@
{
install: 'package',
disableboot: true,
package_source: '/opt/package/zabbix_agent.rpm',
}
end

Expand All @@ -89,6 +99,7 @@
{
template: 'zabbix_agent/spec.erb',
options: { 'opt_a' => 'value_a' },
package_source: '/opt/package/zabbix_agent.rpm',
}
end

Expand All @@ -106,6 +117,7 @@
let(:params) do
{
source: 'puppet:///modules/zabbix_agent/spec',
package_source: '/opt/package/zabbix_agent.rpm',
}
end

Expand All @@ -117,6 +129,7 @@
{
source_dir: 'puppet:///modules/zabbix_agent/dir/spec',
source_dir_purge: true,
package_source: '/opt/package/zabbix_agent.rpm',
}
end

Expand All @@ -130,6 +143,7 @@
{
my_class: 'zabbix_agent::spec',
options: { 'opt_a' => 'value_a' },
package_source: '/opt/package/zabbix_agent.rpm',
}
end

Expand All @@ -140,6 +154,7 @@
let(:params) do
{
service_autorestart: false,
package_source: '/opt/package/zabbix_agent.rpm',
}
end

Expand Down