Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit db3902687c904505b4fd4e0d5bfd116841550bfe 1 parent 4344c74
@haus haus authored
View
1  .fixtures.yml
@@ -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}"
View
3  Modulefile
@@ -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'
@@ -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'
View
6 manifests/init.pp
@@ -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:
View
2  manifests/packages/essential.pp
@@ -1,6 +1,6 @@
class rpmbuilder::packages::essential {
Package {
- require => Class['rpmbuilder::repos']
+ require => Class['epel']
}
$builder_pkgs = [
View
2  manifests/packages/extra.pp
@@ -8,6 +8,6 @@
]
package { $builder_pkgs:
ensure => installed,
- require => Class['rpmbuilder::repos'],
+ require => Class['epel'],
}
}
View
55 manifests/repos.pp
@@ -1,55 +0,0 @@
-class rpmbuilder::repos {
-
- case $operatingsystem {
- 'fedora': {
- $baseurlOS = 'fedora'
- $os_version = $os_maj_version ? {
- '15' => 'f15',
- '16' => 'f16',
- '17' => 'f17',
- default => undef,
- }
- }
- default: {
- $baseurlOS = 'el'
- $os_version = $os_maj_version
- }
- }
-
- if $::osfamily == 'RedHat' and $::operatingsystem != 'Fedora' {
- include epel
- }
-
- yumrepo { 'puppetlabs-products':
- baseurl => "http://yum.puppetlabs.com/${baseurlOS}/${os_version}/products/${::architecture}",
- enabled => '1',
- gpgcheck => '1',
- gpgkey => 'http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs',
- descr => "Puppet Labs Products ${os_version} - ${::architecture}",
- }
-
- yumrepo { 'puppetlabs-deps':
- baseurl => "http://yum.puppetlabs.com/${baseurlOS}/${os_version}/dependencies/${::architecture}",
- enabled => '1',
- gpgcheck => '1',
- gpgkey => 'http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs',
- descr => "Puppet Labs Dependencies ${os_version} - ${::architecture}",
- }
-
- yumrepo { 'puppetlabs-products-source':
- baseurl => "http://yum.puppetlabs.com/${baseurlOS}/${os_version}/products/SRPMS",
- failovermethod => 'priority',
- enabled => '0',
- gpgcheck => '1',
- gpgkey => 'http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs',
- descr => "Puppet Labs Products ${os_version} - ${::architecture} - Source",
- }
-
- yumrepo { 'puppetlabs-deps-source':
- baseurl => "http://yum.puppetlabs.com/${baseurlOS}/${os_version}/dependencies/SRPMS",
- enabled => '0',
- gpgcheck => '1',
- gpgkey => 'http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs',
- descr => "Puppet Labs Source Dependencies ${os_version} - Source",
- }
-}
View
32 spec/classes/repos_spec.rb
@@ -1,32 +0,0 @@
-require 'spec_helper'
-
-describe 'rpmbuilder::repos', :type => 'class' do
-
- context "On a Fedora OS" do
- baseurlOS = 'fedora'
- let(:facts) {{
- :operatingsystem => 'fedora',
- :os_maj_version => '16',
- :architecture => 'i386',
- }}
-
- it {
- should contain_yumrepo('puppetlabs-products').with(
- { 'baseurl' => "http://yum.puppetlabs.com/#{baseurlOS}/f#{facts[:os_maj_version]}/products/#{facts[:architecture]}" } )
- should contain_yumrepo('puppetlabs-deps').with(
- { 'baseurl' => "http://yum.puppetlabs.com/#{baseurlOS}/f#{facts[:os_maj_version]}/dependencies/#{facts[:architecture]}" } )
- should contain_yumrepo('puppetlabs-products-source').with(
- { 'baseurl' => "http://yum.puppetlabs.com/#{baseurlOS}/f#{facts[:os_maj_version]}/products/SRPMS" } )
- should contain_yumrepo('puppetlabs-deps-source').with(
- { 'baseurl' => "http://yum.puppetlabs.com/#{baseurlOS}/f#{facts[:os_maj_version]}/dependencies/SRPMS" } )
- }
-
- end
-
- context "On a non-Fedora OS" do
- let(:facts) {{ :operatingsystem => 'centos', :osfamily => 'RedHat' }}
-
- it { should include_class("epel") }
-
- end
-end
View
11 spec/classes/rpmbuilder_spec.rb
@@ -10,6 +10,7 @@
:proxy => nil,
:pe => false,
:pe_vers => nil,
+ :add_pl_repos => true,
}
end
@@ -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)
@@ -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({
Please sign in to comment.
Something went wrong with that request. Please try again.