Showing with 64 additions and 105 deletions.
  1. +1 −1 .msync.yml
  2. +8 −0 CHANGELOG.md
  3. +3 −20 Gemfile
  4. +17 −0 README.md
  5. +1 −32 Rakefile
  6. +2 −0 manifests/init.pp
  7. +2 −0 manifests/install.pp
  8. +1 −0 manifests/params.pp
  9. +1 −1 metadata.json
  10. +24 −0 spec/classes/install_spec.rb
  11. +4 −51 spec/spec_helper.rb
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '2.11.0'
modulesync_config_version: '2.12.0'
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v8.2.0](https://github.com/voxpupuli/puppet-r10k/tree/v8.2.0) (2020-04-06)

[Full Changelog](https://github.com/voxpupuli/puppet-r10k/compare/v8.1.0...v8.2.0)

**Implemented enhancements:**

- Add support for package source attribute [\#517](https://github.com/voxpupuli/puppet-r10k/pull/517) ([prolixalias](https://github.com/prolixalias))

## [v8.1.0](https://github.com/voxpupuli/puppet-r10k/tree/v8.1.0) (2020-04-03)

[Full Changelog](https://github.com/voxpupuli/puppet-r10k/compare/v8.0.0...v8.1.0)
Expand Down
23 changes: 3 additions & 20 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,9 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false
gem 'rspec-puppet-facts', '>= 1.9.5', :require => false
gem 'rspec-puppet-utils', :require => false
gem 'puppet-lint-leading_zero-check', :require => false
gem 'puppet-lint-trailing_comma-check', :require => false
gem 'puppet-lint-version_comparison-check', :require => false
gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false
gem 'puppet-lint-unquoted_string-check', :require => false
gem 'puppet-lint-variable_contains_upcase', :require => false
gem 'puppet-lint-absolute_classname-check', '>= 2.0.0', :require => false
gem 'puppet-lint-topscope-variable-check', :require => false
gem 'puppet-lint-legacy_facts-check', :require => false
gem 'puppet-lint-anchor-check', :require => false
gem 'metadata-json-lint', :require => false
gem 'rubocop', '~> 0.49.1', :require => false
gem 'rubocop-rspec', '~> 1.15.0', :require => false
gem 'mocha', '~> 1.4.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'parallel_tests', :require => false
gem 'voxpupuli-test', '>= 1.0.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
end

group :development do
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ a clone of this modules features and file tickets for anything missing._

### Using an internal gem server

Depending on implementation requirements, there are two ways to use alternate gem sources.

#### The gemrc approach
Create a global gemrc for Puppet Enterprise to add the local gem source. See http://projects.puppetlabs.com/issues/18053#note-12 for more information.

```puppet
Expand All @@ -175,6 +178,17 @@ class { 'r10k':
}
```

#### The parameter approach
Add gem_source to declaration.

```puppet
class { 'r10k':
remote => 'git@github.com:someuser/puppet.git',
provider => 'gem',
gem_source => 'https://some.alternate.source.com/',
}
```

### Mcollective Support
![alt tag](https://gist.githubusercontent.com/acidprime/7013041/raw/1a99e0a8d28b13bc20b74d2dc4ab60c7e752088c/post_recieve_overview.png)

Expand Down Expand Up @@ -758,6 +772,9 @@ When using system ruby , options on how to declare
##### `proxy`
A string setting the`r10k.yaml` configuration value of the same name

##### `gem_source`
An optional string specifying location to retrieve gem

##### `pool_size`
Integer defining how many threads should be spawn while updating modules. Only available for r10k >= 3.3.0.

Expand Down
33 changes: 1 addition & 32 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'voxpupuli/test/rake'

# load optional tasks for releases
# only available if gem group releases is installed
Expand All @@ -7,37 +7,6 @@ begin
rescue LoadError
end

PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'

desc 'Auto-correct puppet-lint offenses'
task 'lint:auto_correct' do
Rake::Task[:lint_fix].invoke
end

desc 'Run acceptance tests'
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end

desc 'Run tests'
task test: [:release_checks]

namespace :check do
desc 'Check for trailing whitespace'
task :trailing_whitespace do
Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename|
next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md|CHANGELOG.md)}
File.foreach(filename).each_with_index do |line, index|
if line =~ %r{\s\n$}
puts "#{filename} has trailing whitespace on line #{index + 1}"
exit 1
end
end
end
end
end
Rake::Task[:release_checks].enhance ['check:trailing_whitespace']

desc "Run main 'test' task and report merged results to coveralls"
task test_with_coveralls: [:test] do
if Dir.exist?(File.expand_path('../lib', __FILE__))
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$root_user = $r10k::params::root_user,
Optional[String[1]] $proxy = $r10k::params::proxy,
Optional[Integer[1]] $pool_size = $r10k::params::pool_size,
Optional[String[1]] $gem_source = $r10k::params::gem_source,
$root_group = $r10k::params::root_group,
$postrun = undef,
Boolean $include_prerun_command = false,
Expand Down Expand Up @@ -51,6 +52,7 @@
manage_ruby_dependency => $manage_ruby_dependency,
package_name => $package_name,
provider => $provider,
gem_source => $gem_source,
version => $version,
puppet_master => $puppet_master,
}
Expand Down
2 changes: 2 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$manage_ruby_dependency,
$puppet_master = true,
$is_pe_server = $r10k::params::is_pe_server,
Optional[String[1]] $gem_source = undef,
) inherits r10k::params {

if $package_name == '' {
Expand Down Expand Up @@ -58,6 +59,7 @@
package { $real_package_name:
ensure => $version,
provider => $provider,
source => $gem_source,
install_options => $provider_install_options,
}

Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
$puppet_master = true
$proxy = undef
$pool_size = undef
$gem_source = undef

if 'puppet_environment' in $facts {
$r10k_basedir = $facts['puppet_environmentpath']
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Vox Pupuli",
"license": "Apache-2.0",
"name": "puppet-r10k",
"version": "8.1.0",
"version": "8.2.0",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down
24 changes: 24 additions & 0 deletions spec/classes/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,30 @@
end
end

context 'with defaults and source specified' do
let :params do
{
manage_ruby_dependency: 'include',
package_name: 'r10k',
provider: 'gem',
version: version,
keywords: '',
gem_source: 'https://some.alternate.source.com/',
install_options: [],
puppet_master: true
}
end

it { is_expected.to contain_class('r10k::install::gem') }
it do
is_expected.to contain_package('r10k').with(
ensure: version,
provider: 'gem',
source: 'https://some.alternate.source.com/'
)
end
end

context 'with bundle provider' do
let :params do
{
Expand Down
55 changes: 4 additions & 51 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
RSpec.configure do |c|
c.mock_with :rspec
end

require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
require 'bundler'
include RspecPuppetFacts
# puppetlabs_spec_helper will set up coverage if the env variable is set.
# We want to do this if lib exists and it hasn't been explicitly set.
ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__))

if ENV['DEBUG']
Puppet::Util::Log.level = :debug
Puppet::Util::Log.newdestination(:console)
end
require 'voxpupuli/test/spec_helper'

if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml')))
Expand All @@ -23,43 +16,3 @@
end
end
end

if Dir.exist?(File.expand_path('../../lib', __FILE__))
require 'coveralls'
require 'simplecov'
require 'simplecov-console'
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console
]
SimpleCov.start do
track_files 'lib/**/*.rb'
add_filter '/spec'
add_filter '/vendor'
add_filter '/.vendor'
add_filter Bundler.configured_bundle_path.path
end
end

RSpec.configure do |c|
# getting the correct facter version is tricky. We use facterdb as a source to mock facts
# see https://github.com/camptocamp/facterdb
# people might provide a specific facter version. In that case we use it.
# Otherwise we need to match the correct facter version to the used puppet version.
# as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14
# https://puppet.com/docs/puppet/5.5/about_agent.html
#
# The environment variable `PUPPET_VERSION` is available in our travis environment, but we cannot rely on it
# if somebody runs the tests locally. For that case we should fallback the the puppet gem version.
c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION']
ENV['FACTERDB_FACTS_VERSION']
else
puppet_version = ENV['PUPPET_VERSION'] ? ENV['PUPPET_VERSION'] : Gem.loaded_specs['puppet'].version.to_s
Gem::Dependency.new('', puppet_version).match?('', '5') ? '3.11.0' : '3.14.0'
end

# Coverage generation
c.after(:suite) do
RSpec::Puppet::Coverage.report!
end
end