From 96a514149a35defcfbffefe085a0a9bebf920873 Mon Sep 17 00:00:00 2001 From: Julio Guevara Date: Thu, 1 Mar 2018 16:42:25 -0600 Subject: [PATCH] Allowing the package_source to be an Httpurl (with tests) --- manifests/init.pp | 2 +- spec/classes/puppet_init_spec.rb | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 64b99227..161f77c2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -563,7 +563,7 @@ Optional[String] $dir_owner = $puppet::params::dir_owner, Optional[String] $dir_group = $puppet::params::dir_group, Optional[String] $package_provider = $puppet::params::package_provider, - Optional[Stdlib::Absolutepath] $package_source = $puppet::params::package_source, + Optional[Variant[Stdlib::Absolutepath, Stdlib::Httpurl]] $package_source = $puppet::params::package_source, Integer[0, 65535] $port = $puppet::params::port, Boolean $listen = $puppet::params::listen, Array[String] $listen_to = $puppet::params::listen_to, diff --git a/spec/classes/puppet_init_spec.rb b/spec/classes/puppet_init_spec.rb index e94a3619..a6df5129 100644 --- a/spec/classes/puppet_init_spec.rb +++ b/spec/classes/puppet_init_spec.rb @@ -85,6 +85,46 @@ it { should contain_puppet__config__main('ca_port').with_value(8140) } end + + describe 'with package_source => Httpurl' do + let :params do { + :package_source => 'https://example.com:123/test' + } end + + if facts[:osfamily] != 'windows' + it { is_expected.to compile } + end + end + + describe 'with package_source => Unixpath' do + let :params do { + :package_source => '/test/folder/path/source.rpm' + } end + + if facts[:osfamily] != 'windows' + it { is_expected.to compile } + end + end + + describe 'with package_source => Windowspath' do + let :params do { + :package_source => 'C:\test\folder\path\source.exe' + } end + + if facts[:osfamily] != 'windows' + it { is_expected.to compile } + end + end + + describe 'with package_source => foo' do + let :params do { + :package_source => 'foo' + } end + + if facts[:osfamily] != 'windows' + it { is_expected.not_to compile } + end + end end end end