2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fixtures:
ruby: "git://github.com/puppetlabs/puppetlabs-ruby.git"
gcc: "git://github.com/puppetlabs/puppetlabs-gcc.git"
pe_gem: "git://github.com/puppetlabs/puppetlabs-pe_gem.git"
make: "git://github.com/mhuffnagle/puppet-make.git"
make: "git://github.com/Element84/puppet-make.git"
inifile: "git://github.com/puppetlabs/puppetlabs-inifile.git"
vcsrepo: "git://github.com/puppetlabs/puppetlabs-vcsrepo.git"
git: "git://github.com/puppetlabs/puppetlabs-git.git"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2013-10-20 - Zack Smith <zack@puppetlabs.com> - 0.0.9
* Final params list for version 1.0.0 set & Bugfixes
2013-10-15 - Theo Chatzimichos <tampakrap> - 0.0.8
* Add gentoo support , refactor install class
2013-08-25 - Zack Smith <zack@puppetlabs.vom> - 0.0.5
Expand Down
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'zack-r10k'
version '0.0.8'
version '1.0.0'
source 'https://github.com/acidprime/r10k'
author 'zack'
license 'Apache License, Version 2.0'
Expand Down
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
file { 'r10k.yaml':
ensure => file,
owner => 'root',
group => 'root',
group => '0',
mode => '0644',
path => $configfile,
content => template("${module_name}/${configfile}.erb"),
Expand Down
15 changes: 12 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@
$modulepath = $r10k::params::modulepath,
$manage_modulepath = $r10k::params::manage_modulepath,
$r10k_basedir = $r10k::params::r10k_basedir,
$package_name = $r10k::params::package_name,
$provider = $r10k::params::provider,
$gentoo_keywords = $r10k::params::gentoo_keywords,
$install_options = $r10k::params::install_options,
$mcollective = $r10k::params::mcollective,
) inherits r10k::params {

class { 'r10k::install':
version => $version,
provider => $provider,
keywords => $gentoo_keywords
package_name => $package_name,
version => $version,
provider => $provider,
keywords => $gentoo_keywords,
install_options => $install_options,
}

class { 'r10k::config':
Expand All @@ -28,4 +33,8 @@
remote => $remote,
manage_modulepath => $manage_modulepath,
}

if $mcollective {
class { 'r10k::mcollective': }
}
}
29 changes: 21 additions & 8 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# This class is used by the ruby or pe_ruby class
class r10k::install (
$package_name,
$version,
$provider,
$keywords,
$install_options,
) {
require git

# There are currently bugs in r10k 1.x which make using 0.x desireable in
# certain circumstances. However, 0.x requires make and gcc. Conditionally
Expand All @@ -16,28 +17,40 @@
require make
}

if $package_name == '' {
case $provider {
'portage': { $real_package_name = 'app-admin/r10k' }
'yum': { $real_package_name = 'rubygem-r10k' }
default: { $real_package_name = 'r10k' }
}
} else {
$real_package_name = $package_name
}

case $provider {
'bundle': {
include r10k::install::bundle
}
'portage': {
class { 'r10k::install::portage':
keywords => $keywords,
version => $version,
package_name => $real_package_name,
keywords => $keywords,
version => $version,
}
}
'pe_gem', 'gem': {
'pe_gem', 'gem', 'yum', 'zypper': {
if $provider == 'gem' {
class { 'r10k::install::gem': version => $version; }
}
elsif $provider == 'pe_gem' {
include r10k::install::pe_gem
}
package { 'r10k':
ensure => $version,
provider => $provider,
package { $real_package_name:
ensure => $version,
provider => $provider,
install_options => $install_options,
}
}
default: { fail("$provider is not supported. Valid values are: 'gem', 'pe_gem', 'bundle'") }
default: { fail("$provider is not supported. Valid values are: 'gem', 'pe_gem', 'bundle', 'portage', 'yum', 'zypper'") }
}
}
2 changes: 1 addition & 1 deletion manifests/install/bundle.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# The bundle install has prefix support as of writing this, I want bleeding edge.
package { "${module_name}-bundle":
ensure => installed,
name => 'bundle',
name => 'bundler',
provider => 'gem',
}
vcsrepo { "${module_name}-r10k-github":
Expand Down
2 changes: 2 additions & 0 deletions manifests/install/gem.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
$version,
) {

require git

# Ideally we would be singleton here but due to the bug we need the param.
# If we are newer then the failure state, we do the right thing with include
if versioncmp($::puppetversion,'3.2.2') < 0 {
Expand Down
3 changes: 3 additions & 0 deletions manifests/install/pe_gem.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
class r10k::install::pe_gem {

require git

file { '/usr/bin/r10k':
ensure => link,
target => '/opt/puppet/bin/r10k',
Expand Down
3 changes: 2 additions & 1 deletion manifests/install/portage.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class r10k::install::portage (
$package_name,
$keywords,
$version,
) {
Expand All @@ -16,7 +17,7 @@
}
}

portage::package { 'app-admin/r10k':
portage::package { $package_name:
ensure => $version,
keywords => $keywords,
target => 'puppet',
Expand Down
53 changes: 31 additions & 22 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,54 +1,63 @@
# Reasonable defaults for all classes
class r10k::params
{
$package_name = ''
$version = '1.1.0'
$manage_modulepath = false
$install_options = ''

# r10k configuration
$r10k_config_file = '/etc/r10k.yaml'
$r10k_cache_dir = '/var/cache/r10k'
$r10k_basedir = "${::settings::confdir}/environments"
$r10k_purgedirs = $r10k_basedir
$r10k_config_file = '/etc/r10k.yaml'
$r10k_cache_dir = '/var/cache/r10k'
$r10k_basedir = "${::settings::confdir}/environments"
$r10k_purgedirs = $r10k_basedir

# Git configuration
$git_server = $::settings::ca_server
$repo_path = '/var/repos'
$remote = "ssh://${git_server}${repo_path}/modules.git"
$git_server = $::settings::ca_server
$repo_path = '/var/repos'
$remote = "ssh://${git_server}${repo_path}/modules.git"

# prerun_command in puppet.conf
$prerun_command = 'r10k deploy environment -p'

# Gentoo specific values
$gentoo_keywords = ''

# Include the mcollective agent
$mcollective = false

if $::is_pe == 'true' {
# Puppet Enterprise specific settings
$puppetconf_path = '/etc/puppetlabs/puppet'
$puppetconf_path = '/etc/puppetlabs/puppet'

$pe_module_path = '/opt/puppet/share/puppet/modules'
$pe_module_path = '/opt/puppet/share/puppet/modules'
# Mcollective configuration dynamic
$mc_service_name = 'pe-mcollective'
$plugins_dir = '/opt/puppet/libexec/mcollective/mcollective'
$modulepath = "${r10k_basedir}/\$environment/modules:${pe_module_path}"
$provider = 'pe_gem'
$mc_service_name = 'pe-mcollective'
$plugins_dir = '/opt/puppet/libexec/mcollective/mcollective'
$modulepath = "${r10k_basedir}/\$environment/modules:${pe_module_path}"
$provider = 'pe_gem'
} else {
# Installation package manager provider
$provider = 'gem'

# Getting ready for FOSS support in this module
$puppetconf_path = '/etc/puppet'
$puppetconf_path = '/etc/puppet'

# Mcollective configuration dynamic
$mc_service_name = 'mcollective'
$mc_service_name = 'mcollective'
$modulepath = "${r10k_basedir}/\$environment/modules"

case $::osfamily {
'debian': {
$plugins_dir = '/usr/share/mcollective/plugins/mcollective'
'debian': {
$plugins_dir = '/usr/share/mcollective/plugins/mcollective'
$provider = 'gem'
}
'gentoo': {
$plugins_dir = '/usr/libexec/mcollective/mcollective'
$provider = 'portage'
}
default: {
$plugins_dir = '/usr/libexec/mcollective/mcollective'
$plugins_dir = '/usr/libexec/mcollective/mcollective'
$provider = 'gem'
}
}
$modulepath = "${r10k_basedir}/\$environment/modules"
}

# Mcollective configuration static
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
it { should contain_file("r10k.yaml").with(
'ensure' => 'file',
'owner' => 'root',
'group' => 'root',
'group' => '0',
'mode' => '0644',
'path' => '/etc/r10k.yaml'
)
Expand All @@ -47,7 +47,7 @@
it { should contain_file("r10k.yaml").with(
'ensure' => 'file',
'owner' => 'root',
'group' => 'root',
'group' => '0',
'mode' => '0644',
'path' => '/etc/r10k.yaml'
)
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/install/bundle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end
it { should contain_package("r10k-bundle").with(
'ensure' => 'installed',
'name' => 'bundle',
'name' => 'bundler',
'provider' => 'gem'
)
}
Expand Down Expand Up @@ -50,7 +50,7 @@
end
it { should contain_package("r10k-bundle").with(
'ensure' => 'installed',
'name' => 'bundle',
'name' => 'bundler',
'provider' => 'gem'
)
}
Expand Down
Loading