Showing with 111 additions and 38 deletions.
  1. +2 −0 CHANGELOG
  2. +4 −1 Modulefile
  3. +6 −6 manifests/config.pp
  4. +5 −3 manifests/init.pp
  5. +20 −13 manifests/install.pp
  6. +24 −0 manifests/install/bundle.pp
  7. +1 −1 manifests/install/{ruby.pp → gem.pp}
  8. +24 −0 manifests/install/portage.pp
  9. +2 −5 manifests/mcollective.pp
  10. +11 −3 manifests/params.pp
  11. +12 −5 manifests/prerun_command.pp
  12. +0 −1 tests/init.pp
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
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
* Lint and Syntax updates + Forge Release
2013-08-17 - Zack Smith <zack@puppetlabs.com> - 0.0.4
Expand Down
5 changes: 4 additions & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'zack-r10k'
version '0.0.7'
version '0.0.8'
source 'https://github.com/acidprime/r10k'
author 'zack'
license 'Apache License, Version 2.0'
Expand All @@ -14,3 +14,6 @@ dependency 'puppetlabs/gcc', '>= 0.0.3'
dependency 'puppetlabs/pe_gem', '>= 0.0.1'
dependency 'mhuffnagle/make', '>= 0.0.1'
dependency 'puppetlabs/inifile', '>= 1.0.0'
dependency 'puppetlabs/vcsrepo', '>= 0.1.2'
dependency 'puppetlabs/git', '>= 0.0.3'
dependency 'gentoo/portage', '>= 2.0.0'
12 changes: 6 additions & 6 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
class r10k::config (
$configfile,
$cachedir,
$modulepath,
$manage_modulepath,
$remote = '',
$sources = 'UNSET',
$purgedirs = [],
$puppetconf_path = $r10k::params::puppetconf_path,
$r10k_basedir = $r10k::params::r10k_basedir,
$modulepath = undef,
$remote = '',
$sources = 'UNSET',
$purgedirs = [],
$puppetconf_path = $r10k::params::puppetconf_path,
$r10k_basedir = $r10k::params::r10k_basedir,
) inherits r10k::params {


Expand Down
8 changes: 5 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
$cachedir = $r10k::params::r10k_cache_dir,
$configfile = $r10k::params::r10k_config_file,
$version = $r10k::params::version,
$pe_ruby = $r10k::params::pe_ruby,
$modulepath = $r10k::params::modulepath,
$manage_modulepath = $r10k::params::manage_modulepath,
$r10k_basedir = $r10k::params::r10k_basedir,
$provider = $r10k::params::provider,
$gentoo_keywords = $r10k::params::gentoo_keywords,
) inherits r10k::params {

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

class { 'r10k::config':
Expand Down
33 changes: 20 additions & 13 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# This class is used by the ruby or pe_ruby class
class r10k::install (
$version,
$pe_ruby,
$provider,
$keywords,
) {

# 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
# include those classes if necessary due to 0.x r10k version usage. When
Expand All @@ -14,16 +14,23 @@
require make
}

if $pe_ruby {
$provider = 'pe_gem'
} else {
$provider = 'gem'
class { 'r10k::install::ruby': version => $version; }
}

package { 'r10k':
ensure => $version,
provider => $provider,
case $provider {
'bundle': { include r10k::install::bundle }
'portage': {
class { 'r10k::install::portage':
keywords => $keywords,
version => $version,
}
}
'pe_gem', 'gem': {
if $provider == 'gem' {
class { 'r10k::install::gem': version => $version; }
}
package { 'r10k':
ensure => $version,
provider => $provider,
}
}
default: { fail("$provider is not supported. Valid values are: 'gem', 'pe_gem', 'bundle'") }
}

}
24 changes: 24 additions & 0 deletions manifests/install/bundle.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class r10k::install::bundle {
# The bundle install has prefix support as of writing this, I want bleeding edge.
class { 'git': }
package { "${module_name}-bundle":
ensure => installed,
name => 'bundle',
provider => gem,
}
vcsrepo { "${module_name}-r10k-github":
ensure => latest,
provider => git,
path => '/tmp/r10k',
source => 'https://github.com/adrienthebo/r10k.git',
revision => 'master',
require => Class['git'],
}
exec { "${module_name}-install-via-bundle":
command => 'bundle && bundle install --path /opt/ --binstubs /usr/local/bin/',
cwd => '/tmp/r10k',
require => [ Package["${module_name}-bundle"] , Vcsrepo["${module_name}-r10k-github"] ],
unless => 'bundle list | grep -q " r10k "',
path => '/usr/bin:/usr/local/bin:/usr/sbin:/usr/local/sbin:/sbin:/bin',
}
}
2 changes: 1 addition & 1 deletion manifests/install/ruby.pp → manifests/install/gem.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Install the r10k gem using system ruby
class r10k::install::ruby (
class r10k::install::gem (
$version,
) {

Expand Down
24 changes: 24 additions & 0 deletions manifests/install/portage.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class r10k::install::portage (
$keywords,
$version,
) {

if $keywords {
package_keywords { 'dev-ruby/cri':
keywords => $keywords,
target => 'puppet',
before => Portage::Package['app-admin/r10k'],
}
package_keywords { 'dev-ruby/colored':
keywords => $keywords,
target => 'puppet',
before => Portage::Package['app-admin/r10k'],
}
}

portage::package { 'app-admin/r10k':
ensure => $version,
keywords => $keywords,
target => 'puppet',
}
}
7 changes: 2 additions & 5 deletions manifests/mcollective.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
require => File["${agent_path}/${agent_ddl}"],
}

# Create a service resource for the notification
if ! defined(Service[$mc_service]) {
service { $mc_service :
ensure => running,
}
Service <| title == $mc_service |> {
subscribe +> File["${app_path}/${app_name}"],
}
}
14 changes: 11 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Reasonable defaults for all classes
class r10k::params
{
$version = '1.0.0'
$version = '1.1.0'
$manage_modulepath = false

# r10k configuration
Expand All @@ -15,6 +15,15 @@
$repo_path = '/var/repos'
$remote = "ssh://${git_server}${repo_path}/modules.git"

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

# Installation package manager provider
$provider = 'gem'

# Gentoo specific values
$gentoo_keywords = ''

if $::is_pe == 'true' {
# Puppet Enterprise specific settings
$puppetconf_path = '/etc/puppetlabs/puppet'
Expand All @@ -24,7 +33,7 @@
$mc_service_name = 'pe-mcollective'
$plugins_dir = '/opt/puppet/libexec/mcollective/mcollective'
$modulepath = "${r10k_basedir}/\$environment/modules:${pe_module_path}"
$pe_ruby = true
$provider = 'pe_gem'
} else {
# Getting ready for FOSS support in this module
$puppetconf_path = '/etc/puppet'
Expand All @@ -33,7 +42,6 @@
$mc_service_name = 'mcollective'
$plugins_dir = '/usr/libexec/mcollective/mcollective'
$modulepath = "${r10k_basedir}/\$environment/modules"
$pe_ruby = false
}

# Mcollective configuration static
Expand Down
17 changes: 12 additions & 5 deletions manifests/prerun_command.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# This class will configure r10k to run as part of the masters agent run
class r10k::prerun_command (
$command = 'r10k synchronize'
){
augeas{'puppet.conf prerun_command' :
context => '/files//puppet.conf/agent',
changes => "set prerun_command 'r10k synchronize'",
$command = $r10k::params::prerun_command
) inherits r10k::params {

Ini_setting {
path => "${r10k::params::puppetconf_path}/puppet.conf",
ensure => present,
section => 'agent',
}

ini_setting { 'r10k_prerun_command':
setting => 'prerun_command',
value => $command,
}
}
1 change: 0 additions & 1 deletion tests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
#
class { 'r10k':
remote => 'git@github.com:acidprime/puppet.git',
pe_ruby => false,
}