From 78e486f0075daca1711dd55291c5736dff3e5107 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Mon, 17 Jul 2017 14:07:25 +0200 Subject: [PATCH 01/14] beaker usually runs all tests on each provided os node control-repo has another usecase: run the test for each role onto a subset of os nodes we disable beaker task and generate new ones based on available acceptance tests for all roles to test we use multitask instead of task make papply puppet 5 aware --- Rakefile | 68 +++++++++++++++++++++++++++++++++++++++++++++++---- bin/papply.sh | 3 ++- 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index 74dbb11a..10007ff3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,66 @@ require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet-lint/tasks/puppet-lint' +require 'rspec/core/rake_task' +require 'puppet' -PuppetSyntax.exclude_paths = ['spec/fixtures/**/*', 'vendor/**/*'] -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.ignore_paths = ["pkg/**/*.pp", 'spec/**/*.pp', 'tests/**/*.pp', "vendor/**/*.pp"] +# abort if puppet version is to old +if Puppet::version < '4' + puts 'YOU MUST RUN THIS WITH PUPPET 4.x' + abort +end +exclude_paths = %w( + vendor/**/* + spec/**/* + modules/**/* + pkg/**/* + tests/**/* +) + +# the default lint task can not override the pattern configuration +Rake::Task[:lint].clear +PuppetLint::RakeTask.new(:lint) do |config| + # Pattern of files to ignore + config.ignore_paths = exclude_paths + # Pattern of files to check, defaults to `**/*.pp` + config.pattern = ['manifests/**/*.pp', 'site/**/*.pp'] + # List of checks to disable + config.disable_checks = ['140chars', 'relative', 'class_inherits_from_params_class'] + # Should the task fail if there were any warnings, defaults to false + config.fail_on_warnings = true + # Print out the context for the problem, defaults to false + #config.with_context = true + # Log Format + #config.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' +end + +# beaker is designed to run same tests on multiple nodes +# we have another usecase: multiple tests on multiple os +Rake::Task[:beaker].clear +RSpec::Core::RakeTask.new(:beaker) do |config| + puts 'dont use beaker, use beaker_roles: or all_roles instead' + abort +end + +# iterate over acceptance tests and create namespaced rake tasks +namespace :beaker_roles do + Dir.glob("spec/acceptance/*_spec.rb") do |acceptance_test| + test_name = acceptance_test.split('/').last.split('_spec').first + RSpec::Core::RakeTask.new(test_name) do |t| + t.rspec_opts = ['--color'] + t.pattern = acceptance_test + end + end +end + +# find all rake tasks in beaker_roles namespace and run them in parallel +all_roles = [] +Rake.application.in_namespace(:beaker_roles) do |beaker_roles_namespace| + beaker_roles_namespace.tasks.each do |beaker_roles_tasks| + all_roles << beaker_roles_tasks + end +end +multitask :all_roles => all_roles + +PuppetSyntax.exclude_paths = exclude_paths + +# vim: syntax=ruby diff --git a/bin/papply.sh b/bin/papply.sh index 8b9458b4..f9bd4755 100755 --- a/bin/papply.sh +++ b/bin/papply.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +PATH=$PATH:/opt/puppetlabs/server/bin repo_dir="$(dirname $0)/.." # repo_dir=$(git rev-parse --show-toplevel) . "${repo_dir}/bin/functions" @@ -11,7 +12,7 @@ PATH=$PATH:/opt/puppetlabs/puppet/bin echo_title "Running Puppet version $(puppet --version) apply on ${manifest}" echo_subtitle "Role: ${FACTER_role} - $(facter -p role)" -puppet --version | grep "^4" > /dev/null +puppet --version | grep "^[4|5]" > /dev/null if [ "x$?" == "x0" ] ; then manifest_option='' else From ca11b25c39be99d82ff7eb899469432afe878786 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 18 Jul 2017 10:37:43 +0200 Subject: [PATCH 02/14] acceptance testing - add .fixtures.yml to build sandbox - add spec_helper and spec_helper_acceptance - add default nodeset (docker centos7) - add first profile test --- .fixtures.yml | 4 ++++ spec/acceptance/nodesets/default.yml | 18 ++++++++++++++++++ spec/acceptance/profile_base_linux_spec.rb | 17 +++++++++++++++++ spec/spec_helper.rb | 15 +++++++++++++++ spec/spec_helper_acceptance.rb | 18 ++++++++++++++++++ 5 files changed, 72 insertions(+) create mode 100644 .fixtures.yml create mode 100644 spec/acceptance/nodesets/default.yml create mode 100644 spec/acceptance/profile_base_linux_spec.rb create mode 100644 spec/spec_helper.rb create mode 100644 spec/spec_helper_acceptance.rb diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 00000000..e3ea35d9 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,4 @@ +fixtures: + symlinks: + site: "#{source_dir}/site" + r10k: "#{source_dir}/modules" diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml new file mode 100644 index 00000000..763e8a3a --- /dev/null +++ b/spec/acceptance/nodesets/default.yml @@ -0,0 +1,18 @@ +HOSTS: + centos-7-x64: + platform: el-7-x86_64 + hypervisor : docker + image: centos:centos7 + docker_preserve_image: false + mount_folders: + controlrepo: + host_path: . + container_path: /etc/puppetlabs/code/environments/production + docker_cmd: '["/usr/sbin/init"]' + docker_image_commands: + - 'yum -y swap -- remove fakesystemd -- install systemd systemd-libs' + - 'yum -y install cronie initscripts which' + - 'yum -y update; yum clean all' + - 'rm -fr /var/cache/yum/x86_64/7/* /etc/yum.repos.d/*.repo' +CONFIG: + type: foss diff --git a/spec/acceptance/profile_base_linux_spec.rb b/spec/acceptance/profile_base_linux_spec.rb new file mode 100644 index 00000000..492bac7b --- /dev/null +++ b/spec/acceptance/profile_base_linux_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper_acceptance' + +describe 'profile::base::linux' do + let(:manifest) { + <<-EOS + include profile::base::linux + EOS + } + it 'should run without errors' do + result = apply_manifest(manifest, :catch_failures => true) + expect(@result.exit_code).to eq 2 + end + it 'should run a second time without changes' do + result = apply_manifest(manifest, :catch_changes => true) + expect(@result.exit_code).to eq 0 + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 00000000..65f67bbc --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,15 @@ +require 'puppetlabs_spec_helper/module_spec_helper' + +fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) + +support_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec/support/*.rb')) +Dir[support_path].each {|f| require f} + +RSpec.configure do |c| + c.module_path = File.join(fixture_path, 'modules/site') + ':' + File.join(fixture_path, 'modules/r10k') + c.manifest_dir = File.join(fixture_path, 'manifests') + c.hiera_config = File.join(fixture_path, '../../hiera.yaml') + c.fail_fast = true +end + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb new file mode 100644 index 00000000..e52005bf --- /dev/null +++ b/spec/spec_helper_acceptance.rb @@ -0,0 +1,18 @@ +require 'beaker-rspec' + +hosts.each do |host| + # Install Puppet + install_puppet_agent_on(host) +end + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + # Readable test descriptions + c.formatter = :documentation + # Configure all nodes in nodeset + c.before :suite do + hosts.each do |host| + end + end +end From 0b3021619803ab5311ce8ef2ac0cf269d7fdcdf7 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 18 Jul 2017 16:35:22 +0200 Subject: [PATCH 03/14] beaker acceptance testing - beaker installs puppet agent which will installenvironment.conf.rpmnew - added to gitignore - on beaker hosts no git is installed. check for git cli in config_version script - preserve beaker docker hosts --- .gitignore | 3 +++ bin/config_script.sh | 6 +++++- spec/acceptance/nodesets/default.yml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1d01ef16..68415475 100644 --- a/.gitignore +++ b/.gitignore @@ -213,3 +213,6 @@ ENV/ control-repo.iml /site/profile/.vendor/ /site/profile/coverage/ + +# Beaker spec testing +environment.conf.rpmnew diff --git a/bin/config_script.sh b/bin/config_script.sh index f762a1e6..5c50b230 100755 --- a/bin/config_script.sh +++ b/bin/config_script.sh @@ -1,2 +1,6 @@ #!/bin/bash -/usr/bin/git --git-dir /etc/puppetlabs/code/environments/$1/.git log --pretty=format:"%h - %an, %ad : %s" -1 +if [ -x /usr/bin/git ]; then + /usr/bin/git --git-dir /etc/puppetlabs/code/environments/$1/.git log --pretty=format:"%h - %an, %ad : %s" -1 +else + echo "no git - environment $1" +fi diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml index 763e8a3a..761ec828 100644 --- a/spec/acceptance/nodesets/default.yml +++ b/spec/acceptance/nodesets/default.yml @@ -3,7 +3,7 @@ HOSTS: platform: el-7-x86_64 hypervisor : docker image: centos:centos7 - docker_preserve_image: false + docker_preserve_image: true mount_folders: controlrepo: host_path: . From 2a4eeb467c6fa114e881b2edb21ebbb674669ac4 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 19 Jul 2017 12:26:20 +0200 Subject: [PATCH 04/14] enable eyaml on beaker acceptance testing --- .gitignore | 1 + spec/acceptance/nodesets/default.yml | 3 +-- spec/acceptance/profile_base_linux_spec.rb | 25 ++++++++++++++++++++-- spec/spec_helper_acceptance.rb | 3 +++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 68415475..8c56a781 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ modules/ /keys/private_key.pkcs7.pem *.pyc *Gemfile.lock +vendor # Vagrant artifacts vagrant/environments/*/ubuntu-xenial-16.04-cloudimg-console.log diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml index 761ec828..8fd1456d 100644 --- a/spec/acceptance/nodesets/default.yml +++ b/spec/acceptance/nodesets/default.yml @@ -12,7 +12,6 @@ HOSTS: docker_image_commands: - 'yum -y swap -- remove fakesystemd -- install systemd systemd-libs' - 'yum -y install cronie initscripts which' - - 'yum -y update; yum clean all' - - 'rm -fr /var/cache/yum/x86_64/7/* /etc/yum.repos.d/*.repo' + - 'yum -y update; yum clean all; yum makecache' CONFIG: type: foss diff --git a/spec/acceptance/profile_base_linux_spec.rb b/spec/acceptance/profile_base_linux_spec.rb index 492bac7b..4bad49ef 100644 --- a/spec/acceptance/profile_base_linux_spec.rb +++ b/spec/acceptance/profile_base_linux_spec.rb @@ -3,12 +3,33 @@ describe 'profile::base::linux' do let(:manifest) { <<-EOS + Tp::Install { + test_enable => lookup('tp::test_enable', Boolean, 'first', false), + puppi_enable => lookup('tp::puppi_enable', Boolean, 'first', false), + debug => lookup('tp::debug', Boolean, 'first', false), + data_module => lookup('tp::data_module', String, 'first', 'tinydata'), + } + Tp::Conf { + config_file_notify => lookup('tp::config_file_notify', Boolean, 'first', true), + config_file_require => lookup('tp::config_file_require', Boolean, 'first', true), + debug => lookup('tp::debug', Boolean, 'first', false), + data_module => lookup('tp::data_module', String, 'first', 'tinydata'), + } + Tp::Dir { + config_dir_notify => lookup('tp::config_dir_notify', Boolean, 'first', true), + config_dir_require => lookup('tp::config_dir_require', Boolean, 'first', true), + debug => lookup('tp::debug', Boolean, 'first', false), + data_module => lookup('tp::data_module', String, 'first', 'tinydata'), + } + Exec { + path => '/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin', + } include profile::base::linux EOS } - it 'should run without errors' do + it 'should run without errors or wthout changes' do result = apply_manifest(manifest, :catch_failures => true) - expect(@result.exit_code).to eq 2 + expect(@result.exit_code).to eq(2).or(eq(0)) end it 'should run a second time without changes' do result = apply_manifest(manifest, :catch_changes => true) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index e52005bf..114913db 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,4 +1,5 @@ require 'beaker-rspec' +require 'beaker-hiera' hosts.each do |host| # Install Puppet @@ -13,6 +14,8 @@ # Configure all nodes in nodeset c.before :suite do hosts.each do |host| + on(host, '/opt/puppetlabs/puppet/bin/gem install hiera-eyaml') + on(host, 'cd /etc/puppetlabs/puppet/ && /opt/puppetlabs/puppet/bin/eyaml createkeys') end end end From 198b8b13e30c43d2619e360ff0670da9c9e13fff Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 15:40:44 +0200 Subject: [PATCH 05/14] explicitly mention puppetlabs_spec_helper gem --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index d1a26d6e..c2b8caba 100644 --- a/Gemfile +++ b/Gemfile @@ -50,6 +50,7 @@ group :system_tests do gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') end +gem 'puppetlabs_spec_helper' gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) gem 'r10k', *location_for(ENV['R10K_GEM_VERSION']) From 8591ac4ea6df1ef7ac5bb3eabbb1b094b65d2305 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 15:44:40 +0200 Subject: [PATCH 06/14] install gems on travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 803473bd..0678a5be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ cache: bundler script: "bin/travis_check.sh" before_install: - gem update bundler + - bundle install --path vendor matrix: fast_finish: true include: From e569edffc695b61a17eb44bd4549f285e0dff0dc Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 16:34:40 +0200 Subject: [PATCH 07/14] run all tests from psick base lint cleanup unicode cleanup --- .rspec | 2 + Gemfile | 1 + bin/travis_check.sh | 12 +- manifests/site.pp | 8 +- metadata.json | 61 ++++++++++ site/profile/manifests/aws/cli.pp | 14 +-- site/profile/manifests/time/windows.pp | 8 +- site/profile/templates/gitlab/gitlab.rb.erb | 2 +- spec/classes/openssh_spec.rb | 120 ++++++++++++++++++++ spec/classes/profile_base_linux_spec.rb | 47 ++++++++ spec/classes/users/static_spec.rb | 97 ++++++++++++++++ spec/spec.yaml | 54 +++++++++ spec/spec_helper.rb | 5 +- 13 files changed, 410 insertions(+), 21 deletions(-) create mode 100644 .rspec create mode 100644 metadata.json create mode 100644 spec/classes/openssh_spec.rb create mode 100644 spec/classes/profile_base_linux_spec.rb create mode 100644 spec/classes/users/static_spec.rb create mode 100644 spec/spec.yaml diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..8c18f1ab --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/Gemfile b/Gemfile index c2b8caba..f93582e6 100644 --- a/Gemfile +++ b/Gemfile @@ -60,6 +60,7 @@ gem 'r10k', *location_for(ENV['R10K_GEM_VERSION']) # to `1` and then run bundle install. gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION'] gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION'] +gem 'hiera-eyaml' # Evaluate Gemfile.local if it exists diff --git a/bin/travis_check.sh b/bin/travis_check.sh index 807354b0..dacd0bd2 100755 --- a/bin/travis_check.sh +++ b/bin/travis_check.sh @@ -15,8 +15,12 @@ run_script() { fi } -run_script bin/puppet_check_syntax_fast.sh -run_script bin/puppet_lint.sh optional -run_script "bin/puppet_check_rake.sh site bundle" +bundle exec rake validate +bundle exec rake lint +bundle exec rake spec -exit $global_exit +#run_script bin/puppet_check_syntax_fast.sh +#run_script bin/puppet_lint.sh optional +#run_script "bin/puppet_check_rake.sh site bundle" + +#exit $global_exit diff --git a/manifests/site.pp b/manifests/site.pp index 1852d7ea..0e68cd0f 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -50,7 +50,7 @@ # Exec { # path => '%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\', # } - } + } default: { File { owner => 'root', @@ -120,9 +120,9 @@ contain "::profile::base::${kernel_down}" # Class ordering - Class['::tools'] -> - Class['::profile::settings'] -> - Class['::profile::pre'] -> + Class['::tools'] -> # lint:ignore:arrow_on_right_operand_line + Class['::profile::settings'] -> # lint:ignore:arrow_on_right_operand_line + Class['::profile::pre'] -> # lint:ignore:arrow_on_right_operand_line Class["::profile::base::${kernel_down}"] # Classification option 1 - Profiles defined in Hiera diff --git a/metadata.json b/metadata.json new file mode 100644 index 00000000..015858db --- /dev/null +++ b/metadata.json @@ -0,0 +1,61 @@ +{ + "name": "example42-psick", + "version": "0.0.2", + "author": "Example42", + "summary": "Control Repo.", + "license": "Apache-2.0", + "source": "https://github.com/example42/psick", + "project_page": "https://github.com/example42/psick", + "dependencies": [ + { "name":"puppetlabs/stdlib","version_requirement":">= 4.0.0 < 5.0.0" } + ], + "operatingsystem_support": [ + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "6", + "7" + ] + }, + { + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "6", + "7" + ] + }, + { + "operatingsystem": "OracleLinux", + "operatingsystemrelease": [ + "6", + "7" + ] + }, + { + "operatingsystem": "SLES", + "operatingsystemrelease": [ + "11 SP1", + "12" + ] + }, + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "8" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "16.04" + ] + } + ], + "requirements": [ + { + "name": "puppet", + "version_requirement": ">= 4.5.0 < 6.0.0" + } + ], + "description": "PSICK control repo." +} diff --git a/site/profile/manifests/aws/cli.pp b/site/profile/manifests/aws/cli.pp index 8343ba70..0cdb9f9b 100644 --- a/site/profile/manifests/aws/cli.pp +++ b/site/profile/manifests/aws/cli.pp @@ -21,17 +21,17 @@ $install_gems.each | $gem | { if $install_system_gems { package { $gem: - ensure => $ensure, - provider => 'gem', - require => Class['profile::ruby'], + ensure => $ensure, + provider => 'gem', + require => Class['profile::ruby'], } } if $install_puppet_gems { package { "puppet_${gem}": - ensure => $ensure, - name => $gem, - provider => 'puppet_gem', - require => Class['profile::ruby'], + ensure => $ensure, + name => $gem, + provider => 'puppet_gem', + require => Class['profile::ruby'], } } } diff --git a/site/profile/manifests/time/windows.pp b/site/profile/manifests/time/windows.pp index 6630b89b..53520ff7 100644 --- a/site/profile/manifests/time/windows.pp +++ b/site/profile/manifests/time/windows.pp @@ -1,5 +1,5 @@ # This profile manages ntp client on Windows -# Derived from https://github.com/ncorrare/windowstime +# Derived from https://github.com/ncorrare/windowstime class profile::time::windows ( Array $ntp_servers = $::profile::time::servers, Array $fallback_servers = [], @@ -36,10 +36,10 @@ if $timezone { if $timezone != $facts['timezone'] { exec { "tzutil.exe /s ${timezone}": - command => "tzutil.exe /s \"${timezone}\"", - unless => "tzutil.exe /g | findstr /R /C:\"${timezone}\"", + command => "tzutil.exe /s \"${timezone}\"", + unless => "tzutil.exe /g | findstr /R /C:\"${timezone}\"", + path => $::path, # refreshonly => true, - path => $::path, } } } diff --git a/site/profile/templates/gitlab/gitlab.rb.erb b/site/profile/templates/gitlab/gitlab.rb.erb index 884cd3fa..abfaea42 100644 --- a/site/profile/templates/gitlab/gitlab.rb.erb +++ b/site/profile/templates/gitlab/gitlab.rb.erb @@ -509,7 +509,7 @@ external_url '<%= @options['external_url'] %>' # Git trace log file. # If set, git commands receive GIT_TRACE* environment variables # See https://git-scm.com/book/es/v2/Git-Internals-Environment-Variables#Debugging for documentation -# An absolute path starting with / – the trace output will be appended to that file. +# An absolute path starting with / the trace output will be appended to that file. # It needs to exist so we can check permissions and avoid to throwing warnings to the users. # gitlab_shell['git_trace_log_file'] = "/var/log/gitlab/gitlab-shell/gitlab-shell-git-trace.log" diff --git a/spec/classes/openssh_spec.rb b/spec/classes/openssh_spec.rb new file mode 100644 index 00000000..4ea51910 --- /dev/null +++ b/spec/classes/openssh_spec.rb @@ -0,0 +1,120 @@ +require 'spec_helper' +require 'yaml' +facts_yaml = File.dirname(__FILE__) + '/../spec.yaml' +facts = YAML.load_file(facts_yaml) + +describe 'profile::ssh::openssh', :type => :class do + let(:facts) { facts } + + on_supported_os.each do |os, facts| + context "on #{os}" do + let (:facts) do + facts.merge(super()) + end + + # it { pp catalogue.resources } # Uncomment to dump the catalogue + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('profile::ssh::openssh') } + + context 'with defaults values' do + it { is_expected.not_to contain_tp__conf('openssh') } + + it { is_expected.to contain_tp__dir('openssh').with( + 'ensure' => 'present', + 'source' => nil + ) } + + it { is_expected.to contain_tp__install('openssh').with( + 'ensure' => 'present' + ) } + end + + context 'with :ensure parameter specified' do + let :default_params do + { + :config_dir_source => 'test_config_dir_source', + :config_file_template => '/dev/null', + } + end + + describe 'with parameter: ensure set to absent' do + let :params do + default_params.merge({:ensure => 'absent'}) + end + + it { is_expected.to contain_tp__install('openssh').with( + 'ensure' => 'absent' + ) } + + it { is_expected.to contain_tp__dir('openssh').with( + 'ensure' => 'absent', + 'source' => 'test_config_dir_source' + ) } + + it { is_expected.to contain_tp__conf('openssh').with( + 'ensure' => 'absent', + 'template' => '/dev/null', + 'options_hash' => {} + ) } + end + + describe 'with parameter :ensure set to present' do + let :params do + default_params.merge({:ensure => 'present'}) + end + + it { is_expected.to contain_tp__install('openssh').with( + 'ensure' => 'present' + ) } + + it { is_expected.to contain_tp__conf('openssh').with( + 'ensure' => 'present', + 'template' => '/dev/null', + 'options_hash' => {} + ) } + + it { is_expected.to contain_tp__dir('openssh').with( + 'ensure' => 'present', + 'source' => 'test_config_dir_source' + ) } + end + + end + + context 'with invalid parameter values' do + describe 'with :ensure not equal to "present" or "absent"' do + let :params do + { + :ensure => 'invalid' + } + end + it { is_expected.to raise_error(Puppet::PreformattedError, /^Evaluation Error.* got \'invalid\'.*/) } + end + + describe 'with :config_dir_source set to empty string' do + let :params do + { + :ensure => 'present', + :config_dir_source => '' + } + end + it { is_expected.to raise_error(Puppet::PreformattedError, /^Evaluation Error:.*/) } + end + + describe 'with :config_dir_source not a string' do + let :params do + { + :ensure => 'present', + :config_dir_source => 1 + } + end + it { is_expected.to raise_error(Puppet::PreformattedError, /^Evaluation Error:.*/) } + end + + end + end + end +end + + diff --git a/spec/classes/profile_base_linux_spec.rb b/spec/classes/profile_base_linux_spec.rb new file mode 100644 index 00000000..94ec0633 --- /dev/null +++ b/spec/classes/profile_base_linux_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' +require 'yaml' +facts_yaml = File.dirname(__FILE__) + '/../spec.yaml' +facts = YAML.load_file(facts_yaml) + +describe 'profile::base::linux', :type => :class do + let(:facts) { facts } + let(:pre_condition) { + "Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin', } + contain ::profile::pre + contain '::profile::settings' + $kernel_down=downcase($::kernel) + contain \"::profile::base::${kernel_down}\" + " + } + on_supported_os.select { |_, f| f[:os]['name'] == 'RedHat' }.each do |os, f| + context "on #{os}" do + let(:facts) do + f.merge(super()) + end + + it { is_expected.to compile.with_all_deps } + it { should contain_class('profile::pre') } + it { should contain_class('profile::settings') } + + describe 'with hieradata defaults' do + it { is_expected.to compile.with_all_deps } + it { should contain_class('profile::pre') } + it { should contain_class('profile::mail::postfix') } + it { should contain_class('puppet') } + it { should contain_class('profile::ssh::openssh') } + it { should contain_class('profile::monitor') } + it { should contain_class('profile::logs::rsyslog') } + it { should contain_class('profile::time') } + it { should contain_class('profile::sysctl') } + it { should contain_class('profile::motd') } + it { should contain_class('profile::sudo') } + it { should contain_class('profile::users::static') } + it { should contain_class('profile::dns::resolver') } + it { should contain_class('profile::hostname') } + it { should contain_class('profile::hosts::resource') } + it { should contain_class('profile::profile') } + end + end + end +end + diff --git a/spec/classes/users/static_spec.rb b/spec/classes/users/static_spec.rb new file mode 100644 index 00000000..e936bd5e --- /dev/null +++ b/spec/classes/users/static_spec.rb @@ -0,0 +1,97 @@ +require 'spec_helper' +require 'yaml' +facts_yaml = File.dirname(__FILE__) + '/../../spec.yaml' +facts = YAML.load_file(facts_yaml) + +describe 'profile::users::static', :type => :class do + let(:facts) do + facts + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let((:facts)) do + facts.merge(super()) + end + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('profile::users::static') } + + context 'with defaults values' do + describe 'Root user is not created' + it { is_expected.not_to contain_user('root') } + + describe 'No users are created' + it { is_expected.to have_user_resource_count(0) } + + describe 'Unmanaged users are not purged' + it { is_expected.to have_tools__user__managed_resource_count(0) } + end + + context 'with root_pw: set' do + let(:params) do + {:root_pw => 'test_root_pw'} + end + + describe 'Root user is created' + it { is_expected.to contain_user('root').with( + 'password' => 'test_root_pw' + ) } + end + + context 'with :delete_unmanaged set to true' do + # it { pp catalogue.resources } # Uncomment to dump the catalogue + let(:params) do + {:delete_unmanaged => true} + end + + describe 'Non-system users are purged' + it { is_expected.to contain_resources('user').with( + 'purge' => true, + 'unless_system_user' => true + ) } + end + + context 'with :users defined' do + let(:params) { { + :users_hash => { + 'test_user1' => { + 'name' => 'user1' + }, + 'test_user2' => { + 'name' => 'user2' + } + }} + } + describe + it { is_expected.to have_user_resource_count(2) } + end + + context('with :managed_users defined') { + let(:params) { { + managed_users_hash: { + 'testmanaged_user1' => { + 'name' => 'managed_user1' + }, + 'test_user2' => { + 'name' => 'managed_user2' + } + }} + } + describe + it { is_expected.to have_tools__user__managed_resource_count(2) } + } + + context 'with invalid parameter values' do + describe ':root_pw cannot be empty string' + let(:params) do + {:root_pw => ''} + end + it { is_expected.to raise_error(Puppet::PreformattedError, /^Evaluation Error:.*/) } + end + + end + end +end + + diff --git a/spec/spec.yaml b/spec/spec.yaml new file mode 100644 index 00000000..aacfd196 --- /dev/null +++ b/spec/spec.yaml @@ -0,0 +1,54 @@ +networking: + dhcp: 10.0.2.2 + domain: lan + fqdn: puppet.lan + hostname: puppet + interfaces: + docker0: + bindings: + - address: 172.17.0.1 + netmask: 255.255.0.0 + network: 172.17.0.0 + ip: 172.17.0.1 + mac: "02:42:8e:da:27:96" + mtu: 1500 + netmask: 255.255.0.0 + network: 172.17.0.0 + eth0: + bindings: + - address: 10.0.2.15 + netmask: 255.255.255.0 + network: 10.0.2.0 + dhcp: 10.0.2.2 + ip: 10.0.2.15 + mac: "52:54:00:22:5b:53" + mtu: 1500 + netmask: 255.255.255.0 + network: 10.0.2.0 + eth1: + bindings: + - address: 10.42.42.101 + netmask: 255.255.255.0 + network: 10.42.42.0 + ip: 10.42.42.101 + mac: "08:00:27:e4:c8:bd" + mtu: 1500 + netmask: 255.255.255.0 + network: 10.42.42.0 + lo: + bindings: + - address: 127.0.0.1 + netmask: 255.0.0.0 + network: 127.0.0.0 + ip: 127.0.0.1 + mtu: 65536 + netmask: 255.0.0.0 + network: 127.0.0.0 + ip: 10.0.2.15 + mac: "52:54:00:22:5b:53" + mtu: 1500 + netmask: 255.255.255.0 + network: 10.0.2.0 + primary: eth0 + + diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 65f67bbc..617e80aa 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,6 @@ require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' +include RspecPuppetFacts fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) @@ -7,7 +9,8 @@ RSpec.configure do |c| c.module_path = File.join(fixture_path, 'modules/site') + ':' + File.join(fixture_path, 'modules/r10k') - c.manifest_dir = File.join(fixture_path, 'manifests') + c.manifest_dir = File.join(fixture_path, '../../manifests') + c.manifest = File.join(fixture_path, '../../manifests/site.pp') c.hiera_config = File.join(fixture_path, '../../hiera.yaml') c.fail_fast = true end From f10f13b1de2537139bfab488138a19c9fda4f055 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 16:57:34 +0200 Subject: [PATCH 08/14] pin facter to 2.4 - needs update from facterdb --- .travis.yml | 3 ++- Gemfile | 7 +++++++ Gemfile.puppetlint | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0678a5be..e59740b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,8 @@ cache: bundler script: "bin/travis_check.sh" before_install: - gem update bundler - - bundle install --path vendor + - gem install r10k + - bundle exec r10k puppetfile install -v matrix: fast_finish: true include: diff --git a/Gemfile b/Gemfile index f93582e6..9576c690 100644 --- a/Gemfile +++ b/Gemfile @@ -61,6 +61,7 @@ gem 'r10k', *location_for(ENV['R10K_GEM_VERSION']) gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION'] gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION'] gem 'hiera-eyaml' +gem 'rspec-puppet-facts' # Evaluate Gemfile.local if it exists @@ -68,6 +69,12 @@ if File.exists? "#{__FILE__}.local" eval(File.read("#{__FILE__}.local"), binding) end +# Evaluate Gemfile.puppetlint if it exists +if File.exists? "#{__FILE__}.puppetlint" + eval(File.read("#{__FILE__}.puppetlint"), binding) +end + + # Evaluate ~/.gemfile if it exists if File.exists?(File.join(Dir.home, '.gemfile')) eval(File.read(File.join(Dir.home, '.gemfile')), binding) diff --git a/Gemfile.puppetlint b/Gemfile.puppetlint index 196780c9..d64072a7 100644 --- a/Gemfile.puppetlint +++ b/Gemfile.puppetlint @@ -19,9 +19,9 @@ gem 'puppet-lint-file_ensure-check', gem 'puppet-lint-leading_zero-check', :git => 'https://github.com/voxpupuli/puppet-lint-leading_zero-check.git', :require => false -gem 'puppet-lint-numericvariable', - :git => 'https://github.com/fiddyspence/puppetlint-numericvariable.git', - :require => false +#gem 'puppet-lint-numericvariable', +# :git => 'https://github.com/fiddyspence/puppetlint-numericvariable.git', +# :require => false gem 'puppet-lint-resource_reference_syntax', :git => 'https://github.com/voxpupuli/puppet-lint-resource_reference_syntax.git', :require => false From 9ebd1c5df1feb7b59c1017c364caae1d398b5ad5 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 16:58:06 +0200 Subject: [PATCH 09/14] unignore Gemfile.lock --- .gitignore | 1 - Gemfile.lock | 568 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 568 insertions(+), 1 deletion(-) create mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index 8c56a781..a720531a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,6 @@ spec/fixtures modules/ /keys/private_key.pkcs7.pem *.pyc -*Gemfile.lock vendor # Vagrant artifacts diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..d7db6abd --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,568 @@ +GIT + remote: https://github.com/fiddyspence/puppetlint-variablecase.git + revision: 71a2e17e5db905d464026de1bb417c7255d245b4 + specs: + puppet-lint-variable_contains_upcase (1.2.0) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-appends-check.git + revision: 8bc398cf9cb198631c7b3b4328b98a3eb2b2aa62 + specs: + puppet-lint-appends-check (0.1.1) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-classes_and_types_beginning_with_digits-check.git + revision: ed04d3300a7cc63f408b215e3675200c682ffcd1 + specs: + puppet-lint-classes_and_types_beginning_with_digits-check (0.1.2) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-empty_string-check.git + revision: 6671a2645340b211f04f32c0200434ac5a1b90d1 + specs: + puppet-lint-empty_string-check (0.2.2) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-file_ensure-check.git + revision: bd33c74fc4908e345dbe039388d5f09a415b3a52 + specs: + puppet-lint-file_ensure-check (0.3.1) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-leading_zero-check.git + revision: b3ea137a87f7d5d6addcd6fa61812c14af28e712 + specs: + puppet-lint-leading_zero-check (0.1.1) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-resource_reference_syntax.git + revision: 399121653453178feb39365627104a07d3b4e54d + specs: + puppet-lint-resource_reference_syntax (1.0.10) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-spaceship_operator_without_tag-check.git + revision: b4cf5295d9c4a6834062ed9dfee925ace2c44ba6 + specs: + puppet-lint-spaceship_operator_without_tag-check (0.1.1) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-trailing_comma-check.git + revision: e17f547a219dbfefa5d2e6c61e5b7b778695de23 + specs: + puppet-lint-trailing_comma-check (0.3.2) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-undef_in_function-check.git + revision: f2be50353ddb22e4960267968ef4f0f8d9740beb + specs: + puppet-lint-undef_in_function-check (0.2.1) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-unquoted_string-check.git + revision: 19c7f4a003697bb27592a893f4c5b5ddd8f2be7e + specs: + puppet-lint-unquoted_string-check (0.3.0) + puppet-lint (>= 1.0, < 3.0) + +GIT + remote: https://github.com/voxpupuli/puppet-lint-version_comparison-check.git + revision: 630e72fd409f96859eddcaddf5f82cb01a9fa735 + specs: + puppet-lint-version_comparison-check (0.2.1) + puppet-lint (>= 1.0, < 3.0) + +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (2.3.5) + addressable (2.5.1) + public_suffix (~> 2.0, >= 2.0.2) + ast (2.3.0) + aws-sdk-v1 (1.67.0) + json (~> 1.4) + nokogiri (~> 1) + beaker (3.20.0) + aws-sdk-v1 (~> 1.57) + beaker-hiera (~> 0.0) + beaker-hostgenerator + beaker-puppet (~> 0.0) + beaker-vmpooler (~> 0.1) + docker-api + fission (~> 0.4) + fog (~> 1.38) + google-api-client (~> 0.9) + hocon (~> 1.0) + in-parallel (~> 0.1) + inifile (~> 3.0) + minitar (~> 0.5.4) + minitest (~> 5.4) + net-scp (~> 1.2) + net-ssh (~> 4.0) + open_uri_redirections (~> 0.2.1) + rsync (~> 1.0.9) + stringify-hash (~> 0.0) + thor (~> 0.19) + unf (~> 0.1) + beaker-abs (0.2.0) + beaker (>= 2.9.0, < 4.0) + beaker-answers (0.17.0) + hocon (~> 1.0) + require_all (~> 1.3.2) + stringify-hash (~> 0.0.0) + beaker-hiera (0.1.1) + stringify-hash (~> 0.0.0) + beaker-hostgenerator (0.10.2) + deep_merge (~> 1.0) + stringify-hash (~> 0.0.0) + beaker-module_install_helper (0.1.4) + beaker (>= 2.0) + beaker-pe (1.21.0) + beaker-answers (~> 0.0) + stringify-hash (~> 0.0.0) + beaker-puppet (0.3.0) + in-parallel (~> 0.1) + stringify-hash (~> 0.0.0) + beaker-puppet_install_helper (0.7.1) + beaker (>= 2.0) + beaker-rspec (6.1.0) + beaker (~> 3.0) + rspec (~> 3.0) + serverspec (~> 2) + specinfra (~> 2) + beaker-vmpooler (0.2.0) + rbvmomi (~> 1.9) + stringify-hash (~> 0.0.0) + builder (3.2.3) + coderay (1.1.1) + colored (1.2) + cri (2.6.1) + colored (~> 1.2) + declarative (0.0.9) + declarative-option (0.1.0) + deep_merge (1.1.1) + diff-lcs (1.3) + docile (1.1.5) + docker-api (1.33.6) + excon (>= 0.38.0) + json + excon (0.57.1) + facter (2.4.0) + facterdb (0.3.11) + facter + jgrep + faraday (0.9.2) + multipart-post (>= 1.2, < 3) + faraday_middleware (0.10.1) + faraday (>= 0.7.4, < 1.0) + fast_gettext (1.1.0) + fission (0.5.0) + CFPropertyList (~> 2.2) + fog (1.40.0) + fog-aliyun (>= 0.1.0) + fog-atmos + fog-aws (>= 0.6.0) + fog-brightbox (~> 0.4) + fog-cloudatcost (~> 0.1.0) + fog-core (~> 1.43) + fog-digitalocean (>= 0.3.0) + fog-dnsimple (~> 1.0) + fog-dynect (~> 0.0.2) + fog-ecloud (~> 0.1) + fog-google (<= 0.1.0) + fog-json + fog-local + fog-openstack + fog-powerdns (>= 0.1.1) + fog-profitbricks + fog-rackspace + fog-radosgw (>= 0.0.2) + fog-riakcs + fog-sakuracloud (>= 0.0.4) + fog-serverlove + fog-softlayer + fog-storm_on_demand + fog-terremark + fog-vmfusion + fog-voxel + fog-vsphere (>= 0.4.0) + fog-xenserver + fog-xml (~> 0.1.1) + ipaddress (~> 0.5) + json (>= 1.8, < 2.0) + fog-aliyun (0.1.0) + fog-core (~> 1.27) + fog-json (~> 1.0) + ipaddress (~> 0.8) + xml-simple (~> 1.1) + fog-atmos (0.1.0) + fog-core + fog-xml + fog-aws (1.4.0) + fog-core (~> 1.38) + fog-json (~> 1.0) + fog-xml (~> 0.1) + ipaddress (~> 0.8) + fog-brightbox (0.12.0) + fog-core (~> 1.22) + fog-json + inflecto (~> 0.0.2) + fog-cloudatcost (0.1.2) + fog-core (~> 1.36) + fog-json (~> 1.0) + fog-xml (~> 0.1) + ipaddress (~> 0.8) + fog-core (1.44.3) + builder + excon (~> 0.49) + formatador (~> 0.2) + fog-digitalocean (0.3.0) + fog-core (~> 1.42) + fog-json (>= 1.0) + fog-xml (>= 0.1) + ipaddress (>= 0.5) + fog-dnsimple (1.0.0) + fog-core (~> 1.38) + fog-json (~> 1.0) + fog-dynect (0.0.3) + fog-core + fog-json + fog-xml + fog-ecloud (0.3.0) + fog-core + fog-xml + fog-google (0.1.0) + fog-core + fog-json + fog-xml + fog-json (1.0.2) + fog-core (~> 1.0) + multi_json (~> 1.10) + fog-local (0.3.1) + fog-core (~> 1.27) + fog-openstack (0.1.21) + fog-core (>= 1.40) + fog-json (>= 1.0) + ipaddress (>= 0.8) + fog-powerdns (0.1.1) + fog-core (~> 1.27) + fog-json (~> 1.0) + fog-xml (~> 0.1) + fog-profitbricks (3.0.0) + fog-core (~> 1.42) + fog-json (~> 1.0) + fog-rackspace (0.1.5) + fog-core (>= 1.35) + fog-json (>= 1.0) + fog-xml (>= 0.1) + ipaddress (>= 0.8) + fog-radosgw (0.0.5) + fog-core (>= 1.21.0) + fog-json + fog-xml (>= 0.0.1) + fog-riakcs (0.1.0) + fog-core + fog-json + fog-xml + fog-sakuracloud (1.7.5) + fog-core + fog-json + fog-serverlove (0.1.2) + fog-core + fog-json + fog-softlayer (1.1.4) + fog-core + fog-json + fog-storm_on_demand (0.1.1) + fog-core + fog-json + fog-terremark (0.1.0) + fog-core + fog-xml + fog-vmfusion (0.1.0) + fission + fog-core + fog-voxel (0.1.0) + fog-core + fog-xml + fog-vsphere (1.11.2) + fog-core + rbvmomi (~> 1.9) + fog-xenserver (0.3.0) + fog-core + fog-xml + fog-xml (0.1.3) + fog-core + nokogiri (>= 1.5.11, < 2.0.0) + formatador (0.2.5) + gettext (3.2.3) + locale (>= 2.0.5) + text (>= 1.3.0) + gettext-setup (0.26) + fast_gettext (~> 1.1.0) + gettext (>= 3.0.2) + locale + google-api-client (0.13.1) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 0.5) + httpclient (>= 2.8.1, < 3.0) + mime-types (~> 3.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + googleauth (0.5.1) + faraday (~> 0.9) + jwt (~> 1.4) + logging (~> 2.0) + memoist (~> 0.12) + multi_json (~> 1.11) + os (~> 0.9) + signet (~> 0.7) + hiera (3.4.0) + hiera-eyaml (2.1.0) + highline (~> 1.6.19) + trollop (~> 2.0) + highline (1.6.21) + hocon (1.2.5) + httpclient (2.8.3) + in-parallel (0.1.17) + inflecto (0.0.2) + inifile (3.0.0) + ipaddress (0.8.3) + jgrep (1.4.1) + json + json (1.8.6) + json-schema (2.8.0) + addressable (>= 2.4) + jwt (1.5.6) + little-plugger (1.1.4) + locale (2.1.2) + log4r (1.1.10) + logging (2.2.2) + little-plugger (~> 1.1) + multi_json (~> 1.10) + master_manipulator (2.1.1) + beaker (>= 2.7.0) + multi_json + mcollective-client (2.11.1) + json + stomp + systemu + memoist (0.16.0) + metaclass (0.0.4) + metadata-json-lint (2.0.1) + json-schema (~> 2.8) + puppet (>= 4.7.0, < 6.0.0) + spdx-licenses (~> 1.0) + method_source (0.8.2) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_portile2 (2.2.0) + minitar (0.5.4) + minitest (5.10.3) + mocha (1.1.0) + metaclass (~> 0.0.1) + multi_json (1.12.1) + multipart-post (2.0.0) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (4.1.0) + net-telnet (0.1.1) + nokogiri (1.8.0) + mini_portile2 (~> 2.2.0) + open_uri_redirections (0.2.1) + os (0.9.6) + parallel (1.11.2) + parallel_tests (2.14.2) + parallel + parser (2.4.0.0) + ast (~> 2.2) + powerpack (0.1.1) + pry (0.10.4) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + public_suffix (2.0.5) + puppet (5.0.1) + facter (> 2.0, < 4) + gettext-setup (>= 0.10, < 1) + hiera (>= 3.2.1, < 4) + locale (~> 2.1) + puppet-lint (2.3.0) + puppet-module-posix-default-r2.1 (0.0.10) + puppet-module-posix-dev-r2.1 (0.0.10) + gettext-setup (~> 0.26) + metadata-json-lint (>= 2.0.1, < 3.0.0) + mocha (>= 1.0.0, < 1.2.0) + parallel_tests (>= 2.14.1, < 3.0.0) + pry (~> 0.10.4) + puppet-lint (>= 2.3.0, < 3.0.0) + puppet-syntax (>= 2.4.1, < 3.0.0) + puppetlabs_spec_helper (>= 2.2.0, < 3.0.0) + rainbow (>= 2.0.0, < 2.2.0) + rspec-puppet (>= 2.3.2, < 3.0.0) + rspec-puppet-facts (~> 1.8) + rspec_junit_formatter (~> 0.2) + rubocop (~> 0.49) + rubocop-rspec (~> 1.15) + simplecov (>= 0.14.1, < 1.0.0) + specinfra (= 2.67.3) + puppet-module-posix-system-r2.1 (0.0.10) + beaker-module_install_helper (>= 0.1.4, < 1.0.0) + beaker-puppet_install_helper (>= 0.7.1, < 1.0.0) + master_manipulator (>= 2.1.1, < 3.0.0) + puppet-syntax (2.4.1) + rake + puppet_forge (2.2.6) + faraday (~> 0.9.0) + faraday_middleware (>= 0.9.0, < 0.11.0) + gettext-setup (~> 0.11) + minitar + semantic_puppet (~> 0.1.0) + puppetlabs_spec_helper (2.3.0) + mocha (~> 1.0) + puppet-lint (~> 2.0) + puppet-syntax (~> 2.0) + rspec-puppet (~> 2.0) + r10k (2.5.5) + colored (= 1.2) + cri (~> 2.6.1) + gettext-setup (~> 0.5) + log4r (= 1.1.10) + multi_json (~> 1.10) + puppet_forge (~> 2.2) + semantic_puppet (~> 0.1.0) + rainbow (2.1.0) + rake (12.0.0) + rbvmomi (1.11.3) + builder (~> 3.0) + json (>= 1.8) + nokogiri (~> 1.5) + trollop (~> 2.1) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + require_all (1.3.3) + retriable (3.0.2) + rspec (3.6.0) + rspec-core (~> 3.6.0) + rspec-expectations (~> 3.6.0) + rspec-mocks (~> 3.6.0) + rspec-core (3.6.0) + rspec-support (~> 3.6.0) + rspec-expectations (3.6.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.6.0) + rspec-its (1.2.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.6.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.6.0) + rspec-puppet (2.6.4) + rspec + rspec-puppet-facts (1.8.0) + facter + facterdb (>= 0.3.0) + json + mcollective-client + puppet + rspec-support (3.6.0) + rspec_junit_formatter (0.3.0) + rspec-core (>= 2, < 4, != 2.12.0) + rsync (1.0.9) + rubocop (0.49.1) + parallel (~> 1.10) + parser (>= 2.3.3.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + rubocop-rspec (1.15.1) + rubocop (>= 0.42.0) + ruby-progressbar (1.8.1) + semantic_puppet (0.1.4) + gettext-setup (>= 0.3) + serverspec (2.39.0) + multi_json + rspec (~> 3.0) + rspec-its + specinfra (~> 2.53) + sfl (2.3) + signet (0.7.3) + addressable (~> 2.3) + faraday (~> 0.9) + jwt (~> 1.5) + multi_json (~> 1.10) + simplecov (0.14.1) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.1) + slop (3.6.0) + spdx-licenses (1.1.0) + specinfra (2.67.3) + net-scp + net-ssh (>= 2.7, < 5.0) + net-telnet + sfl + stomp (1.4.4) + stringify-hash (0.0.2) + systemu (2.6.5) + text (1.3.1) + thor (0.19.4) + trollop (2.1.2) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.4) + unicode-display_width (1.3.0) + xml-simple (1.1.5) + +PLATFORMS + ruby + +DEPENDENCIES + beaker (>= 3) + beaker-abs (~> 0.1) + beaker-hostgenerator + beaker-pe + beaker-rspec + fast_gettext + hiera-eyaml + puppet + puppet-lint-appends-check! + puppet-lint-classes_and_types_beginning_with_digits-check! + puppet-lint-empty_string-check! + puppet-lint-file_ensure-check! + puppet-lint-leading_zero-check! + puppet-lint-resource_reference_syntax! + puppet-lint-spaceship_operator_without_tag-check! + puppet-lint-trailing_comma-check! + puppet-lint-undef_in_function-check! + puppet-lint-unquoted_string-check! + puppet-lint-variable_contains_upcase! + puppet-lint-version_comparison-check! + puppet-module-posix-default-r2.1 + puppet-module-posix-dev-r2.1 + puppet-module-posix-system-r2.1 + puppet-module-win-default-r2.1 + puppet-module-win-dev-r2.1 + puppet-module-win-system-r2.1 + puppetlabs_spec_helper + r10k + rspec-puppet-facts + +BUNDLED WITH + 1.15.1 From 4ca3806a07d8c0277ba15f0f858e63c360b3a219 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 17:01:35 +0200 Subject: [PATCH 10/14] installfirst prior usage of r10k --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e59740b3..370f9c1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ cache: bundler script: "bin/travis_check.sh" before_install: - gem update bundler - - gem install r10k + - gem install --without system_tests --path vendor/bundle - bundle exec r10k puppetfile install -v matrix: fast_finish: true From 7531d5d5b59a800df6b65e32e73f81aa7eb9af8a Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 17:06:03 +0200 Subject: [PATCH 11/14] install r10k native and use directly --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 370f9c1f..2d84b189 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ cache: bundler script: "bin/travis_check.sh" before_install: - gem update bundler - - gem install --without system_tests --path vendor/bundle - - bundle exec r10k puppetfile install -v + - gem install r10k + - r10k puppetfile install -v matrix: fast_finish: true include: From 31efeea6a53c364276a01b1d722bac67bf9d966e Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 17:10:58 +0200 Subject: [PATCH 12/14] pin facter in Gemfile and remove Gemfile.lock --- .gitignore | 1 + Gemfile | 2 +- Gemfile.lock | 568 --------------------------------------------------- 3 files changed, 2 insertions(+), 569 deletions(-) delete mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index a720531a..8c56a781 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ spec/fixtures modules/ /keys/private_key.pkcs7.pem *.pyc +*Gemfile.lock vendor # Vagrant artifacts diff --git a/Gemfile b/Gemfile index 9576c690..614428e8 100644 --- a/Gemfile +++ b/Gemfile @@ -58,7 +58,7 @@ gem 'r10k', *location_for(ENV['R10K_GEM_VERSION']) # Otherwise it can lead to strange bundler behavior. If you are seeing weird # gem resolution behavior, try setting `DEBUG_RESOLVER` environment variable # to `1` and then run bundle install. -gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION'] +gem 'facter', *location_for(ENV['FACTER_GEM_VERSION'] || '~> 2.4') gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION'] gem 'hiera-eyaml' gem 'rspec-puppet-facts' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index d7db6abd..00000000 --- a/Gemfile.lock +++ /dev/null @@ -1,568 +0,0 @@ -GIT - remote: https://github.com/fiddyspence/puppetlint-variablecase.git - revision: 71a2e17e5db905d464026de1bb417c7255d245b4 - specs: - puppet-lint-variable_contains_upcase (1.2.0) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-appends-check.git - revision: 8bc398cf9cb198631c7b3b4328b98a3eb2b2aa62 - specs: - puppet-lint-appends-check (0.1.1) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-classes_and_types_beginning_with_digits-check.git - revision: ed04d3300a7cc63f408b215e3675200c682ffcd1 - specs: - puppet-lint-classes_and_types_beginning_with_digits-check (0.1.2) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-empty_string-check.git - revision: 6671a2645340b211f04f32c0200434ac5a1b90d1 - specs: - puppet-lint-empty_string-check (0.2.2) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-file_ensure-check.git - revision: bd33c74fc4908e345dbe039388d5f09a415b3a52 - specs: - puppet-lint-file_ensure-check (0.3.1) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-leading_zero-check.git - revision: b3ea137a87f7d5d6addcd6fa61812c14af28e712 - specs: - puppet-lint-leading_zero-check (0.1.1) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-resource_reference_syntax.git - revision: 399121653453178feb39365627104a07d3b4e54d - specs: - puppet-lint-resource_reference_syntax (1.0.10) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-spaceship_operator_without_tag-check.git - revision: b4cf5295d9c4a6834062ed9dfee925ace2c44ba6 - specs: - puppet-lint-spaceship_operator_without_tag-check (0.1.1) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-trailing_comma-check.git - revision: e17f547a219dbfefa5d2e6c61e5b7b778695de23 - specs: - puppet-lint-trailing_comma-check (0.3.2) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-undef_in_function-check.git - revision: f2be50353ddb22e4960267968ef4f0f8d9740beb - specs: - puppet-lint-undef_in_function-check (0.2.1) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-unquoted_string-check.git - revision: 19c7f4a003697bb27592a893f4c5b5ddd8f2be7e - specs: - puppet-lint-unquoted_string-check (0.3.0) - puppet-lint (>= 1.0, < 3.0) - -GIT - remote: https://github.com/voxpupuli/puppet-lint-version_comparison-check.git - revision: 630e72fd409f96859eddcaddf5f82cb01a9fa735 - specs: - puppet-lint-version_comparison-check (0.2.1) - puppet-lint (>= 1.0, < 3.0) - -GEM - remote: https://rubygems.org/ - specs: - CFPropertyList (2.3.5) - addressable (2.5.1) - public_suffix (~> 2.0, >= 2.0.2) - ast (2.3.0) - aws-sdk-v1 (1.67.0) - json (~> 1.4) - nokogiri (~> 1) - beaker (3.20.0) - aws-sdk-v1 (~> 1.57) - beaker-hiera (~> 0.0) - beaker-hostgenerator - beaker-puppet (~> 0.0) - beaker-vmpooler (~> 0.1) - docker-api - fission (~> 0.4) - fog (~> 1.38) - google-api-client (~> 0.9) - hocon (~> 1.0) - in-parallel (~> 0.1) - inifile (~> 3.0) - minitar (~> 0.5.4) - minitest (~> 5.4) - net-scp (~> 1.2) - net-ssh (~> 4.0) - open_uri_redirections (~> 0.2.1) - rsync (~> 1.0.9) - stringify-hash (~> 0.0) - thor (~> 0.19) - unf (~> 0.1) - beaker-abs (0.2.0) - beaker (>= 2.9.0, < 4.0) - beaker-answers (0.17.0) - hocon (~> 1.0) - require_all (~> 1.3.2) - stringify-hash (~> 0.0.0) - beaker-hiera (0.1.1) - stringify-hash (~> 0.0.0) - beaker-hostgenerator (0.10.2) - deep_merge (~> 1.0) - stringify-hash (~> 0.0.0) - beaker-module_install_helper (0.1.4) - beaker (>= 2.0) - beaker-pe (1.21.0) - beaker-answers (~> 0.0) - stringify-hash (~> 0.0.0) - beaker-puppet (0.3.0) - in-parallel (~> 0.1) - stringify-hash (~> 0.0.0) - beaker-puppet_install_helper (0.7.1) - beaker (>= 2.0) - beaker-rspec (6.1.0) - beaker (~> 3.0) - rspec (~> 3.0) - serverspec (~> 2) - specinfra (~> 2) - beaker-vmpooler (0.2.0) - rbvmomi (~> 1.9) - stringify-hash (~> 0.0.0) - builder (3.2.3) - coderay (1.1.1) - colored (1.2) - cri (2.6.1) - colored (~> 1.2) - declarative (0.0.9) - declarative-option (0.1.0) - deep_merge (1.1.1) - diff-lcs (1.3) - docile (1.1.5) - docker-api (1.33.6) - excon (>= 0.38.0) - json - excon (0.57.1) - facter (2.4.0) - facterdb (0.3.11) - facter - jgrep - faraday (0.9.2) - multipart-post (>= 1.2, < 3) - faraday_middleware (0.10.1) - faraday (>= 0.7.4, < 1.0) - fast_gettext (1.1.0) - fission (0.5.0) - CFPropertyList (~> 2.2) - fog (1.40.0) - fog-aliyun (>= 0.1.0) - fog-atmos - fog-aws (>= 0.6.0) - fog-brightbox (~> 0.4) - fog-cloudatcost (~> 0.1.0) - fog-core (~> 1.43) - fog-digitalocean (>= 0.3.0) - fog-dnsimple (~> 1.0) - fog-dynect (~> 0.0.2) - fog-ecloud (~> 0.1) - fog-google (<= 0.1.0) - fog-json - fog-local - fog-openstack - fog-powerdns (>= 0.1.1) - fog-profitbricks - fog-rackspace - fog-radosgw (>= 0.0.2) - fog-riakcs - fog-sakuracloud (>= 0.0.4) - fog-serverlove - fog-softlayer - fog-storm_on_demand - fog-terremark - fog-vmfusion - fog-voxel - fog-vsphere (>= 0.4.0) - fog-xenserver - fog-xml (~> 0.1.1) - ipaddress (~> 0.5) - json (>= 1.8, < 2.0) - fog-aliyun (0.1.0) - fog-core (~> 1.27) - fog-json (~> 1.0) - ipaddress (~> 0.8) - xml-simple (~> 1.1) - fog-atmos (0.1.0) - fog-core - fog-xml - fog-aws (1.4.0) - fog-core (~> 1.38) - fog-json (~> 1.0) - fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-brightbox (0.12.0) - fog-core (~> 1.22) - fog-json - inflecto (~> 0.0.2) - fog-cloudatcost (0.1.2) - fog-core (~> 1.36) - fog-json (~> 1.0) - fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-core (1.44.3) - builder - excon (~> 0.49) - formatador (~> 0.2) - fog-digitalocean (0.3.0) - fog-core (~> 1.42) - fog-json (>= 1.0) - fog-xml (>= 0.1) - ipaddress (>= 0.5) - fog-dnsimple (1.0.0) - fog-core (~> 1.38) - fog-json (~> 1.0) - fog-dynect (0.0.3) - fog-core - fog-json - fog-xml - fog-ecloud (0.3.0) - fog-core - fog-xml - fog-google (0.1.0) - fog-core - fog-json - fog-xml - fog-json (1.0.2) - fog-core (~> 1.0) - multi_json (~> 1.10) - fog-local (0.3.1) - fog-core (~> 1.27) - fog-openstack (0.1.21) - fog-core (>= 1.40) - fog-json (>= 1.0) - ipaddress (>= 0.8) - fog-powerdns (0.1.1) - fog-core (~> 1.27) - fog-json (~> 1.0) - fog-xml (~> 0.1) - fog-profitbricks (3.0.0) - fog-core (~> 1.42) - fog-json (~> 1.0) - fog-rackspace (0.1.5) - fog-core (>= 1.35) - fog-json (>= 1.0) - fog-xml (>= 0.1) - ipaddress (>= 0.8) - fog-radosgw (0.0.5) - fog-core (>= 1.21.0) - fog-json - fog-xml (>= 0.0.1) - fog-riakcs (0.1.0) - fog-core - fog-json - fog-xml - fog-sakuracloud (1.7.5) - fog-core - fog-json - fog-serverlove (0.1.2) - fog-core - fog-json - fog-softlayer (1.1.4) - fog-core - fog-json - fog-storm_on_demand (0.1.1) - fog-core - fog-json - fog-terremark (0.1.0) - fog-core - fog-xml - fog-vmfusion (0.1.0) - fission - fog-core - fog-voxel (0.1.0) - fog-core - fog-xml - fog-vsphere (1.11.2) - fog-core - rbvmomi (~> 1.9) - fog-xenserver (0.3.0) - fog-core - fog-xml - fog-xml (0.1.3) - fog-core - nokogiri (>= 1.5.11, < 2.0.0) - formatador (0.2.5) - gettext (3.2.3) - locale (>= 2.0.5) - text (>= 1.3.0) - gettext-setup (0.26) - fast_gettext (~> 1.1.0) - gettext (>= 3.0.2) - locale - google-api-client (0.13.1) - addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.5) - httpclient (>= 2.8.1, < 3.0) - mime-types (~> 3.0) - representable (~> 3.0) - retriable (>= 2.0, < 4.0) - googleauth (0.5.1) - faraday (~> 0.9) - jwt (~> 1.4) - logging (~> 2.0) - memoist (~> 0.12) - multi_json (~> 1.11) - os (~> 0.9) - signet (~> 0.7) - hiera (3.4.0) - hiera-eyaml (2.1.0) - highline (~> 1.6.19) - trollop (~> 2.0) - highline (1.6.21) - hocon (1.2.5) - httpclient (2.8.3) - in-parallel (0.1.17) - inflecto (0.0.2) - inifile (3.0.0) - ipaddress (0.8.3) - jgrep (1.4.1) - json - json (1.8.6) - json-schema (2.8.0) - addressable (>= 2.4) - jwt (1.5.6) - little-plugger (1.1.4) - locale (2.1.2) - log4r (1.1.10) - logging (2.2.2) - little-plugger (~> 1.1) - multi_json (~> 1.10) - master_manipulator (2.1.1) - beaker (>= 2.7.0) - multi_json - mcollective-client (2.11.1) - json - stomp - systemu - memoist (0.16.0) - metaclass (0.0.4) - metadata-json-lint (2.0.1) - json-schema (~> 2.8) - puppet (>= 4.7.0, < 6.0.0) - spdx-licenses (~> 1.0) - method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.2.0) - minitar (0.5.4) - minitest (5.10.3) - mocha (1.1.0) - metaclass (~> 0.0.1) - multi_json (1.12.1) - multipart-post (2.0.0) - net-scp (1.2.1) - net-ssh (>= 2.6.5) - net-ssh (4.1.0) - net-telnet (0.1.1) - nokogiri (1.8.0) - mini_portile2 (~> 2.2.0) - open_uri_redirections (0.2.1) - os (0.9.6) - parallel (1.11.2) - parallel_tests (2.14.2) - parallel - parser (2.4.0.0) - ast (~> 2.2) - powerpack (0.1.1) - pry (0.10.4) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - public_suffix (2.0.5) - puppet (5.0.1) - facter (> 2.0, < 4) - gettext-setup (>= 0.10, < 1) - hiera (>= 3.2.1, < 4) - locale (~> 2.1) - puppet-lint (2.3.0) - puppet-module-posix-default-r2.1 (0.0.10) - puppet-module-posix-dev-r2.1 (0.0.10) - gettext-setup (~> 0.26) - metadata-json-lint (>= 2.0.1, < 3.0.0) - mocha (>= 1.0.0, < 1.2.0) - parallel_tests (>= 2.14.1, < 3.0.0) - pry (~> 0.10.4) - puppet-lint (>= 2.3.0, < 3.0.0) - puppet-syntax (>= 2.4.1, < 3.0.0) - puppetlabs_spec_helper (>= 2.2.0, < 3.0.0) - rainbow (>= 2.0.0, < 2.2.0) - rspec-puppet (>= 2.3.2, < 3.0.0) - rspec-puppet-facts (~> 1.8) - rspec_junit_formatter (~> 0.2) - rubocop (~> 0.49) - rubocop-rspec (~> 1.15) - simplecov (>= 0.14.1, < 1.0.0) - specinfra (= 2.67.3) - puppet-module-posix-system-r2.1 (0.0.10) - beaker-module_install_helper (>= 0.1.4, < 1.0.0) - beaker-puppet_install_helper (>= 0.7.1, < 1.0.0) - master_manipulator (>= 2.1.1, < 3.0.0) - puppet-syntax (2.4.1) - rake - puppet_forge (2.2.6) - faraday (~> 0.9.0) - faraday_middleware (>= 0.9.0, < 0.11.0) - gettext-setup (~> 0.11) - minitar - semantic_puppet (~> 0.1.0) - puppetlabs_spec_helper (2.3.0) - mocha (~> 1.0) - puppet-lint (~> 2.0) - puppet-syntax (~> 2.0) - rspec-puppet (~> 2.0) - r10k (2.5.5) - colored (= 1.2) - cri (~> 2.6.1) - gettext-setup (~> 0.5) - log4r (= 1.1.10) - multi_json (~> 1.10) - puppet_forge (~> 2.2) - semantic_puppet (~> 0.1.0) - rainbow (2.1.0) - rake (12.0.0) - rbvmomi (1.11.3) - builder (~> 3.0) - json (>= 1.8) - nokogiri (~> 1.5) - trollop (~> 2.1) - representable (3.0.4) - declarative (< 0.1.0) - declarative-option (< 0.2.0) - uber (< 0.2.0) - require_all (1.3.3) - retriable (3.0.2) - rspec (3.6.0) - rspec-core (~> 3.6.0) - rspec-expectations (~> 3.6.0) - rspec-mocks (~> 3.6.0) - rspec-core (3.6.0) - rspec-support (~> 3.6.0) - rspec-expectations (3.6.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-its (1.2.0) - rspec-core (>= 3.0.0) - rspec-expectations (>= 3.0.0) - rspec-mocks (3.6.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-puppet (2.6.4) - rspec - rspec-puppet-facts (1.8.0) - facter - facterdb (>= 0.3.0) - json - mcollective-client - puppet - rspec-support (3.6.0) - rspec_junit_formatter (0.3.0) - rspec-core (>= 2, < 4, != 2.12.0) - rsync (1.0.9) - rubocop (0.49.1) - parallel (~> 1.10) - parser (>= 2.3.3.1, < 3.0) - powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - rubocop-rspec (1.15.1) - rubocop (>= 0.42.0) - ruby-progressbar (1.8.1) - semantic_puppet (0.1.4) - gettext-setup (>= 0.3) - serverspec (2.39.0) - multi_json - rspec (~> 3.0) - rspec-its - specinfra (~> 2.53) - sfl (2.3) - signet (0.7.3) - addressable (~> 2.3) - faraday (~> 0.9) - jwt (~> 1.5) - multi_json (~> 1.10) - simplecov (0.14.1) - docile (~> 1.1.0) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.1) - slop (3.6.0) - spdx-licenses (1.1.0) - specinfra (2.67.3) - net-scp - net-ssh (>= 2.7, < 5.0) - net-telnet - sfl - stomp (1.4.4) - stringify-hash (0.0.2) - systemu (2.6.5) - text (1.3.1) - thor (0.19.4) - trollop (2.1.2) - uber (0.1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.4) - unicode-display_width (1.3.0) - xml-simple (1.1.5) - -PLATFORMS - ruby - -DEPENDENCIES - beaker (>= 3) - beaker-abs (~> 0.1) - beaker-hostgenerator - beaker-pe - beaker-rspec - fast_gettext - hiera-eyaml - puppet - puppet-lint-appends-check! - puppet-lint-classes_and_types_beginning_with_digits-check! - puppet-lint-empty_string-check! - puppet-lint-file_ensure-check! - puppet-lint-leading_zero-check! - puppet-lint-resource_reference_syntax! - puppet-lint-spaceship_operator_without_tag-check! - puppet-lint-trailing_comma-check! - puppet-lint-undef_in_function-check! - puppet-lint-unquoted_string-check! - puppet-lint-variable_contains_upcase! - puppet-lint-version_comparison-check! - puppet-module-posix-default-r2.1 - puppet-module-posix-dev-r2.1 - puppet-module-posix-system-r2.1 - puppet-module-win-default-r2.1 - puppet-module-win-dev-r2.1 - puppet-module-win-system-r2.1 - puppetlabs_spec_helper - r10k - rspec-puppet-facts - -BUNDLED WITH - 1.15.1 From cbed3a6175298d1afeb1642fbbc337d71a41a2b1 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 17:17:13 +0200 Subject: [PATCH 13/14] pin facter to 2.4.0, remove puppet 3 tests --- .travis.yml | 4 ++-- Gemfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2d84b189..9a2104a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,8 @@ matrix: - rvm: 2.1.9 bundler_args: --without system_tests env: PUPPET_GEM_VERSION="~> 4.0" STDLIB_LOG_DEPRECATIONS="false" - - rvm: 2.1.5 + - rvm: 2.4.1 bundler_args: --without system_tests - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + env: PUPPET_GEM_VERSION="~> 5.0" STDLIB_LOG_DEPRECATIONS="false" notifications: email: false diff --git a/Gemfile b/Gemfile index 614428e8..9a3370ed 100644 --- a/Gemfile +++ b/Gemfile @@ -58,7 +58,7 @@ gem 'r10k', *location_for(ENV['R10K_GEM_VERSION']) # Otherwise it can lead to strange bundler behavior. If you are seeing weird # gem resolution behavior, try setting `DEBUG_RESOLVER` environment variable # to `1` and then run bundle install. -gem 'facter', *location_for(ENV['FACTER_GEM_VERSION'] || '~> 2.4') +gem 'facter', *location_for(ENV['FACTER_GEM_VERSION'] || '= 2.4.0') gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION'] gem 'hiera-eyaml' gem 'rspec-puppet-facts' From e6ff1e489ebed5780581f8574b9671dfff4cd41b Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Fri, 21 Jul 2017 18:55:18 +0200 Subject: [PATCH 14/14] remove unit tests from site modules --- spec/classes/openssh_spec.rb | 120 ------------------------ spec/classes/profile_base_linux_spec.rb | 47 ---------- spec/classes/users/static_spec.rb | 97 ------------------- 3 files changed, 264 deletions(-) delete mode 100644 spec/classes/openssh_spec.rb delete mode 100644 spec/classes/profile_base_linux_spec.rb delete mode 100644 spec/classes/users/static_spec.rb diff --git a/spec/classes/openssh_spec.rb b/spec/classes/openssh_spec.rb deleted file mode 100644 index 4ea51910..00000000 --- a/spec/classes/openssh_spec.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'spec_helper' -require 'yaml' -facts_yaml = File.dirname(__FILE__) + '/../spec.yaml' -facts = YAML.load_file(facts_yaml) - -describe 'profile::ssh::openssh', :type => :class do - let(:facts) { facts } - - on_supported_os.each do |os, facts| - context "on #{os}" do - let (:facts) do - facts.merge(super()) - end - - # it { pp catalogue.resources } # Uncomment to dump the catalogue - - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_class('profile::ssh::openssh') } - - context 'with defaults values' do - it { is_expected.not_to contain_tp__conf('openssh') } - - it { is_expected.to contain_tp__dir('openssh').with( - 'ensure' => 'present', - 'source' => nil - ) } - - it { is_expected.to contain_tp__install('openssh').with( - 'ensure' => 'present' - ) } - end - - context 'with :ensure parameter specified' do - let :default_params do - { - :config_dir_source => 'test_config_dir_source', - :config_file_template => '/dev/null', - } - end - - describe 'with parameter: ensure set to absent' do - let :params do - default_params.merge({:ensure => 'absent'}) - end - - it { is_expected.to contain_tp__install('openssh').with( - 'ensure' => 'absent' - ) } - - it { is_expected.to contain_tp__dir('openssh').with( - 'ensure' => 'absent', - 'source' => 'test_config_dir_source' - ) } - - it { is_expected.to contain_tp__conf('openssh').with( - 'ensure' => 'absent', - 'template' => '/dev/null', - 'options_hash' => {} - ) } - end - - describe 'with parameter :ensure set to present' do - let :params do - default_params.merge({:ensure => 'present'}) - end - - it { is_expected.to contain_tp__install('openssh').with( - 'ensure' => 'present' - ) } - - it { is_expected.to contain_tp__conf('openssh').with( - 'ensure' => 'present', - 'template' => '/dev/null', - 'options_hash' => {} - ) } - - it { is_expected.to contain_tp__dir('openssh').with( - 'ensure' => 'present', - 'source' => 'test_config_dir_source' - ) } - end - - end - - context 'with invalid parameter values' do - describe 'with :ensure not equal to "present" or "absent"' do - let :params do - { - :ensure => 'invalid' - } - end - it { is_expected.to raise_error(Puppet::PreformattedError, /^Evaluation Error.* got \'invalid\'.*/) } - end - - describe 'with :config_dir_source set to empty string' do - let :params do - { - :ensure => 'present', - :config_dir_source => '' - } - end - it { is_expected.to raise_error(Puppet::PreformattedError, /^Evaluation Error:.*/) } - end - - describe 'with :config_dir_source not a string' do - let :params do - { - :ensure => 'present', - :config_dir_source => 1 - } - end - it { is_expected.to raise_error(Puppet::PreformattedError, /^Evaluation Error:.*/) } - end - - end - end - end -end - - diff --git a/spec/classes/profile_base_linux_spec.rb b/spec/classes/profile_base_linux_spec.rb deleted file mode 100644 index 94ec0633..00000000 --- a/spec/classes/profile_base_linux_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'spec_helper' -require 'yaml' -facts_yaml = File.dirname(__FILE__) + '/../spec.yaml' -facts = YAML.load_file(facts_yaml) - -describe 'profile::base::linux', :type => :class do - let(:facts) { facts } - let(:pre_condition) { - "Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin', } - contain ::profile::pre - contain '::profile::settings' - $kernel_down=downcase($::kernel) - contain \"::profile::base::${kernel_down}\" - " - } - on_supported_os.select { |_, f| f[:os]['name'] == 'RedHat' }.each do |os, f| - context "on #{os}" do - let(:facts) do - f.merge(super()) - end - - it { is_expected.to compile.with_all_deps } - it { should contain_class('profile::pre') } - it { should contain_class('profile::settings') } - - describe 'with hieradata defaults' do - it { is_expected.to compile.with_all_deps } - it { should contain_class('profile::pre') } - it { should contain_class('profile::mail::postfix') } - it { should contain_class('puppet') } - it { should contain_class('profile::ssh::openssh') } - it { should contain_class('profile::monitor') } - it { should contain_class('profile::logs::rsyslog') } - it { should contain_class('profile::time') } - it { should contain_class('profile::sysctl') } - it { should contain_class('profile::motd') } - it { should contain_class('profile::sudo') } - it { should contain_class('profile::users::static') } - it { should contain_class('profile::dns::resolver') } - it { should contain_class('profile::hostname') } - it { should contain_class('profile::hosts::resource') } - it { should contain_class('profile::profile') } - end - end - end -end - diff --git a/spec/classes/users/static_spec.rb b/spec/classes/users/static_spec.rb deleted file mode 100644 index e936bd5e..00000000 --- a/spec/classes/users/static_spec.rb +++ /dev/null @@ -1,97 +0,0 @@ -require 'spec_helper' -require 'yaml' -facts_yaml = File.dirname(__FILE__) + '/../../spec.yaml' -facts = YAML.load_file(facts_yaml) - -describe 'profile::users::static', :type => :class do - let(:facts) do - facts - end - - on_supported_os.each do |os, facts| - context "on #{os}" do - let((:facts)) do - facts.merge(super()) - end - - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_class('profile::users::static') } - - context 'with defaults values' do - describe 'Root user is not created' - it { is_expected.not_to contain_user('root') } - - describe 'No users are created' - it { is_expected.to have_user_resource_count(0) } - - describe 'Unmanaged users are not purged' - it { is_expected.to have_tools__user__managed_resource_count(0) } - end - - context 'with root_pw: set' do - let(:params) do - {:root_pw => 'test_root_pw'} - end - - describe 'Root user is created' - it { is_expected.to contain_user('root').with( - 'password' => 'test_root_pw' - ) } - end - - context 'with :delete_unmanaged set to true' do - # it { pp catalogue.resources } # Uncomment to dump the catalogue - let(:params) do - {:delete_unmanaged => true} - end - - describe 'Non-system users are purged' - it { is_expected.to contain_resources('user').with( - 'purge' => true, - 'unless_system_user' => true - ) } - end - - context 'with :users defined' do - let(:params) { { - :users_hash => { - 'test_user1' => { - 'name' => 'user1' - }, - 'test_user2' => { - 'name' => 'user2' - } - }} - } - describe - it { is_expected.to have_user_resource_count(2) } - end - - context('with :managed_users defined') { - let(:params) { { - managed_users_hash: { - 'testmanaged_user1' => { - 'name' => 'managed_user1' - }, - 'test_user2' => { - 'name' => 'managed_user2' - } - }} - } - describe - it { is_expected.to have_tools__user__managed_resource_count(2) } - } - - context 'with invalid parameter values' do - describe ':root_pw cannot be empty string' - let(:params) do - {:root_pw => ''} - end - it { is_expected.to raise_error(Puppet::PreformattedError, /^Evaluation Error:.*/) } - end - - end - end -end - -