Skip to content

Commit

Permalink
Add dependency on puppetlabs_yum and use it
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
haus committed Nov 15, 2012
1 parent 4344c74 commit db39026
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 92 deletions.
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
fixtures:
repositories:
epel: https://github.com/stahnma/puppet-module-epel.git
puppetlabs_yum: https://github.com/stahnma/puppet-module-puppetlabs_yum.git
symlinks:
rpmbuilder: "#{source_dir}"
3 changes: 2 additions & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'puppetlabs-rpmbuilder'
version '0.0.2'
version '0.0.3'
source 'https://github.com/Whopper92/puppetlabs-rpmbuilder'
author 'Puppet Labs'
license 'Apache License 2.0'
Expand All @@ -9,3 +9,4 @@ project_page 'https://github.com/Whopper92/puppetlabs-rpmbuilder'

## Add dependencies, if any:
dependency 'stahnma/puppet-module-epel', '>= 0.0.1'
dependency 'stahnma/puppet-module-puppetlabs_yum', '>= 0.1.0'
6 changes: 5 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
$proxy = undef,
$pe = false,
$pe_vers = undef,
$add_pl_repos = true,
) {
include rpmbuilder::repos
if $add_pl_repos {
include puppetlabs_yum
}
include epel
include rpmbuilder::packages::essential

class { rpmbuilder::mock::puppetlabs_mocks:
Expand Down
2 changes: 1 addition & 1 deletion manifests/packages/essential.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class rpmbuilder::packages::essential {
Package {
require => Class['rpmbuilder::repos']
require => Class['epel']
}

$builder_pkgs = [
Expand Down
2 changes: 1 addition & 1 deletion manifests/packages/extra.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
]
package { $builder_pkgs:
ensure => installed,
require => Class['rpmbuilder::repos'],
require => Class['epel'],
}
}
55 changes: 0 additions & 55 deletions manifests/repos.pp

This file was deleted.

32 changes: 0 additions & 32 deletions spec/classes/repos_spec.rb

This file was deleted.

11 changes: 10 additions & 1 deletion spec/classes/rpmbuilder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:proxy => nil,
:pe => false,
:pe_vers => nil,
:add_pl_repos => true,
}
end

Expand All @@ -22,6 +23,7 @@
:proxy => "http://proxy.puppetlabs.com:1234",
:pe => true,
:pe_vers => ["1.2","lance"],
:add_pl_repos => false,
}].each do |param_set|
let(:param_hash) do
default_params.merge(param_set)
Expand All @@ -32,7 +34,14 @@
end

describe "Using #{param_set == {} ? "default params" : "specifying params"}" do
it { should contain_Rpmbuilder__Repos }
it do
if param_hash[:add_pl_repos]
should contain_Puppetlabs_yum
else
should_not contain_Puppetlabs_yum
end
end

it { should contain_Rpmbuilder__Packages__Essential }

it { should contain_Rpmbuilder__Mock__Puppetlabs_Mocks.with({
Expand Down

0 comments on commit db39026

Please sign in to comment.