Showing with 29 additions and 17 deletions.
  1. +5 −5 manifests/config.pp
  2. +1 −1 manifests/init.pp
  3. +2 −2 manifests/ruby.pp
  4. +6 −6 templates/etc/r10k.yaml.erb
  5. +15 −3 tests/init.pp
10 changes: 5 additions & 5 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
# Charlie Sharpsteen <source@sharpsteen.net>
# Zack Smith <zack@puppetlabs.com>
class r10k::config (
$cachedir = '/var/cache/r10k',
$sources = {},
$purgedirs = [],
$configfile = $r10k::params::r10k_config_file,
) inherits r10k::params {
$configfile,
$cachedir,
$sources = {},
$purgedirs = [],
) {
file { 'r10k.yaml':
ensure => file,
owner => 'root',
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
}

class { 'r10k::conf':
class { 'r10k::config':
cachedir => $cachedir,
configfile => $configfile,
sources => $sources,
Expand Down
4 changes: 2 additions & 2 deletions manifests/ruby.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
$version,
) {
# Breaking up my chaining a little here
Class['ruby'] -> Class['ruby::dev'] -> Package['gcc']
Class['::ruby'] -> Class['ruby::dev'] -> Package['gcc']

# rubygems_update => false
# https://projects.puppetlabs.com/issues/19741
class {'ruby':
class {'::ruby':
rubygems_update => false,
}
class { 'ruby::dev':
Expand Down
12 changes: 6 additions & 6 deletions templates/etc/r10k.yaml.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
:cachedir: <%= @cachedir %>
:sources:
<% if @sources.empty? -%>
:sources:
:<%= @source_name %>:
remote: <%= @remote %>
basedir: <%= @basedir %>
<% else -%>
:sources:
<%# The splitting/joining monkeybuisness trims the YAML document header: `---` -%>
<%= @sources.to_yaml.split("\n")[1..-1].join("\n") %>
:sources:
<%# The splitting/joining monkeybuisness trims the YAML document header: `---` -%>
<%= @sources.to_yaml.split("\n")[1..-1].join("\n") %>
<% end %>
<%# The Array boxing/flattening ensures we don't get bitten by bug #15813 -%>
<% unless [@purgedirs].flatten.empty? -%>
:purgedirs:
<%= [@purgedirs].flatten.to_yaml.split("\n")[1..-1].join("\n") %>
:purgedirs:
<%= [@purgedirs].flatten.to_yaml.split("\n")[1..-1].join("\n") %>
<% end -%>
18 changes: 15 additions & 3 deletions tests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@
# Learn more about module testing here: http://docs.puppetlabs.com/guides/tests_smoke.html
#
class { 'r10k':
remote => 'git@github.com:someuser/puppet.git',
pe_ruby => false,
version => '0.0.9',
pe_ruby => false,
sources => {
'puppet' => {
'remote' => 'git@github.com:acidprime/puppet.git',
'basedir' => "${::settings::confdir}/environments"
},
'hiera' => {
'remote' => 'git@github.com:acidprime/hiera.git',
'basedir' => "${::settings::confdir}/hiera"
},
},
purgedirs => [
"${::settings::confdir}/environments",
"${::settings::confdir}/hiera",
],
}