Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit db39026

Browse files
committed
Add dependency on puppetlabs_yum and use it
This removes the logic in the repos manifest and instead uses a module which already implements the same logic. It adds the dependency in the modulefile, .fixtures.yml. It also adds a new param to the main class which can be used to decide whether or not to include the pl repos. This also moves the include on epel into init.pp and updates the previous package dependency from rpmbuilder::repos to epel.
1 parent 4344c74 commit db39026

File tree

8 files changed

+20
-92
lines changed

8 files changed

+20
-92
lines changed

.fixtures.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
fixtures:
22
repositories:
33
epel: https://github.com/stahnma/puppet-module-epel.git
4+
puppetlabs_yum: https://github.com/stahnma/puppet-module-puppetlabs_yum.git
45
symlinks:
56
rpmbuilder: "#{source_dir}"

Modulefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name 'puppetlabs-rpmbuilder'
2-
version '0.0.2'
2+
version '0.0.3'
33
source 'https://github.com/Whopper92/puppetlabs-rpmbuilder'
44
author 'Puppet Labs'
55
license 'Apache License 2.0'
@@ -9,3 +9,4 @@ project_page 'https://github.com/Whopper92/puppetlabs-rpmbuilder'
99

1010
## Add dependencies, if any:
1111
dependency 'stahnma/puppet-module-epel', '>= 0.0.1'
12+
dependency 'stahnma/puppet-module-puppetlabs_yum', '>= 0.1.0'

manifests/init.pp

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
$proxy = undef,
77
$pe = false,
88
$pe_vers = undef,
9+
$add_pl_repos = true,
910
) {
10-
include rpmbuilder::repos
11+
if $add_pl_repos {
12+
include puppetlabs_yum
13+
}
14+
include epel
1115
include rpmbuilder::packages::essential
1216

1317
class { rpmbuilder::mock::puppetlabs_mocks:

manifests/packages/essential.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class rpmbuilder::packages::essential {
22
Package {
3-
require => Class['rpmbuilder::repos']
3+
require => Class['epel']
44
}
55

66
$builder_pkgs = [

manifests/packages/extra.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
]
99
package { $builder_pkgs:
1010
ensure => installed,
11-
require => Class['rpmbuilder::repos'],
11+
require => Class['epel'],
1212
}
1313
}

manifests/repos.pp

-55
This file was deleted.

spec/classes/repos_spec.rb

-32
This file was deleted.

spec/classes/rpmbuilder_spec.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
:proxy => nil,
1111
:pe => false,
1212
:pe_vers => nil,
13+
:add_pl_repos => true,
1314
}
1415
end
1516

@@ -22,6 +23,7 @@
2223
:proxy => "http://proxy.puppetlabs.com:1234",
2324
:pe => true,
2425
:pe_vers => ["1.2","lance"],
26+
:add_pl_repos => false,
2527
}].each do |param_set|
2628
let(:param_hash) do
2729
default_params.merge(param_set)
@@ -32,7 +34,14 @@
3234
end
3335

3436
describe "Using #{param_set == {} ? "default params" : "specifying params"}" do
35-
it { should contain_Rpmbuilder__Repos }
37+
it do
38+
if param_hash[:add_pl_repos]
39+
should contain_Puppetlabs_yum
40+
else
41+
should_not contain_Puppetlabs_yum
42+
end
43+
end
44+
3645
it { should contain_Rpmbuilder__Packages__Essential }
3746

3847
it { should contain_Rpmbuilder__Mock__Puppetlabs_Mocks.with({

0 commit comments

Comments
 (0)