From 522352de88df5ff9346dddfa6f9dc7ed1428dc24 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:12:14 +0100 Subject: [PATCH 01/51] puppet-lint fix --- manifests/instances.pp | 2 -- manifests/params.pp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/manifests/instances.pp b/manifests/instances.pp index 39cdcb6..a3ab283 100644 --- a/manifests/instances.pp +++ b/manifests/instances.pp @@ -20,7 +20,6 @@ Hash[String, Hash] $syslog_hash = {}, Hash[String, Hash] $resource_defaults = $augeasproviders::params::resource_defaults, ) inherits augeasproviders::params { - create_resources(apache_directive, $apache_directive_hash, $resource_defaults['apache_directive']) create_resources(apache_setenv, $apache_setenv_hash, $resource_defaults['apache_setenv']) create_resources(host, $host_hash, $resource_defaults['host']) @@ -37,5 +36,4 @@ create_resources(sshd_config_subsystem, $sshd_config_subsystem_hash, $resource_defaults['sshd_config_subsystem']) create_resources(sysctl, $sysctl_hash, $resource_defaults['sysctl']) create_resources(syslog, $syslog_hash, $resource_defaults['syslog']) - } diff --git a/manifests/params.pp b/manifests/params.pp index c7ed41d..596932c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,7 +12,7 @@ 'apache_directive' => $defaults, 'apache_setenv' => $defaults, 'host' => $defaults, - 'kernel_parameter' => merge($defaults, {'provider' => undef}), + 'kernel_parameter' => merge($defaults, { 'provider' => undef }), 'mailalias' => $defaults, 'mounttab' => $defaults, 'nrpe_command' => $defaults, @@ -26,5 +26,5 @@ 'sysctl' => $defaults, 'syslog' => $defaults, } - + # lint:endignore } From 11973c65b7e3c767e81101ec40f2a5935596caaa Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:15:38 +0100 Subject: [PATCH 02/51] cleanup .fixtures.yml --- .fixtures.yml | 46 ++++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 5985d6b..f6fbc10 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,34 +1,16 @@ fixtures: repositories: - stdlib: - repo: git://github.com/puppetlabs/puppetlabs-stdlib.git - ref: 4.1.0 - augeasproviders_core: - repo: git://github.com/hercules-team/augeasproviders_core.git - augeasproviders_apache: - repo: git://github.com/hercules-team/augeasproviders_apache.git - augeasproviders_grub: - repo: git://github.com/hercules-team/augeasproviders_grub.git - mount_providers: - repo: git://github.com/puppetlabs/puppetlabs-mount_providers.git - ref: 0.0.2 - augeasproviders_mounttab: - repo: git://github.com/hercules-team/augeasproviders_mounttab.git - augeasproviders_nagios: - repo: git://github.com/hercules-team/augeasproviders_nagios.git - augeasproviders_pam: - repo: git://github.com/hercules-team/augeasproviders_pam.git - augeasproviders_postgresql: - repo: git://github.com/hercules-team/augeasproviders_postgresql.git - augeasproviders_puppet: - repo: git://github.com/hercules-team/augeasproviders_puppet.git - augeasproviders_shellvar: - repo: git://github.com/hercules-team/augeasproviders_shellvar.git - augeasproviders_ssh: - repo: git://github.com/hercules-team/augeasproviders_ssh.git - augeasproviders_sysctl: - repo: git://github.com/hercules-team/augeasproviders_sysctl.git - augeasproviders_syslog: - repo: git://github.com/hercules-team/augeasproviders_syslog.git - symlinks: - "augeasproviders": "#{source_dir}" + stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git + augeasproviders_core: https://github.com/voxpupuli/puppet-augeasproviders_core.git + augeasproviders_apache: https://github.com/voxpupuli/puppet-augeasproviders_apache.git + augeasproviders_grub: https://github.com/voxpupuli/puppet-augeasproviders_grub.git + mount_providers: https://github.com/puppetlabs/puppetlabs-mount_providers.git + augeasproviders_mounttab: https://github.com/voxpupuli/puppet-augeasproviders_mounttab.git + augeasproviders_nagios: https://github.com/voxpupuli/puppet-augeasproviders_nagios.git + augeasproviders_pam: https://github.com/voxpupuli/puppet-augeasproviders_pam.git + augeasproviders_postgresql: https://github.com/voxpupuli/puppet-augeasproviders_postgresql.git + augeasproviders_puppet: https://github.com/voxpupuli/puppet-augeasproviders_puppet.git + augeasproviders_shellvar: https://github.com/voxpupuli/puppet-augeasproviders_shellvar.git + augeasproviders_ssh: https://github.com/voxpupuli/puppet-augeasproviders_ssh.git + augeasproviders_sysctl: https://github.com/voxpupuli/puppet-augeasproviders_sysctl.git + augeasproviders_syslog: https://github.com/voxpupuli/puppet-augeasproviders_syslog.git From d87eade2dc0a15b50ee7ee5f92f88cbfcd39f15f Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:20:01 +0100 Subject: [PATCH 03/51] delete legacy nodesets --- spec/acceptance/nodesets/centos-65-x64.yml | 11 ----------- spec/acceptance/nodesets/default.yml | 11 ----------- 2 files changed, 22 deletions(-) delete mode 100644 spec/acceptance/nodesets/centos-65-x64.yml delete mode 100644 spec/acceptance/nodesets/default.yml diff --git a/spec/acceptance/nodesets/centos-65-x64.yml b/spec/acceptance/nodesets/centos-65-x64.yml deleted file mode 100644 index 1ef6615..0000000 --- a/spec/acceptance/nodesets/centos-65-x64.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - centos-65-x64: - roles: - - master - platform: el-6-x86_64 - box : centos-65-x64-virtualbox-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box - hypervisor : vagrant -CONFIG: - log_level: debug - type: foss diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml deleted file mode 100644 index 1ef6615..0000000 --- a/spec/acceptance/nodesets/default.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - centos-65-x64: - roles: - - master - platform: el-6-x86_64 - box : centos-65-x64-virtualbox-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box - hypervisor : vagrant -CONFIG: - log_level: debug - type: foss From 834ecadd6fd7b02ed6ce08818448cb0030be5b0f Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:20:12 +0100 Subject: [PATCH 04/51] rubocop safe autofix --- .../augeasproviders_instances_spec.rb | 22 +++++----- .../classes/augeasproviders_instances_spec.rb | 43 +++++++++--------- spec/spec_helper_acceptance.rb | 9 ++-- spec/support/apache_directive.rb | 35 ++++++++------- spec/support/apache_setenv.rb | 33 +++++++------- spec/support/host.rb | 32 +++++++------- spec/support/kernel_parameter.rb | 30 +++++++------ spec/support/mailalias.rb | 32 +++++++------- spec/support/mounttab.rb | 36 ++++++++------- spec/support/nrpe_command.rb | 32 +++++++------- spec/support/pam.rb | 44 ++++++++++--------- spec/support/pg_hba.rb | 40 +++++++++-------- spec/support/puppet_auth.rb | 34 +++++++------- spec/support/shellvar.rb | 36 ++++++++------- spec/support/ssh_config.rb | 32 +++++++------- spec/support/sshd_config.rb | 32 +++++++------- spec/support/sshd_config_subsystem.rb | 32 +++++++------- spec/support/sysctl.rb | 32 +++++++------- spec/support/syslog.rb | 38 ++++++++-------- spec/support/validate_hash.rb | 16 ++++--- 20 files changed, 340 insertions(+), 300 deletions(-) diff --git a/spec/acceptance/augeasproviders_instances_spec.rb b/spec/acceptance/augeasproviders_instances_spec.rb index 3bb0a35..519089a 100644 --- a/spec/acceptance/augeasproviders_instances_spec.rb +++ b/spec/acceptance/augeasproviders_instances_spec.rb @@ -1,36 +1,38 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'augeasproviders::instances class' do context 'when sysctl_hash is defined' do - it 'should run successfully' do - pp =<<-EOS + it 'runs successfully' do + pp = <<-EOS class { 'augeasproviders::instances': sysctl_hash => { 'net.ipv4.ip_forward' => { 'value' => '1' } }, } EOS - apply_manifest(pp, :catch_failures => true) - expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + apply_manifest(pp, catch_failures: true) + expect(apply_manifest(pp, catch_failures: true).exit_code).to be_zero end describe linux_kernel_parameter('net.ipv4.ip_forward') do - its(:value) { should eq 1 } + its(:value) { is_expected.to eq 1 } end end context 'when augeasproviders_sysctl_hash is defined' do - it 'should run successfully' do - pp =<<-EOS + it 'runs successfully' do + pp = <<-EOS $augeasproviders_sysctl_hash = { 'net.ipv4.ip_forward' => { 'value' => '0' } } class { 'augeasproviders::instances': } EOS - apply_manifest(pp, :catch_failures => true) - expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + apply_manifest(pp, catch_failures: true) + expect(apply_manifest(pp, catch_failures: true).exit_code).to be_zero end describe linux_kernel_parameter('net.ipv4.ip_forward') do - its(:value) { should eq 0 } + its(:value) { is_expected.to eq 0 } end end end diff --git a/spec/classes/augeasproviders_instances_spec.rb b/spec/classes/augeasproviders_instances_spec.rb index ac1b5f3..16b220e 100644 --- a/spec/classes/augeasproviders_instances_spec.rb +++ b/spec/classes/augeasproviders_instances_spec.rb @@ -1,30 +1,33 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'augeasproviders::instances' do - it { should create_class('augeasproviders::instances') } - it { should contain_class('augeasproviders::params') } + it { is_expected.to create_class('augeasproviders::instances') } + it { is_expected.to contain_class('augeasproviders::params') } context "when resource_defaults => 'foo'" do - let(:params) {{ :resource_defaults => 'foo' }} - it { expect { should create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, /is not a Hash/) } + let(:params) { { resource_defaults: 'foo' } } + + it { expect { is_expected.to create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, %r{is not a Hash}) } end - [ - 'apache_directive', - 'apache_setenv', - 'host', - 'kernel_parameter', - 'mailalias', - 'mounttab', - 'nrpe_command', - 'pam', - 'pg_hba', - 'puppet_auth', - 'shellvar', - 'sshd_config', - 'sshd_config_subsystem', - 'sysctl', - 'syslog', + %w[ + apache_directive + apache_setenv + host + kernel_parameter + mailalias + mounttab + nrpe_command + pam + pg_hba + puppet_auth + shellvar + sshd_config + sshd_config_subsystem + sysctl + syslog ].each do |type| describe "#{type} instances" do include_context type diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 5ab57b6..748c1d3 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,7 +1,8 @@ +# frozen_string_literal: true require 'beaker-rspec/spec_helper' require 'beaker-rspec/helpers/serverspec' -hosts.each do |host| +hosts.each do |_host| # Install Puppet install_puppet end @@ -16,10 +17,10 @@ # Configure all nodes in nodeset c.before :suite do # Install module and dependencies - puppet_module_install(:source => proj_root, :module_name => 'augeasproviders') + puppet_module_install(source: proj_root, module_name: 'augeasproviders') hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs/stdlib'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module', 'install', 'puppetlabs/stdlib'), { acceptable_exit_codes: [0, 1] } end end -end \ No newline at end of file +end diff --git a/spec/support/apache_directive.rb b/spec/support/apache_directive.rb index 8d02eff..ca70487 100644 --- a/spec/support/apache_directive.rb +++ b/spec/support/apache_directive.rb @@ -1,35 +1,36 @@ +# frozen_string_literal: true + shared_examples_for 'apache_directive resource' do - it { should have_apache_directive_resource_count(1) } + it { is_expected.to have_apache_directive_resource_count(1) } it do - should contain_apache_directive('StartServers').only_with({ - 'name' => 'StartServers', - 'ensure' => 'present', - 'args' => '3', - 'target' => '/etc/httpd/conf/httpd.conf', - 'provider' => 'augeas', - }) + expect(subject).to contain_apache_directive('StartServers').only_with({ + 'name' => 'StartServers', + 'ensure' => 'present', + 'args' => '3', + 'target' => '/etc/httpd/conf/httpd.conf', + 'provider' => 'augeas', + }) end end shared_context 'apache_directive' do - it { should have_apache_directive_resource_count(0) } + it { is_expected.to have_apache_directive_resource_count(0) } let :example_params do - {'StartServers' => {'args' => '3', 'target' => '/etc/httpd/conf/httpd.conf'}} + { 'StartServers' => { 'args' => '3', 'target' => '/etc/httpd/conf/httpd.conf' } } end - context "when apache_directive_hash is a Hash" do - let(:params) {{ :apache_directive_hash => example_params }} - let(:facts) {{}} + context 'when apache_directive_hash is a Hash' do + let(:params) { { apache_directive_hash: example_params } } + let(:facts) { {} } include_examples 'apache_directive resource' end - context "when ::augeasproviders_apache_directive_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_apache_directive_hash => example_params }} - + context 'when ::augeasproviders_apache_directive_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_apache_directive_hash: example_params } } include_examples 'apache_directive resource' end diff --git a/spec/support/apache_setenv.rb b/spec/support/apache_setenv.rb index 5f4dcd9..50db5a9 100644 --- a/spec/support/apache_setenv.rb +++ b/spec/support/apache_setenv.rb @@ -1,34 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'apache_setenv resource' do - it { should have_apache_setenv_resource_count(1) } + it { is_expected.to have_apache_setenv_resource_count(1) } it do - should contain_apache_setenv('FOO').only_with({ - 'name' => 'FOO', - 'ensure' => 'present', - 'value' => 'bar', - 'provider' => 'augeas', - }) + expect(subject).to contain_apache_setenv('FOO').only_with({ + 'name' => 'FOO', + 'ensure' => 'present', + 'value' => 'bar', + 'provider' => 'augeas', + }) end end shared_context 'apache_setenv' do - it { should have_apache_setenv_resource_count(0) } + it { is_expected.to have_apache_setenv_resource_count(0) } let :example_params do - {'FOO' => {'value' => 'bar'}} + { 'FOO' => { 'value' => 'bar' } } end - context "when apache_setenv_hash is a Hash" do - let(:params) {{ :apache_setenv_hash => example_params }} - let(:facts) {{}} + context 'when apache_setenv_hash is a Hash' do + let(:params) { { apache_setenv_hash: example_params } } + let(:facts) { {} } include_examples 'apache_setenv resource' end - context "when ::augeasproviders_apache_setenv_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_apache_setenv_hash => example_params }} - + context 'when ::augeasproviders_apache_setenv_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_apache_setenv_hash: example_params } } include_examples 'apache_setenv resource' end diff --git a/spec/support/host.rb b/spec/support/host.rb index 1de346d..d712cd4 100644 --- a/spec/support/host.rb +++ b/spec/support/host.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'host resource' do - it { should have_host_resource_count(1) } + it { is_expected.to have_host_resource_count(1) } it do - should contain_host('foo').only_with({ - 'name' => 'foo', - 'ensure' => 'present', - 'ip' => '192.168.1.1', - 'provider' => 'augeas', - }) + expect(subject).to contain_host('foo').only_with({ + 'name' => 'foo', + 'ensure' => 'present', + 'ip' => '192.168.1.1', + 'provider' => 'augeas', + }) end end shared_context 'host' do - it { should have_host_resource_count(0) } + it { is_expected.to have_host_resource_count(0) } let :example_params do - {'foo' => {'ip' => '192.168.1.1'}} + { 'foo' => { 'ip' => '192.168.1.1' } } end - context "when host_hash is a Hash" do - let(:params) {{ :host_hash => example_params }} - let(:facts) {{}} + context 'when host_hash is a Hash' do + let(:params) { { host_hash: example_params } } + let(:facts) { {} } include_examples 'host resource' end - context "when ::augeasproviders_host_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_host_hash => example_params }} + context 'when ::augeasproviders_host_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_host_hash: example_params } } include_examples 'host resource' end diff --git a/spec/support/kernel_parameter.rb b/spec/support/kernel_parameter.rb index cfe8961..3ae9e7b 100644 --- a/spec/support/kernel_parameter.rb +++ b/spec/support/kernel_parameter.rb @@ -1,32 +1,34 @@ +# frozen_string_literal: true + shared_examples_for 'kernel_parameter resource' do - it { should have_kernel_parameter_resource_count(1) } + it { is_expected.to have_kernel_parameter_resource_count(1) } it do - should contain_kernel_parameter('elevator').only_with({ - 'name' => 'elevator', - 'ensure' => 'present', - 'value' => 'deadline', - }) + expect(subject).to contain_kernel_parameter('elevator').only_with({ + 'name' => 'elevator', + 'ensure' => 'present', + 'value' => 'deadline', + }) end end shared_context 'kernel_parameter' do - it { should have_kernel_parameter_resource_count(0) } + it { is_expected.to have_kernel_parameter_resource_count(0) } let :example_params do - {'elevator' => {'value' => 'deadline'}} + { 'elevator' => { 'value' => 'deadline' } } end - context "when kernel_parameter_hash is a Hash" do - let(:params) {{ :kernel_parameter_hash => example_params }} - let(:facts) {{}} + context 'when kernel_parameter_hash is a Hash' do + let(:params) { { kernel_parameter_hash: example_params } } + let(:facts) { {} } include_examples 'kernel_parameter resource' end - context "when ::augeasproviders_kernel_parameter_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_kernel_parameter_hash => example_params }} + context 'when ::augeasproviders_kernel_parameter_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_kernel_parameter_hash: example_params } } include_examples 'kernel_parameter resource' end diff --git a/spec/support/mailalias.rb b/spec/support/mailalias.rb index 6363716..8af6230 100644 --- a/spec/support/mailalias.rb +++ b/spec/support/mailalias.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'mailalias resource' do - it { should have_mailalias_resource_count(1) } + it { is_expected.to have_mailalias_resource_count(1) } it do - should contain_mailalias('foo').only_with({ - 'name' => 'foo', - 'ensure' => 'present', - 'recipient' => 'bar', - 'provider' => 'augeas', - }) + expect(subject).to contain_mailalias('foo').only_with({ + 'name' => 'foo', + 'ensure' => 'present', + 'recipient' => 'bar', + 'provider' => 'augeas', + }) end end shared_context 'mailalias' do - it { should have_mailalias_resource_count(0) } + it { is_expected.to have_mailalias_resource_count(0) } let :example_params do - {'foo' => {'recipient' => 'bar'}} + { 'foo' => { 'recipient' => 'bar' } } end - context "when mailalias_hash is a Hash" do - let(:params) {{ :mailalias_hash => example_params }} - let(:facts) {{}} + context 'when mailalias_hash is a Hash' do + let(:params) { { mailalias_hash: example_params } } + let(:facts) { {} } include_examples 'mailalias resource' end - context "when ::augeasproviders_mailalias_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_mailalias_hash => example_params }} + context 'when ::augeasproviders_mailalias_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_mailalias_hash: example_params } } include_examples 'mailalias resource' end diff --git a/spec/support/mounttab.rb b/spec/support/mounttab.rb index 1118a6e..baf4a96 100644 --- a/spec/support/mounttab.rb +++ b/spec/support/mounttab.rb @@ -1,35 +1,37 @@ +# frozen_string_literal: true + shared_examples_for 'mounttab resource' do - it { should have_mounttab_resource_count(1) } + it { is_expected.to have_mounttab_resource_count(1) } it do - should contain_mounttab('/mnt').only_with({ - 'name' => '/mnt', - 'ensure' => 'present', - 'device' => '/dev/myvg/mytest', - 'fstype' => 'ext4', - 'options' => 'defaults', - 'provider' => 'augeas', - }) + expect(subject).to contain_mounttab('/mnt').only_with({ + 'name' => '/mnt', + 'ensure' => 'present', + 'device' => '/dev/myvg/mytest', + 'fstype' => 'ext4', + 'options' => 'defaults', + 'provider' => 'augeas', + }) end end shared_context 'mounttab' do - it { should have_mounttab_resource_count(0) } + it { is_expected.to have_mounttab_resource_count(0) } let :example_params do - {'/mnt' => {'device' => '/dev/myvg/mytest', 'fstype' => 'ext4', 'options' => 'defaults'}} + { '/mnt' => { 'device' => '/dev/myvg/mytest', 'fstype' => 'ext4', 'options' => 'defaults' } } end - context "when mounttab_hash is a Hash" do - let(:params) {{ :mounttab_hash => example_params }} - let(:facts) {{}} + context 'when mounttab_hash is a Hash' do + let(:params) { { mounttab_hash: example_params } } + let(:facts) { {} } include_examples 'mounttab resource' end - context "when ::augeasproviders_mounttab_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_mounttab_hash => example_params }} + context 'when ::augeasproviders_mounttab_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_mounttab_hash: example_params } } include_examples 'mounttab resource' end diff --git a/spec/support/nrpe_command.rb b/spec/support/nrpe_command.rb index 259f611..a639654 100644 --- a/spec/support/nrpe_command.rb +++ b/spec/support/nrpe_command.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'nrpe_command resource' do - it { should have_nrpe_command_resource_count(1) } + it { is_expected.to have_nrpe_command_resource_count(1) } it do - should contain_nrpe_command('check_foo').only_with({ - 'name' => 'check_foo', - 'ensure' => 'present', - 'command' => '/usr/bin/check_foo', - 'provider' => 'augeas', - }) + expect(subject).to contain_nrpe_command('check_foo').only_with({ + 'name' => 'check_foo', + 'ensure' => 'present', + 'command' => '/usr/bin/check_foo', + 'provider' => 'augeas', + }) end end shared_context 'nrpe_command' do - it { should have_nrpe_command_resource_count(0) } + it { is_expected.to have_nrpe_command_resource_count(0) } let :example_params do - {'check_foo' => {'command' => '/usr/bin/check_foo'}} + { 'check_foo' => { 'command' => '/usr/bin/check_foo' } } end - context "when nrpe_command_hash is a Hash" do - let(:params) {{ :nrpe_command_hash => example_params }} - let(:facts) {{}} + context 'when nrpe_command_hash is a Hash' do + let(:params) { { nrpe_command_hash: example_params } } + let(:facts) { {} } include_examples 'nrpe_command resource' end - context "when ::augeasproviders_nrpe_command_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_nrpe_command_hash => example_params }} + context 'when ::augeasproviders_nrpe_command_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_nrpe_command_hash: example_params } } include_examples 'nrpe_command resource' end diff --git a/spec/support/pam.rb b/spec/support/pam.rb index 59ac2f9..bbe28ef 100644 --- a/spec/support/pam.rb +++ b/spec/support/pam.rb @@ -1,39 +1,41 @@ +# frozen_string_literal: true + shared_examples_for 'pam resource' do - it { should have_pam_resource_count(1) } + it { is_expected.to have_pam_resource_count(1) } it do - should contain_pam('Add pam_test.so to auth for system-auth').only_with({ - 'name' => 'Add pam_test.so to auth for system-auth', - 'service' => 'system-auth', - 'type' => 'auth', - 'control' => 'sufficient', - 'module' => 'pam_test.so', - 'arguments' => 'test_me_out', - 'position' => 'before module pam_deny.so', - 'target' => '/etc/pam.d/system-auth', - 'provider' => 'augeas', - 'ensure' => 'present', - }) + expect(subject).to contain_pam('Add pam_test.so to auth for system-auth').only_with({ + 'name' => 'Add pam_test.so to auth for system-auth', + 'service' => 'system-auth', + 'type' => 'auth', + 'control' => 'sufficient', + 'module' => 'pam_test.so', + 'arguments' => 'test_me_out', + 'position' => 'before module pam_deny.so', + 'target' => '/etc/pam.d/system-auth', + 'provider' => 'augeas', + 'ensure' => 'present', + }) end end shared_context 'pam' do - it { should have_pam_resource_count(0) } + it { is_expected.to have_pam_resource_count(0) } let :example_params do - { 'Add pam_test.so to auth for system-auth' => {'service' => 'system-auth', 'type' => 'auth', 'control' => 'sufficient', 'module' => 'pam_test.so', 'arguments' => 'test_me_out', 'position' => 'before module pam_deny.so', 'target' => '/etc/pam.d/system-auth', 'provider' => 'augeas', 'ensure' => 'present'}} + { 'Add pam_test.so to auth for system-auth' => { 'service' => 'system-auth', 'type' => 'auth', 'control' => 'sufficient', 'module' => 'pam_test.so', 'arguments' => 'test_me_out', 'position' => 'before module pam_deny.so', 'target' => '/etc/pam.d/system-auth', 'provider' => 'augeas', 'ensure' => 'present' } } end - context "when pam_hash is a Hash" do - let(:params) {{ :pam_hash => example_params }} - let(:facts) {{}} + context 'when pam_hash is a Hash' do + let(:params) { { pam_hash: example_params } } + let(:facts) { {} } include_examples 'pam resource' end - context "when ::augeasproviders_pam_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_pam_hash => example_params }} + context 'when ::augeasproviders_pam_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_pam_hash: example_params } } include_examples 'pam resource' end diff --git a/spec/support/pg_hba.rb b/spec/support/pg_hba.rb index 3b5aed8..e9fae48 100644 --- a/spec/support/pg_hba.rb +++ b/spec/support/pg_hba.rb @@ -1,37 +1,39 @@ +# frozen_string_literal: true + shared_examples_for 'pg_hba resource' do - it { should have_pg_hba_resource_count(1) } + it { is_expected.to have_pg_hba_resource_count(1) } it do - should contain_pg_hba('Default entry').only_with({ - 'name' => 'Default entry', - 'type' => 'local', - 'user' => 'all', - 'database' => 'all', - 'ensure' => 'present', - 'method' => 'md5', - 'target' => '/etc/postgresql/9.1/main/pg_hba.conf', - 'provider' => 'augeas', - }) + expect(subject).to contain_pg_hba('Default entry').only_with({ + 'name' => 'Default entry', + 'type' => 'local', + 'user' => 'all', + 'database' => 'all', + 'ensure' => 'present', + 'method' => 'md5', + 'target' => '/etc/postgresql/9.1/main/pg_hba.conf', + 'provider' => 'augeas', + }) end end shared_context 'pg_hba' do - it { should have_pg_hba_resource_count(0) } + it { is_expected.to have_pg_hba_resource_count(0) } let :example_params do - {'Default entry' => {'type' => 'local', 'user' => 'all', 'database' => 'all', 'method' => 'md5', 'target' => '/etc/postgresql/9.1/main/pg_hba.conf'}} + { 'Default entry' => { 'type' => 'local', 'user' => 'all', 'database' => 'all', 'method' => 'md5', 'target' => '/etc/postgresql/9.1/main/pg_hba.conf' } } end - context "when pg_hba_hash is a Hash" do - let(:params) {{ :pg_hba_hash => example_params }} - let(:facts) {{}} + context 'when pg_hba_hash is a Hash' do + let(:params) { { pg_hba_hash: example_params } } + let(:facts) { {} } include_examples 'pg_hba resource' end - context "when ::augeasproviders_pg_hba_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_pg_hba_hash => example_params }} + context 'when ::augeasproviders_pg_hba_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_pg_hba_hash: example_params } } include_examples 'pg_hba resource' end diff --git a/spec/support/puppet_auth.rb b/spec/support/puppet_auth.rb index 84ee014..3632fdb 100644 --- a/spec/support/puppet_auth.rb +++ b/spec/support/puppet_auth.rb @@ -1,34 +1,36 @@ +# frozen_string_literal: true + shared_examples_for 'puppet_auth resource' do - it { should have_puppet_auth_resource_count(1) } + it { is_expected.to have_puppet_auth_resource_count(1) } it do - should contain_puppet_auth('Deny /facts').only_with({ - 'name' => 'Deny /facts', - 'ensure' => 'present', - 'path' => '/facts', - 'authenticated' => 'any', - 'provider' => 'augeas', - }) + expect(subject).to contain_puppet_auth('Deny /facts').only_with({ + 'name' => 'Deny /facts', + 'ensure' => 'present', + 'path' => '/facts', + 'authenticated' => 'any', + 'provider' => 'augeas', + }) end end shared_context 'puppet_auth' do - it { should have_puppet_auth_resource_count(0) } + it { is_expected.to have_puppet_auth_resource_count(0) } let :example_params do - {'Deny /facts' => {'path' => '/facts', 'authenticated' => 'any'}} + { 'Deny /facts' => { 'path' => '/facts', 'authenticated' => 'any' } } end - context "when puppet_auth_hash is a Hash" do - let(:params) {{ :puppet_auth_hash => example_params }} - let(:facts) {{}} + context 'when puppet_auth_hash is a Hash' do + let(:params) { { puppet_auth_hash: example_params } } + let(:facts) { {} } include_examples 'puppet_auth resource' end - context "when ::augeasproviders_puppet_auth_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_puppet_auth_hash => example_params }} + context 'when ::augeasproviders_puppet_auth_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_puppet_auth_hash: example_params } } include_examples 'puppet_auth resource' end diff --git a/spec/support/shellvar.rb b/spec/support/shellvar.rb index 0095b3e..c5ed98e 100644 --- a/spec/support/shellvar.rb +++ b/spec/support/shellvar.rb @@ -1,35 +1,37 @@ +# frozen_string_literal: true + shared_examples_for 'shellvar resource' do - it { should have_shellvar_resource_count(1) } + it { is_expected.to have_shellvar_resource_count(1) } it do - should contain_shellvar('HOSTNAME').only_with({ - 'variable' => 'HOSTNAME', - 'name' => 'HOSTNAME', - 'ensure' => 'present', - 'target' => '/etc/sysconfig/network', - 'value' => 'host.example.com', - 'provider' => 'augeas', - }) + expect(subject).to contain_shellvar('HOSTNAME').only_with({ + 'variable' => 'HOSTNAME', + 'name' => 'HOSTNAME', + 'ensure' => 'present', + 'target' => '/etc/sysconfig/network', + 'value' => 'host.example.com', + 'provider' => 'augeas', + }) end end shared_context 'shellvar' do - it { should have_shellvar_resource_count(0) } + it { is_expected.to have_shellvar_resource_count(0) } let :example_params do - {'HOSTNAME' => {'target' => '/etc/sysconfig/network', 'value' => 'host.example.com'}} + { 'HOSTNAME' => { 'target' => '/etc/sysconfig/network', 'value' => 'host.example.com' } } end - context "when shellvar_hash is a Hash" do - let(:params) {{ :shellvar_hash => example_params }} - let(:facts) {{}} + context 'when shellvar_hash is a Hash' do + let(:params) { { shellvar_hash: example_params } } + let(:facts) { {} } include_examples 'shellvar resource' end - context "when ::augeasproviders_shellvar_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_shellvar_hash => example_params }} + context 'when ::augeasproviders_shellvar_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_shellvar_hash: example_params } } include_examples 'shellvar resource' end diff --git a/spec/support/ssh_config.rb b/spec/support/ssh_config.rb index 0764ba2..23f0b46 100644 --- a/spec/support/ssh_config.rb +++ b/spec/support/ssh_config.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'ssh_config resource' do - it { should have_ssh_config_resource_count(1) } + it { is_expected.to have_ssh_config_resource_count(1) } it do - should contain_ssh_config('HashKnownHosts').only_with({ - 'name' => 'HashKnownHosts', - 'ensure' => 'present', - 'value' => 'yes', - 'provider' => 'augeas', - }) + expect(subject).to contain_ssh_config('HashKnownHosts').only_with({ + 'name' => 'HashKnownHosts', + 'ensure' => 'present', + 'value' => 'yes', + 'provider' => 'augeas', + }) end end shared_context 'ssh_config' do - it { should have_ssh_config_resource_count(0) } + it { is_expected.to have_ssh_config_resource_count(0) } let :example_params do - {'HashKnownHosts' => {'value' => 'yes'}} + { 'HashKnownHosts' => { 'value' => 'yes' } } end - context "when ssh_config_hash is a Hash" do - let(:params) {{ :ssh_config_hash => example_params }} - let(:facts) {{}} + context 'when ssh_config_hash is a Hash' do + let(:params) { { ssh_config_hash: example_params } } + let(:facts) { {} } include_examples 'ssh_config resource' end - context "when ::augeasproviders_ssh_config_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_ssh_config_hash => example_params }} + context 'when ::augeasproviders_ssh_config_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_ssh_config_hash: example_params } } include_examples 'ssh_config resource' end diff --git a/spec/support/sshd_config.rb b/spec/support/sshd_config.rb index fee7a34..4961e41 100644 --- a/spec/support/sshd_config.rb +++ b/spec/support/sshd_config.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'sshd_config resource' do - it { should have_sshd_config_resource_count(1) } + it { is_expected.to have_sshd_config_resource_count(1) } it do - should contain_sshd_config('PermitRootLogin').only_with({ - 'name' => 'PermitRootLogin', - 'ensure' => 'present', - 'value' => 'yes', - 'provider' => 'augeas', - }) + expect(subject).to contain_sshd_config('PermitRootLogin').only_with({ + 'name' => 'PermitRootLogin', + 'ensure' => 'present', + 'value' => 'yes', + 'provider' => 'augeas', + }) end end shared_context 'sshd_config' do - it { should have_sshd_config_resource_count(0) } + it { is_expected.to have_sshd_config_resource_count(0) } let :example_params do - {'PermitRootLogin' => {'value' => 'yes'}} + { 'PermitRootLogin' => { 'value' => 'yes' } } end - context "when sshd_config_hash is a Hash" do - let(:params) {{ :sshd_config_hash => example_params }} - let(:facts) {{}} + context 'when sshd_config_hash is a Hash' do + let(:params) { { sshd_config_hash: example_params } } + let(:facts) { {} } include_examples 'sshd_config resource' end - context "when ::augeasproviders_sshd_config_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_sshd_config_hash => example_params }} + context 'when ::augeasproviders_sshd_config_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_sshd_config_hash: example_params } } include_examples 'sshd_config resource' end diff --git a/spec/support/sshd_config_subsystem.rb b/spec/support/sshd_config_subsystem.rb index 75848bb..3a1b0e6 100644 --- a/spec/support/sshd_config_subsystem.rb +++ b/spec/support/sshd_config_subsystem.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'sshd_config_subsystem resource' do - it { should have_sshd_config_subsystem_resource_count(1) } + it { is_expected.to have_sshd_config_subsystem_resource_count(1) } it do - should contain_sshd_config_subsystem('sftp').only_with({ - 'name' => 'sftp', - 'ensure' => 'present', - 'command' => '/usr/lib/openssh/sftp-server', - 'provider' => 'augeas', - }) + expect(subject).to contain_sshd_config_subsystem('sftp').only_with({ + 'name' => 'sftp', + 'ensure' => 'present', + 'command' => '/usr/lib/openssh/sftp-server', + 'provider' => 'augeas', + }) end end shared_context 'sshd_config_subsystem' do - it { should have_sshd_config_subsystem_resource_count(0) } + it { is_expected.to have_sshd_config_subsystem_resource_count(0) } let :example_params do - {'sftp' => {'command' => '/usr/lib/openssh/sftp-server'}} + { 'sftp' => { 'command' => '/usr/lib/openssh/sftp-server' } } end - context "when sshd_config_subsystem_hash is a Hash" do - let(:params) {{ :sshd_config_subsystem_hash => example_params }} - let(:facts) {{}} + context 'when sshd_config_subsystem_hash is a Hash' do + let(:params) { { sshd_config_subsystem_hash: example_params } } + let(:facts) { {} } include_examples 'sshd_config_subsystem resource' end - context "when ::augeasproviders_sshd_config_subsystem_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_sshd_config_subsystem_hash => example_params }} + context 'when ::augeasproviders_sshd_config_subsystem_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_sshd_config_subsystem_hash: example_params } } include_examples 'sshd_config_subsystem resource' end diff --git a/spec/support/sysctl.rb b/spec/support/sysctl.rb index 316a589..2a30961 100644 --- a/spec/support/sysctl.rb +++ b/spec/support/sysctl.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'sysctl resource' do - it { should have_sysctl_resource_count(1) } + it { is_expected.to have_sysctl_resource_count(1) } it do - should contain_sysctl('vm.foo').only_with({ - 'name' => 'vm.foo', - 'ensure' => 'present', - 'value' => '0', - 'provider' => 'augeas', - }) + expect(subject).to contain_sysctl('vm.foo').only_with({ + 'name' => 'vm.foo', + 'ensure' => 'present', + 'value' => '0', + 'provider' => 'augeas', + }) end end shared_context 'sysctl' do - it { should have_sysctl_resource_count(0) } + it { is_expected.to have_sysctl_resource_count(0) } let :example_params do - {'vm.foo' => {'value' => '0'}} + { 'vm.foo' => { 'value' => '0' } } end - context "when sysctl_hash is a Hash" do - let(:params) {{ :sysctl_hash => example_params }} - let(:facts) {{}} + context 'when sysctl_hash is a Hash' do + let(:params) { { sysctl_hash: example_params } } + let(:facts) { {} } include_examples 'sysctl resource' end - context "when ::augeasproviders_sysctl_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_sysctl_hash => example_params }} + context 'when ::augeasproviders_sysctl_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_sysctl_hash: example_params } } include_examples 'sysctl resource' end diff --git a/spec/support/syslog.rb b/spec/support/syslog.rb index 9cbac7c..1077baa 100644 --- a/spec/support/syslog.rb +++ b/spec/support/syslog.rb @@ -1,36 +1,38 @@ +# frozen_string_literal: true + shared_examples_for 'syslog resource' do - it { should have_syslog_resource_count(1) } + it { is_expected.to have_syslog_resource_count(1) } it do - should contain_syslog('foo').only_with({ - 'name' => 'foo', - 'ensure' => 'present', - 'facility' => 'local2', - 'level' => '*', - 'action_type' => 'file', - 'action' => '/var/log/foo.log', - 'provider' => 'augeas', - }) + expect(subject).to contain_syslog('foo').only_with({ + 'name' => 'foo', + 'ensure' => 'present', + 'facility' => 'local2', + 'level' => '*', + 'action_type' => 'file', + 'action' => '/var/log/foo.log', + 'provider' => 'augeas', + }) end end shared_context 'syslog' do - it { should have_syslog_resource_count(0) } + it { is_expected.to have_syslog_resource_count(0) } let :example_params do - {'foo' => {'facility' => 'local2', 'level' => '*', 'action_type' => 'file', 'action' => '/var/log/foo.log'}} + { 'foo' => { 'facility' => 'local2', 'level' => '*', 'action_type' => 'file', 'action' => '/var/log/foo.log' } } end - context "when syslog_hash is a Hash" do - let(:params) {{ :syslog_hash => example_params }} - let(:facts) {{}} + context 'when syslog_hash is a Hash' do + let(:params) { { syslog_hash: example_params } } + let(:facts) { {} } include_examples 'syslog resource' end - context "when ::augeasproviders_syslog_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_syslog_hash => example_params }} + context 'when ::augeasproviders_syslog_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_syslog_hash: example_params } } include_examples 'syslog resource' end diff --git a/spec/support/validate_hash.rb b/spec/support/validate_hash.rb index 8ded9a9..28fa7a4 100644 --- a/spec/support/validate_hash.rb +++ b/spec/support/validate_hash.rb @@ -1,15 +1,19 @@ +# frozen_string_literal: true + shared_examples_for 'validate_hash param' do |hash_param_name| context "when #{hash_param_name} => 'FOO'" do - let(:params) {{ hash_param_name.to_sym => 'FOO' }} - let(:facts) {{}} - it { expect { should create_class('augeasproviders') }.to raise_error(Puppet::Error, /is not a Hash/) } + let(:params) { { hash_param_name.to_sym => 'FOO' } } + let(:facts) { {} } + + it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{is not a Hash}) } end end shared_examples_for 'validate_hash top-scope param' do |hash_variable_name| context "when ::#{hash_variable_name} => 'FOO'" do - let(:params) {{}} - let(:facts) {{ hash_variable_name.to_sym => 'FOO' }} - it { expect { should create_class('augeasproviders') }.to raise_error(Puppet::Error, /is not a Hash/) } + let(:params) { {} } + let(:facts) { { hash_variable_name.to_sym => 'FOO' } } + + it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{is not a Hash}) } end end From f954706bff4c895567e220685bae21759126f77e Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:23:27 +0100 Subject: [PATCH 05/51] Purge trailing whitespace in docs --- README.md | 4 ++-- docs/development.md | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 82464fc..7421fab 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # augeasproviders: alternative Augeas-based providers for Puppet This module provides is a meta module which gathers all official augeasproviders -modules as dependencies. +modules as dependencies. Augeasproviders modules provide alternative Augeas-based providers for Puppet providers around config files, using the Augeas configuration library to read and modify them. @@ -42,7 +42,7 @@ The following example is the same as above but using a top-scope variable. $augeasproviders_sysctl_hash = { 'net.ipv4.ip_forward' => { 'value' => '1' }, } - + include augeasproviders::instances } diff --git a/docs/development.md b/docs/development.md index c46a73d..f981545 100644 --- a/docs/development.md +++ b/docs/development.md @@ -57,7 +57,7 @@ In the event that you need information from the resource itself in order to dete lens do |resource| resource[:lens] end - + ## Confining your provider @@ -74,7 +74,7 @@ The `augeasproviders` library can take care of automatically declaring some prov "$target/#{resource[:name]}" end -Using the `resource_path` method will automatically declare two provider methods: +Using the `resource_path` method will automatically declare two provider methods: * `exists?` (which checks if the resource path exists) * `destroy` (which removes the resource path and saves the tree) @@ -223,7 +223,7 @@ Augeas has two ways of representing array values in its trees, using either fix For this reason, property accessors offer 3 ways to manage arrays, using the `sublabel` option: * the values are all the nodes matching the path with the given label (`sublabel` not set), e.g. for `foo => ["bar", "baz"]`: - + attr_aug_accessor(:foo, :type => :array ) @@ -235,7 +235,7 @@ For this reason, property accessors offer 3 ways to manage arrays, using the `su { "foo" = "baz" } } * the values are sub-nodes of the path with the given label (`sublabel` set to the label of the sub-nodes), e.g. for `foo => ["bar", "baz"]`: - + attr_aug_accessor(:foo, :type => :array, :sublabel => 'sub' @@ -249,7 +249,7 @@ For this reason, property accessors offer 3 ways to manage arrays, using the `su { "sub" = "baz" } } } * the values are sequential entries under the path with the given label (`sublabel` set to `:seq`), e.g. for `foo => ["bar", "baz"]`: - + attr_aug_accessor(:foo, :type => :array, :sublabel => :seq @@ -267,7 +267,7 @@ In all cases, all existing values are purged before setting the target values. ##### Hash value -In the Augeas tree, hash values are represented by sub-nodes, with optional values (the `:sublabel` option is used to set the value node name). When no value is found in the tree, the accessor method will default to the value of the `:default` option. +In the Augeas tree, hash values are represented by sub-nodes, with optional values (the `:sublabel` option is used to set the value node name). When no value is found in the tree, the accessor method will default to the value of the `:default` option. For example, given `foo => { "a" => "bar", "b" => "baz" }`, with: From 9f126ad4286e1a11f72578dd4dfc5863d9dc7625 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:20:56 +0100 Subject: [PATCH 06/51] modulesync: manage spec_helper_acceptance.rb --- .sync.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .sync.yml diff --git a/.sync.yml b/.sync.yml new file mode 100644 index 0000000..5d21319 --- /dev/null +++ b/.sync.yml @@ -0,0 +1,3 @@ +--- +spec/spec_helper_acceptance.rb: + unmanaged: false From baa44ffd5bd37c2f7d7052307d86bf68d48c4e1c Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:26:23 +0100 Subject: [PATCH 07/51] spec_helper.rb: Load shared examples --- .sync.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.sync.yml b/.sync.yml index 5d21319..c74bf2e 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,3 +1,6 @@ --- spec/spec_helper_acceptance.rb: unmanaged: false +spec/spec_helper.rb: + spec_overrides: + - "Dir[\"#{__dir__}/support/**/*.rb\"].sort.each { |f| require f }" From 389d7ab3b34978c7eb376bb3beb4b02c88bfef12 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 13:47:09 +0100 Subject: [PATCH 08/51] modulesync 5.1.0 --- .editorconfig | 15 ++ .github/CONTRIBUTING.md | 252 +++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE.md | 26 ++++ .github/PULL_REQUEST_TEMPLATE.md | 20 +++ .github/SECURITY.md | 3 + .github/workflows/ci.yml | 90 +++++++++++ .github/workflows/release.yml | 34 +++++ .gitignore | 49 +++--- .msync.yml | 5 + .overcommit.yml | 65 ++++++++ .pmtignore | 37 +++++ .puppet-lint.rc | 3 + .rspec | 5 + .rspec_parallel | 4 + .rubocop.yml | 6 + .travis.yml | 68 --------- .yardopts | 17 --- CONTRIBUTING.md | 56 ------- Dockerfile | 24 +++ Gemfile | 61 ++++---- Rakefile | 92 ++++++++--- spec/spec_helper.rb | 51 ++----- spec/spec_helper_acceptance.rb | 26 +--- 23 files changed, 723 insertions(+), 286 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/SECURITY.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .msync.yml create mode 100644 .overcommit.yml create mode 100644 .pmtignore create mode 100644 .puppet-lint.rc create mode 100644 .rspec create mode 100644 .rspec_parallel create mode 100644 .rubocop.yml delete mode 100644 .travis.yml delete mode 100644 .yardopts delete mode 100644 CONTRIBUTING.md create mode 100644 Dockerfile diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ecb10a8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# editorconfig.org + +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +tab_width = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..048d2b5 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,252 @@ +# Contribution guidelines + +## Table of contents + +* [Contributing](#contributing) +* [Writing proper commits - short version](#writing-proper-commits-short-version) +* [Writing proper commits - long version](#writing-proper-commits-long-version) +* [Dependencies](#dependencies) + * [Note for OS X users](#note-for-os-x-users) +* [The test matrix](#the-test-matrix) +* [Syntax and style](#syntax-and-style) +* [Running the unit tests](#running-the-unit-tests) +* [Unit tests in docker](#unit-tests-in-docker) +* [Integration tests](#integration-tests) + +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little more quickly. + +## Contributing + +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +[Contributor Code of Conduct](https://voxpupuli.org/coc/). + +* Fork the repo. +* Create a separate branch for your change. +* We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. +* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. +* Squash your commits down into logical components. Make sure to rebase against our current master. +* Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review your code. + +Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! + +## Writing proper commits - short version + +* Make commits of logical units. +* Check for unnecessary whitespace with "git diff --check" before committing. +* Commit using Unix line endings (check the settings around "crlf" in git-config(1)). +* Do not check in commented out code or unneeded files. +* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. +* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". +* The body should provide a meaningful commit message, which: + *uses the imperative, present tense: `change`, not `changed` or `changes`. + * includes motivation for the change, and contrasts its implementation with the previous behavior. + * Make sure that you have tests for the bug you are fixing, or feature you are adding. + * Make sure the test suites passes after your commit: + * When introducing a new feature, make sure it is properly documented in the README.md + +## Writing proper commits - long version + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on `master`. + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +By default the tests use a baseline version of Puppet. + +If you have Ruby 2.x or want a specific version of Puppet, +you must set an environment variable such as: + +```sh +export PUPPET_VERSION="~> 5.5.6" +``` + +You can install all needed gems for spec tests into the modules directory by +running: + +```sh +bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" +``` + +If you also want to run acceptance tests: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +``` + +Our all in one solution if you don't know if you need to install or update gems: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +``` + +As an alternative to the `--jobs "$(nproc)` parameter, you can set an +environment variable: + +```sh +BUNDLE_JOBS="$(nproc)" +``` + +### Note for OS X users + +`nproc` isn't a valid command under OS x. As an alternative, you can do: + +```sh +--jobs "$(sysctl -n hw.ncpu)" +``` + +## The test matrix + +### Syntax and style + +The test suite will run [Puppet Lint](http://puppet-lint.com/) and +[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to +check various syntax and style things. You can run these locally with: + +```sh +bundle exec rake lint +bundle exec rake validate +``` + +It will also run some [Rubocop](http://batsov.com/rubocop/) tests +against it. You can run those locally ahead of time with: + +```sh +bundle exec rake rubocop +``` + +### Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. + +To run the linter, the syntax checker and the unit tests: + +```sh +bundle exec rake test +``` + +To run your all the unit tests + +```sh +bundle exec rake spec +``` + +To run a specific spec test set the `SPEC` variable: + +```sh +bundle exec rake spec SPEC=spec/foo_spec.rb +``` + +#### Unit tests in docker + +Some people don't want to run the dependencies locally or don't want to install +ruby. We ship a Dockerfile that enables you to run all unit tests and linting. +You only need to run: + +```sh +docker build . +``` + +Please ensure that a docker daemon is running and that your user has the +permission to talk to it. You can specify a remote docker host by setting the +`DOCKER_HOST` environment variable. it will copy the content of the module into +the docker image. So it will not work if a Gemfile.lock exists. + +### Integration tests + +The unit tests just check the code runs, not that it does exactly what +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +This fires up a new virtual machine (using vagrant) and runs a series of +simple tests against it after applying the module. You can run this +with: + +```sh +BEAKER_setfile=debian10-x64 bundle exec rake beaker +``` + +You can replace the string `debian10` with any common operating system. +The following strings are known to work: + +* ubuntu1604 +* ubuntu1804 +* ubuntu2004 +* debian9 +* debian10 +* centos7 +* centos8 + +For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). + +The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) +repository. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..593e7aa --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..342807b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..cacadf2 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Vox Pupuli Security Policy + +Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d08d05e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: CI + +on: pull_request + +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + +jobs: + setup_matrix: + name: 'Setup Test Matrix' + runs-on: ubuntu-latest + timeout-minutes: 40 + outputs: + puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} + github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} + env: + BUNDLE_WITHOUT: development:system_tests:release + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Run static validations + run: bundle exec rake validate lint check + - name: Run rake rubocop + run: bundle exec rake rubocop + - name: Setup Test Matrix + id: get-outputs + run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false + + unit: + needs: setup_matrix + runs-on: ubuntu-latest + timeout-minutes: 40 + strategy: + fail-fast: false + matrix: + include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} + env: + BUNDLE_WITHOUT: development:system_tests:release + PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" + name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake parallel_spec + + acceptance: + needs: setup_matrix + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: development:test:release + strategy: + fail-fast: false + matrix: + include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} + name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} + BEAKER_setfile: ${{ matrix.setfile.value }} + + tests: + needs: + - unit + - acceptance + runs-on: ubuntu-latest + name: Test suite + steps: + - run: echo Test suite completed diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..664ba69 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: development:test:system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + if: github.repository_owner == 'voxpupuli' + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Build and Deploy + env: + # Configure secrets here: + # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets + BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' + BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' + run: bundle exec rake module:push diff --git a/.gitignore b/.gitignore index 94145ab..9b95224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,23 @@ -pkg -coverage +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +pkg/ +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ .bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ .librarian/ -.tmp/ -modules/ -_site/ -spec/fixtures/manifests -spec/fixtures/modules -yardoc/ +Puppetfile.lock +*.iml +.*.sw? .yardoc/ - -## Ruby -.rvmrc* -.rbenv* -.ruby-* - -## MAC OS -.DS_Store - -## TEXTMATE -*.tmproj -tmtags - -## EMACS -*~ -\#* -.\#* - -## VIM -*.swp -tags +Guardfile diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 0000000..a83abd9 --- /dev/null +++ b/.msync.yml @@ -0,0 +1,5 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +modulesync_config_version: '5.1.0' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 0000000..d367ada --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,65 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + PuppetLint: + enabled: true + description: 'Runs puppet-lint on modified files only' + command: ['bundle', 'exec', 'puppet-lint'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'validate' + - 'test' + - 'rubocop' + command: ['bundle', 'exec', 'rake'] diff --git a/.pmtignore b/.pmtignore new file mode 100644 index 0000000..65f5051 --- /dev/null +++ b/.pmtignore @@ -0,0 +1,37 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +docs/ +pkg/ +Gemfile +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/ +Rakefile +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.github/ +.librarian/ +Puppetfile.lock +*.iml +.editorconfig +.fixtures.yml +.gitignore +.msync.yml +.overcommit.yml +.pmtignore +.rspec +.rspec_parallel +.rubocop.yml +.sync.yml +.*.sw? +.yardoc/ +.yardopts +Dockerfile diff --git a/.puppet-lint.rc b/.puppet-lint.rc new file mode 100644 index 0000000..dd8272c --- /dev/null +++ b/.puppet-lint.rc @@ -0,0 +1,3 @@ +--fail-on-warnings +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..f634583 --- /dev/null +++ b/.rspec @@ -0,0 +1,5 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +--format documentation +--color diff --git a/.rspec_parallel b/.rspec_parallel new file mode 100644 index 0000000..a9a84f8 --- /dev/null +++ b/.rspec_parallel @@ -0,0 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +--format progress diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..53ac189 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,6 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +inherit_gem: + voxpupuli-test: rubocop.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 25b0d39..0000000 --- a/.travis.yml +++ /dev/null @@ -1,68 +0,0 @@ -language: ruby -rvm: - - 2.0.0 -notifications: - email: - - dcleal@redhat.com - - raphael.pinson@camptocamp.com -env: - # Most tests with oldest supported ruby-augeas - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=3.0.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=3.2.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - # Test the latest ruby-augeas (~>) - - PUPPET=3.2.0 RUBY_AUGEAS=0.5 - - PUPPET=3.4 RUBY_AUGEAS=0.5 - # Test other versions of Augeas - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=0.10.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=0.10.0 - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.2.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.2.0 - # Issue #83: test old Augeas with new lenses - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 LENSES=HEAD - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 LENSES=HEAD - - PUPPET=3.4 RUBY_AUGEAS=0.5 AUGEAS=1.0.0 LENSES=HEAD - - PUPPET=3.4 RUBY_AUGEAS=0.5 AUGEAS=1.1.0 LENSES=HEAD -matrix: - fast_finish: true - exclude: - # No support for Ruby 2.0 before Puppet 3.2.0 and ruby-augeas 0.5 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - rvm: 2.0.0 - env: PUPPET=3.0.0 RUBY_AUGEAS=0.3.0 - - rvm: 2.0.0 - env: PUPPET=3.2.0 RUBY_AUGEAS=0.3.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=0.10.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=0.10.0 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.2.0 - - rvm: 2.0.0 - env: PUPPET=3.0.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.2.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 LENSES=HEAD - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 LENSES=HEAD -install: - - "travis_retry ./.travis.sh" -script: - - AUGEAS_LENS_LIB=augeas/lenses bundle exec rake diff --git a/.yardopts b/.yardopts deleted file mode 100644 index ae42c20..0000000 --- a/.yardopts +++ /dev/null @@ -1,17 +0,0 @@ ---protected ---private ---verbose ---markup markdown ---readme README.md ---tag status ---transitive-tag status ---tag comment ---hide-tag comment ---tag dsl:"DSL" ---no-transitive-tag api ---template-path yardoc/templates ---api public ---api private ---hide-void-return ---output-dir yardoc/ -lib/augeasproviders/**/*.rb diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 5e3dff2..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,56 +0,0 @@ -# Contributing to augeasproviders - -[![Build Status](https://secure.travis-ci.org/hercules-team/augeasproviders.png?branch=master)](http://travis-ci.org/hercules-team/augeasproviders) - -## Writing tests - -Tests for a `typename` provider live at `spec/unit/puppet/typename_spec.rb` and -their corresponding fixture (starting file) under -`spec/fixture/unit/puppet/typename/`. - -Use an rspec context section per fixture and have multiple examples within the -section using it. - -Tests use real resources which are applied via the -`AugeasSpec::Fixtures::apply` method to a temporary file created from the -original fixture. Once applied, the temporary file is tested using one of -two methods: - -1. Load file with ruby-augeas (`aug_open` helper) and perform match/get queries -to test particular features of the tree. -1. Define whole or part of the tree in augparse `{ }` syntax and use `augparse` -or `augparse_filter` helpers to compare the file against the expected tree. - -The latter will be much easier and more robust as it will compare all aspects -of the tree, while the first might be needed for some edge cases (empty files -etc). - -See also this writeup on [testing techniques for Puppet providers using -Augeas](http://m0dlx.com/blog/Testing_techniques_for_Puppet_providers_using_Augeas.html) -which shows this process for augeasproviders. - -Execute `rake spec` in the root directory to run all tests. - -## Thoughts about testing methods - -After applying the resource, there are a few ways we could test the results of -the file. - -* use augparse? No API today, could generate module file and shell out. -* use Config::Augeas::Validator? Need to write separate rules, no rootdir - support and is Perl, not Ruby. -* use XML comparison? No ruby-augeas support for aug_to_xml. -* use ruby-augeas? Using this as we can test for specific nodes, values etc - and compare with rspec. -* use File.read + rspec? Comparing the whole file will be a problem if Augeas - lenses change whitespace. - -## Requirements - -Install bundler and run `bundle install` to get all gems required for -development or see the contents of Gemfile. - -## Patches - -Please send pull requests via GitHub, or patches via git send-email to the -author. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e3cf307 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# MANAGED BY MODULESYNC +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +FROM ruby:2.7 + +WORKDIR /opt/puppet + +# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 +RUN mkdir -p /etc/sv + +ARG PUPPET_VERSION="~> 6.0" +ARG PARALLEL_TEST_PROCESSORS=4 + +# Cache gems +COPY Gemfile . +RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} + +COPY . . + +RUN bundle install +RUN bundle exec rake release_checks + +# Container should not saved +RUN exit 1 diff --git a/Gemfile b/Gemfile index dff3d52..b6dcf45 100644 --- a/Gemfile +++ b/Gemfile @@ -1,37 +1,34 @@ -source 'https://rubygems.org' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -if ENV.key?('PUPPET') - puppetversion = "~> #{ENV['PUPPET']}" -else - puppetversion = ['>= 2.7'] -end -gem 'puppet', puppetversion - -if ENV.key?('RUBY_AUGEAS') - if ENV['RUBY_AUGEAS'] == '0.3.0' - # pre-0.4.1 versions aren't available on rubygems - rbaugversion = {:git => 'git://github.com/domcleal/ruby-augeas.git', :branch => '0.3.0-gem'} - else - rbaugversion = "~> #{ENV['RUBY_AUGEAS']}" - end -else - rbaugversion = ['~> 0.3'] +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +group :test do + gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 1.0', :require => false end -gem 'ruby-augeas', rbaugversion group :development do - gem 'puppet-lint' - gem 'puppet-syntax' - gem 'puppetlabs_spec_helper', '>= 0.4.1' - gem 'rake' - gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git', :ref => '544b168' - gem 'simplecov' - gem 'yard' - gem 'redcarpet', '~> 2.0' - gem 'pry' - gem 'beaker', :require => false, :git => 'https://github.com/puppetlabs/beaker', :ref => 'dbac20fe9' - gem 'beaker-rspec', :require => false - gem 'vagrant-wrapper', :require => false - - gem 'coveralls' unless RUBY_VERSION =~ /^1\.8/ + gem 'guard-rake', :require => false + gem 'overcommit', '>= 0.39.1', :require => false end + +group :system_tests do + gem 'voxpupuli-acceptance', '~> 1.0', :require => false +end + +group :release do + gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' + gem 'voxpupuli-release', '>= 1.2.0', :require => false + gem 'puppet-strings', '>= 2.2', :require => false +end + +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] + +puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +gem 'puppet', puppetversion, :require => false, :groups => [:test] + +# vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 8490143..f92f051 100644 --- a/Rakefile +++ b/Rakefile @@ -1,30 +1,72 @@ -require 'rubygems' -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet-lint/tasks/puppet-lint' -require 'yard' - -exclude_paths = [ - "pkg/**/*", - "vendor/**/*", - "spec/**/*", -] - -task :default => [:spec, :yard, :syntax, :lint] - -desc "Run acceptance tests" -RSpec::Core::RakeTask.new(:acceptance) do |t| - t.pattern = 'spec/acceptance' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end end -YARD::Rake::YardocTask.new do |t| - t.options = [] +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError end -# Disable puppet-lint checks -PuppetLint.configuration.send("disable_80chars") -PuppetLint.configuration.send("disable_class_inherits_from_params_class") +# load optional tasks for releases +# only available if gem group releases is installed +begin + require 'voxpupuli/release/rake_tasks' +rescue LoadError +end -# Ignore files outside this module -PuppetLint.configuration.ignore_paths = exclude_paths -PuppetSyntax.exclude_paths = exclude_paths +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__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' + end +end + +desc 'Generate REFERENCE.md' +task :reference, [:debug, :backtrace] do |t, args| + patterns = '' + Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) +end + +begin + require 'github_changelog_generator/task' + require 'puppet_blacksmith' + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + metadata = Blacksmith::Modulefile.new + config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ + config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} + config.user = 'voxpupuli' + config.project = metadata.metadata['name'] + end + + # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 + require 'rbconfig' + if RbConfig::CONFIG['host_os'] =~ /linux/ + task :changelog do + puts 'Fixing line endings...' + changelog_file = File.join(__dir__, 'CHANGELOG.md') + changelog_txt = File.read(changelog_file) + new_contents = changelog_txt.gsub(%r{\r\n}, "\n") + File.open(changelog_file, "w") {|file| file.puts new_contents } + end + end + +rescue LoadError +end +# vim: syntax=ruby diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 95b4c2b..270d176 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,44 +1,19 @@ -require 'pathname' -dir = Pathname.new(__FILE__).parent -$LOAD_PATH.unshift(dir, File.join(dir, 'fixtures/modules/augeasproviders_core/spec/lib'), File.join(dir, '..', 'lib')) +# frozen_string_literal: true -require 'rubygems' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -require 'simplecov' -unless RUBY_VERSION =~ /^1\.8/ - require 'coveralls' - SimpleCov.formatter = Coveralls::SimpleCov::Formatter -end -SimpleCov.start do - add_group "AugeasProviders Libs", "/lib/augeasproviders/" - add_group "Puppet Types", "/lib/puppet/type/" - add_group "Puppet Providers", "/lib/puppet/provider/" - add_group "Augeas Spec Lib", "/spec/lib/" - - add_filter "/spec/fixtures/" - add_filter "/spec/unit/" - add_filter "/spec/support/" -end - -require 'puppetlabs_spec_helper/module_spec_helper' -require 'augeas_spec' +# 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', __dir__)) -Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules') +require 'voxpupuli/test/spec_helper' -# There's no real need to make this version dependent, but it helps find -# regressions in Puppet -# -# 1. Workaround for issue #16277 where default settings aren't initialised from -# a spec and so the libdir is never initialised (3.0.x) -# 2. Workaround for 2.7.20 that now only loads types for the current node -# environment (#13858) so Puppet[:modulepath] seems to get ignored -# 3. Workaround for 3.5 where context hasn't been configured yet, -# ticket https://tickets.puppetlabs.com/browse/MODULES-823 -# -ver = Gem::Version.new(Puppet.version.split('-').first) -if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver - Dir["#{dir}/fixtures/modules/*/lib"].each { |l| $LOAD_PATH.unshift(l) } +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + facts&.each do |name, value| + add_custom_fact name.to_sym, value + end end -# Load all shared contexts and shared examples -Dir["#{dir}/support/**/*.rb"].sort.each {|f| require f} +Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 748c1d3..d3a6e23 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,26 +1,10 @@ # frozen_string_literal: true -require 'beaker-rspec/spec_helper' -require 'beaker-rspec/helpers/serverspec' -hosts.each do |_host| - # Install Puppet - install_puppet -end +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) +require 'voxpupuli/acceptance/spec_helper_acceptance' - # Readable test descriptions - c.formatter = :documentation +configure_beaker - # Configure all nodes in nodeset - c.before :suite do - # Install module and dependencies - puppet_module_install(source: proj_root, module_name: 'augeasproviders') - - hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs/stdlib'), { acceptable_exit_codes: [0, 1] } - end - end -end +Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f } From 386e705ec117e688efbc35303db06f4947e617d8 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 15:02:01 +0100 Subject: [PATCH 09/51] Drop EoL operating systems from metadata.json --- metadata.json | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/metadata.json b/metadata.json index 3ecc61b..8710005 100644 --- a/metadata.json +++ b/metadata.json @@ -66,34 +66,27 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "7", - "8", - "9" + "10", + "11" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04", - "16.04", "18.04", - "18.10", "20.04" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "6", "7", - "8", - "9" + "8" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "6", "7", "8", "9" @@ -122,7 +115,6 @@ { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "6", "7", "8" ] From 45a56e12006f1d7b57978d4bebb5e39f0b953c68 Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Sun, 14 Aug 2022 18:26:21 -0400 Subject: [PATCH 10/51] Update from voxpupuli modulesync_config --- .github/CONTRIBUTING.md | 7 ++- .github/workflows/ci.yml | 84 +++-------------------------------- .github/workflows/release.yml | 32 +++++-------- .msync.yml | 2 +- Dockerfile | 2 +- Gemfile | 6 +-- spec/spec_helper.rb | 2 + 7 files changed, 26 insertions(+), 109 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 048d2b5..8b466cf 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet, you must set an environment variable such as: ```sh -export PUPPET_VERSION="~> 5.5.6" +export PUPPET_GEM_VERSION="~> 6.1.0" ``` You can install all needed gems for spec tests into the modules directory by @@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian10-x64 bundle exec rake beaker +BEAKER_setfile=debian11-64 bundle exec rake beaker ``` You can replace the string `debian10` with any common operating system. The following strings are known to work: -* ubuntu1604 * ubuntu1804 * ubuntu2004 -* debian9 * debian10 +* debian11 * centos7 * centos8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d08d05e..8a07791 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,84 +7,12 @@ name: CI on: pull_request concurrency: - group: ${{ github.head_ref }} + group: ${{ github.ref_name }} cancel-in-progress: true jobs: - setup_matrix: - name: 'Setup Test Matrix' - runs-on: ubuntu-latest - timeout-minutes: 40 - outputs: - puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} - github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} - env: - BUNDLE_WITHOUT: development:system_tests:release - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run static validations - run: bundle exec rake validate lint check - - name: Run rake rubocop - run: bundle exec rake rubocop - - name: Setup Test Matrix - id: get-outputs - run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false - - unit: - needs: setup_matrix - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} - env: - BUNDLE_WITHOUT: development:system_tests:release - PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" - name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run tests - run: bundle exec rake parallel_spec - - acceptance: - needs: setup_matrix - runs-on: ubuntu-latest - env: - BUNDLE_WITHOUT: development:test:release - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} - name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run tests - run: bundle exec rake beaker - env: - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} - BEAKER_setfile: ${{ matrix.setfile.value }} - - tests: - needs: - - unit - - acceptance - runs-on: ubuntu-latest - name: Test suite - steps: - - run: echo Test suite completed + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + with: + pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 664ba69..15f1721 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,26 +9,14 @@ on: tags: - '*' -env: - BUNDLE_WITHOUT: development:test:system_tests - jobs: - deploy: - name: 'deploy to forge' - runs-on: ubuntu-latest - if: github.repository_owner == 'voxpupuli' - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Build and Deploy - env: - # Configure secrets here: - # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets - BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' - BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' - run: bundle exec rake module:push + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.msync.yml b/.msync.yml index a83abd9..0235385 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.1.0' +modulesync_config_version: '5.3.0' diff --git a/Dockerfile b/Dockerfile index e3cf307..8dd82d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /opt/puppet # https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 RUN mkdir -p /etc/sv -ARG PUPPET_VERSION="~> 6.0" +ARG PUPPET_GEM_VERSION="~> 6.0" ARG PARALLEL_TEST_PROCESSORS=4 # Cache gems diff --git a/Gemfile b/Gemfile index b6dcf45..07209b7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,10 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -source ENV['GEM_SOURCE'] || "https://rubygems.org" +source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -28,7 +28,7 @@ end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 270d176..86dd55f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,8 @@ require 'voxpupuli/test/spec_helper' +add_mocked_facts! + if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) facts&.each do |name, value| From d3cc92a6c50a77fcc1c7e4fd98d5293472fd4264 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 2 Oct 2022 14:28:22 +0200 Subject: [PATCH 11/51] modulesync 5.3.0 --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index f92f051..b88386b 100644 --- a/Rakefile +++ b/Rakefile @@ -52,7 +52,7 @@ begin config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.user = 'voxpupuli' - config.project = metadata.metadata['name'] + config.project = 'puppet-augeasproviders' end # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 From e2b296b10edee1a2c2bce15f2029d27a098154bb Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 20 Dec 2022 14:28:44 +0100 Subject: [PATCH 12/51] modulesync 5.4.0 --- .msync.yml | 2 +- Gemfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.msync.yml b/.msync.yml index 0235385..f3156d1 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.3.0' +modulesync_config_version: '5.4.0' diff --git a/Gemfile b/Gemfile index 07209b7..b3827ba 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 1.0', :require => false + gem 'puppet_metadata', '~> 2.0', :require => false end group :development do From 62553a2fd436d092e240dcf53cebf18199095f2f Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Sat, 15 Apr 2023 09:50:06 +0200 Subject: [PATCH 13/51] modulesync 5.5.0 --- .github/SECURITY.md | 3 --- .gitignore | 36 ++++++++++++------------- .msync.yml | 2 +- .pmtignore | 64 ++++++++++++++++++++++----------------------- Gemfile | 3 +-- Rakefile | 36 +++---------------------- 6 files changed, 56 insertions(+), 88 deletions(-) delete mode 100644 .github/SECURITY.md diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index cacadf2..0000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,3 +0,0 @@ -# Vox Pupuli Security Policy - -Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.gitignore b/.gitignore index 9b95224..84fd904 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,23 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -pkg/ -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.librarian/ -Puppetfile.lock +/pkg/ +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/ +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.librarian/ +/Puppetfile.lock *.iml .*.sw? -.yardoc/ -Guardfile +/.yardoc/ +/Guardfile diff --git a/.msync.yml b/.msync.yml index f3156d1..a4b0069 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.4.0' +modulesync_config_version: '5.5.0' diff --git a/.pmtignore b/.pmtignore index 65f5051..58a0408 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,37 +1,37 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -docs/ -pkg/ -Gemfile -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/ -Rakefile -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.github/ -.librarian/ -Puppetfile.lock +/docs/ +/pkg/ +/Gemfile +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/ +/Rakefile +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.github/ +/.librarian/ +/Puppetfile.lock *.iml -.editorconfig -.fixtures.yml -.gitignore -.msync.yml -.overcommit.yml -.pmtignore -.rspec -.rspec_parallel -.rubocop.yml -.sync.yml +/.editorconfig +/.fixtures.yml +/.gitignore +/.msync.yml +/.overcommit.yml +/.pmtignore +/.rspec +/.rspec_parallel +/.rubocop.yml +/.sync.yml .*.sw? -.yardoc/ -.yardopts -Dockerfile +/.yardoc/ +/.yardopts +/Dockerfile diff --git a/Gemfile b/Gemfile index b3827ba..15313c3 100644 --- a/Gemfile +++ b/Gemfile @@ -21,8 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.2.0', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'voxpupuli-release', '~> 2.0', :require => false end gem 'rake', :require => false diff --git a/Rakefile b/Rakefile index b88386b..fc01f6b 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,10 @@ end begin require 'voxpupuli/release/rake_tasks' rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = 'voxpupuli' + GCGConfig.project = 'puppet-augeasproviders' end desc "Run main 'test' task and report merged results to coveralls" @@ -37,36 +41,4 @@ task test_with_coveralls: [:test] do end end -desc 'Generate REFERENCE.md' -task :reference, [:debug, :backtrace] do |t, args| - patterns = '' - Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) -end - -begin - require 'github_changelog_generator/task' - require 'puppet_blacksmith' - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - metadata = Blacksmith::Modulefile.new - config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ - config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." - config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} - config.user = 'voxpupuli' - config.project = 'puppet-augeasproviders' - end - - # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 - require 'rbconfig' - if RbConfig::CONFIG['host_os'] =~ /linux/ - task :changelog do - puts 'Fixing line endings...' - changelog_file = File.join(__dir__, 'CHANGELOG.md') - changelog_txt = File.read(changelog_file) - new_contents = changelog_txt.gsub(%r{\r\n}, "\n") - File.open(changelog_file, "w") {|file| file.puts new_contents } - end - end - -rescue LoadError -end # vim: syntax=ruby From 1091b7091467a9dba9966d91e30b4543ee9ee892 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 May 2023 10:42:41 +0200 Subject: [PATCH 14/51] modulesync 6.0.0 --- .msync.yml | 2 +- Gemfile | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.msync.yml b/.msync.yml index a4b0069..b929160 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.5.0' +modulesync_config_version: '6.0.0' diff --git a/Gemfile b/Gemfile index 15313c3..98a04cf 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.4', :require => false + gem 'voxpupuli-test', '~> 6.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 2.0', :require => false + gem 'puppet_metadata', '~> 3.0', :require => false end group :development do @@ -16,18 +16,19 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 1.0', :require => false + gem 'voxpupuli-acceptance', '~> 2.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '~> 2.0', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false + gem 'faraday-retry', '~> 2.1', :require => false end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From f707c980641aa709edf54eff851d4d1438a6051b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 17 Aug 2023 14:21:29 +0200 Subject: [PATCH 15/51] modulesync 7.0.0 --- .github/CONTRIBUTING.md | 11 +++++++---- .msync.yml | 2 +- Gemfile | 2 +- spec/spec_helper.rb | 1 + spec/spec_helper_acceptance.rb | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cf..6aaa603 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian11-64 bundle exec rake beaker +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` -You can replace the string `debian10` with any common operating system. +You can replace the string `debian11` with any common operating system. The following strings are known to work: -* ubuntu1804 * ubuntu2004 -* debian10 +* ubuntu2204 * debian11 * centos7 * centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). diff --git a/.msync.yml b/.msync.yml index b929160..dd3e957 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '6.0.0' +modulesync_config_version: '7.0.0' diff --git a/Gemfile b/Gemfile index 98a04cf..db21d3b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 6.0', :require => false + gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 3.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 86dd55f..fe60acb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,3 +19,4 @@ end Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f } +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d3a6e23..2681792 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -5,6 +5,6 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' -configure_beaker +configure_beaker(modules: :metadata) Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f } From fe5cf8b6e7adcbfdb85b94b7364e409612915113 Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Fri, 22 Sep 2023 13:25:02 +0200 Subject: [PATCH 16/51] WARNING: lint:endignore comment with no opening lint:ignore: comment found on line 29 --- manifests/params.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 596932c..59f8406 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -26,5 +26,4 @@ 'sysctl' => $defaults, 'syslog' => $defaults, } - # lint:endignore } From 485325dc7c5b3606f23edc4cc3e4e719f2a6fb4f Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Fri, 22 Sep 2023 13:44:27 +0200 Subject: [PATCH 17/51] Error messages changed since stronger typing added --- spec/classes/augeasproviders_instances_spec.rb | 2 +- spec/support/validate_hash.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/classes/augeasproviders_instances_spec.rb b/spec/classes/augeasproviders_instances_spec.rb index 16b220e..af369e3 100644 --- a/spec/classes/augeasproviders_instances_spec.rb +++ b/spec/classes/augeasproviders_instances_spec.rb @@ -9,7 +9,7 @@ context "when resource_defaults => 'foo'" do let(:params) { { resource_defaults: 'foo' } } - it { expect { is_expected.to create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, %r{is not a Hash}) } + it { expect { is_expected.to create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, %r{expects a Hash value, got String}) } end %w[ diff --git a/spec/support/validate_hash.rb b/spec/support/validate_hash.rb index 28fa7a4..ba10d71 100644 --- a/spec/support/validate_hash.rb +++ b/spec/support/validate_hash.rb @@ -5,7 +5,7 @@ let(:params) { { hash_param_name.to_sym => 'FOO' } } let(:facts) { {} } - it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{is not a Hash}) } + it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{expects a Hash value, got String}) } end end @@ -14,6 +14,6 @@ let(:params) { {} } let(:facts) { { hash_variable_name.to_sym => 'FOO' } } - it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{is not a Hash}) } + it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{expects a Hash value, got String}) } end end From bc98ab1450e828bf6a50cc23fc354c3f8ef1a6cb Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 15 Dec 2023 11:46:33 +0100 Subject: [PATCH 18/51] modulesync 7.2.0 --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- .msync.yml | 2 +- .pmtignore | 1 + Gemfile | 8 +++----- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a07791..b66d8ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,6 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 with: pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15f1721..55324aa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index dd3e957..f818344 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.0.0' +modulesync_config_version: '7.2.0' diff --git a/.pmtignore b/.pmtignore index 58a0408..10b9830 100644 --- a/.pmtignore +++ b/.pmtignore @@ -35,3 +35,4 @@ /.yardoc/ /.yardopts /Dockerfile +/HISTORY.md diff --git a/Gemfile b/Gemfile index db21d3b..a4a3b20 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 3.0', :require => false + gem 'puppet_metadata', '~> 3.5', :require => false end group :development do @@ -16,13 +16,11 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 2.0', :require => false + gem 'voxpupuli-acceptance', '~> 3.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false - gem 'voxpupuli-release', '~> 3.0', :require => false - gem 'faraday-retry', '~> 2.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false end gem 'rake', :require => false From 812dd4e317de8bafafa86771000c3793379c2258 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 6 Feb 2024 12:23:03 +0100 Subject: [PATCH 19/51] modulesync 7.3.0 --- .github/workflows/ci.yml | 7 ++++++- .msync.yml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b66d8ca..7216724 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,12 @@ name: CI -on: pull_request +on: + pull_request: {} + push: + branches: + - main + - master concurrency: group: ${{ github.ref_name }} diff --git a/.msync.yml b/.msync.yml index f818344..f46ee02 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.2.0' +modulesync_config_version: '7.3.0' From eb09dffc02d3956a75f5eaf318b58fe001a279d1 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 5 Apr 2024 00:56:52 +0200 Subject: [PATCH 20/51] actually apply the sysctl hash to test --- spec/acceptance/augeasproviders_instances_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/acceptance/augeasproviders_instances_spec.rb b/spec/acceptance/augeasproviders_instances_spec.rb index 519089a..3c2f87b 100644 --- a/spec/acceptance/augeasproviders_instances_spec.rb +++ b/spec/acceptance/augeasproviders_instances_spec.rb @@ -24,7 +24,9 @@ class { 'augeasproviders::instances': it 'runs successfully' do pp = <<-EOS $augeasproviders_sysctl_hash = { 'net.ipv4.ip_forward' => { 'value' => '0' } } - class { 'augeasproviders::instances': } + class { 'augeasproviders::instances': + sysctl_hash => $augeasproviders_sysctl_hash, + } EOS apply_manifest(pp, catch_failures: true) From bfffb7aea4d2b3c5fc1dcb9f6d0b867e43797459 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 5 Apr 2024 14:52:24 +0200 Subject: [PATCH 21/51] reflect migration to voxpupuli in module name --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 8710005..9ce88c8 100644 --- a/metadata.json +++ b/metadata.json @@ -1,5 +1,5 @@ { - "name": "herculesteam-augeasproviders", + "name": "puppet-augeasproviders", "version": "2.4.1", "author": "Raphael Pinson", "summary": "Alternative Augeas-based providers for Puppet", From 90f8aa99c623d78dc85a9cd47fc305c30e2d3c93 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 5 Apr 2024 19:12:59 +0200 Subject: [PATCH 22/51] rewrite check to use native rspec syntax --- spec/classes/augeasproviders_instances_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/augeasproviders_instances_spec.rb b/spec/classes/augeasproviders_instances_spec.rb index af369e3..5a4cb56 100644 --- a/spec/classes/augeasproviders_instances_spec.rb +++ b/spec/classes/augeasproviders_instances_spec.rb @@ -9,7 +9,7 @@ context "when resource_defaults => 'foo'" do let(:params) { { resource_defaults: 'foo' } } - it { expect { is_expected.to create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, %r{expects a Hash value, got String}) } + it { is_expected.to compile.and_raise_error(%r{expects a Hash value, got String}) } end %w[ From 239f919187d1f1abe6f07d4b29c9ef67cab52609 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:12:14 +0100 Subject: [PATCH 23/51] puppet-lint fix --- manifests/instances.pp | 2 -- manifests/params.pp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/manifests/instances.pp b/manifests/instances.pp index 39cdcb6..a3ab283 100644 --- a/manifests/instances.pp +++ b/manifests/instances.pp @@ -20,7 +20,6 @@ Hash[String, Hash] $syslog_hash = {}, Hash[String, Hash] $resource_defaults = $augeasproviders::params::resource_defaults, ) inherits augeasproviders::params { - create_resources(apache_directive, $apache_directive_hash, $resource_defaults['apache_directive']) create_resources(apache_setenv, $apache_setenv_hash, $resource_defaults['apache_setenv']) create_resources(host, $host_hash, $resource_defaults['host']) @@ -37,5 +36,4 @@ create_resources(sshd_config_subsystem, $sshd_config_subsystem_hash, $resource_defaults['sshd_config_subsystem']) create_resources(sysctl, $sysctl_hash, $resource_defaults['sysctl']) create_resources(syslog, $syslog_hash, $resource_defaults['syslog']) - } diff --git a/manifests/params.pp b/manifests/params.pp index c7ed41d..596932c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,7 +12,7 @@ 'apache_directive' => $defaults, 'apache_setenv' => $defaults, 'host' => $defaults, - 'kernel_parameter' => merge($defaults, {'provider' => undef}), + 'kernel_parameter' => merge($defaults, { 'provider' => undef }), 'mailalias' => $defaults, 'mounttab' => $defaults, 'nrpe_command' => $defaults, @@ -26,5 +26,5 @@ 'sysctl' => $defaults, 'syslog' => $defaults, } - + # lint:endignore } From d27b788d0dcdaa6b477ee6a0912e5b5ad075d042 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:15:38 +0100 Subject: [PATCH 24/51] cleanup .fixtures.yml --- .fixtures.yml | 46 ++++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 5985d6b..f6fbc10 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,34 +1,16 @@ fixtures: repositories: - stdlib: - repo: git://github.com/puppetlabs/puppetlabs-stdlib.git - ref: 4.1.0 - augeasproviders_core: - repo: git://github.com/hercules-team/augeasproviders_core.git - augeasproviders_apache: - repo: git://github.com/hercules-team/augeasproviders_apache.git - augeasproviders_grub: - repo: git://github.com/hercules-team/augeasproviders_grub.git - mount_providers: - repo: git://github.com/puppetlabs/puppetlabs-mount_providers.git - ref: 0.0.2 - augeasproviders_mounttab: - repo: git://github.com/hercules-team/augeasproviders_mounttab.git - augeasproviders_nagios: - repo: git://github.com/hercules-team/augeasproviders_nagios.git - augeasproviders_pam: - repo: git://github.com/hercules-team/augeasproviders_pam.git - augeasproviders_postgresql: - repo: git://github.com/hercules-team/augeasproviders_postgresql.git - augeasproviders_puppet: - repo: git://github.com/hercules-team/augeasproviders_puppet.git - augeasproviders_shellvar: - repo: git://github.com/hercules-team/augeasproviders_shellvar.git - augeasproviders_ssh: - repo: git://github.com/hercules-team/augeasproviders_ssh.git - augeasproviders_sysctl: - repo: git://github.com/hercules-team/augeasproviders_sysctl.git - augeasproviders_syslog: - repo: git://github.com/hercules-team/augeasproviders_syslog.git - symlinks: - "augeasproviders": "#{source_dir}" + stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git + augeasproviders_core: https://github.com/voxpupuli/puppet-augeasproviders_core.git + augeasproviders_apache: https://github.com/voxpupuli/puppet-augeasproviders_apache.git + augeasproviders_grub: https://github.com/voxpupuli/puppet-augeasproviders_grub.git + mount_providers: https://github.com/puppetlabs/puppetlabs-mount_providers.git + augeasproviders_mounttab: https://github.com/voxpupuli/puppet-augeasproviders_mounttab.git + augeasproviders_nagios: https://github.com/voxpupuli/puppet-augeasproviders_nagios.git + augeasproviders_pam: https://github.com/voxpupuli/puppet-augeasproviders_pam.git + augeasproviders_postgresql: https://github.com/voxpupuli/puppet-augeasproviders_postgresql.git + augeasproviders_puppet: https://github.com/voxpupuli/puppet-augeasproviders_puppet.git + augeasproviders_shellvar: https://github.com/voxpupuli/puppet-augeasproviders_shellvar.git + augeasproviders_ssh: https://github.com/voxpupuli/puppet-augeasproviders_ssh.git + augeasproviders_sysctl: https://github.com/voxpupuli/puppet-augeasproviders_sysctl.git + augeasproviders_syslog: https://github.com/voxpupuli/puppet-augeasproviders_syslog.git From ca28b0b6e38106eb2db9030e1cd0e34fecbb6086 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:20:01 +0100 Subject: [PATCH 25/51] delete legacy nodesets --- spec/acceptance/nodesets/centos-65-x64.yml | 11 ----------- spec/acceptance/nodesets/default.yml | 11 ----------- 2 files changed, 22 deletions(-) delete mode 100644 spec/acceptance/nodesets/centos-65-x64.yml delete mode 100644 spec/acceptance/nodesets/default.yml diff --git a/spec/acceptance/nodesets/centos-65-x64.yml b/spec/acceptance/nodesets/centos-65-x64.yml deleted file mode 100644 index 1ef6615..0000000 --- a/spec/acceptance/nodesets/centos-65-x64.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - centos-65-x64: - roles: - - master - platform: el-6-x86_64 - box : centos-65-x64-virtualbox-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box - hypervisor : vagrant -CONFIG: - log_level: debug - type: foss diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml deleted file mode 100644 index 1ef6615..0000000 --- a/spec/acceptance/nodesets/default.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - centos-65-x64: - roles: - - master - platform: el-6-x86_64 - box : centos-65-x64-virtualbox-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box - hypervisor : vagrant -CONFIG: - log_level: debug - type: foss From 25a4af4d3bdea2c54d40285bf830426a38e048b2 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:20:12 +0100 Subject: [PATCH 26/51] rubocop safe autofix --- .../augeasproviders_instances_spec.rb | 22 +++++----- .../classes/augeasproviders_instances_spec.rb | 43 +++++++++--------- spec/spec_helper_acceptance.rb | 9 ++-- spec/support/apache_directive.rb | 35 ++++++++------- spec/support/apache_setenv.rb | 33 +++++++------- spec/support/host.rb | 32 +++++++------- spec/support/kernel_parameter.rb | 30 +++++++------ spec/support/mailalias.rb | 32 +++++++------- spec/support/mounttab.rb | 36 ++++++++------- spec/support/nrpe_command.rb | 32 +++++++------- spec/support/pam.rb | 44 ++++++++++--------- spec/support/pg_hba.rb | 40 +++++++++-------- spec/support/puppet_auth.rb | 34 +++++++------- spec/support/shellvar.rb | 36 ++++++++------- spec/support/ssh_config.rb | 32 +++++++------- spec/support/sshd_config.rb | 32 +++++++------- spec/support/sshd_config_subsystem.rb | 32 +++++++------- spec/support/sysctl.rb | 32 +++++++------- spec/support/syslog.rb | 38 ++++++++-------- spec/support/validate_hash.rb | 16 ++++--- 20 files changed, 340 insertions(+), 300 deletions(-) diff --git a/spec/acceptance/augeasproviders_instances_spec.rb b/spec/acceptance/augeasproviders_instances_spec.rb index 3bb0a35..519089a 100644 --- a/spec/acceptance/augeasproviders_instances_spec.rb +++ b/spec/acceptance/augeasproviders_instances_spec.rb @@ -1,36 +1,38 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'augeasproviders::instances class' do context 'when sysctl_hash is defined' do - it 'should run successfully' do - pp =<<-EOS + it 'runs successfully' do + pp = <<-EOS class { 'augeasproviders::instances': sysctl_hash => { 'net.ipv4.ip_forward' => { 'value' => '1' } }, } EOS - apply_manifest(pp, :catch_failures => true) - expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + apply_manifest(pp, catch_failures: true) + expect(apply_manifest(pp, catch_failures: true).exit_code).to be_zero end describe linux_kernel_parameter('net.ipv4.ip_forward') do - its(:value) { should eq 1 } + its(:value) { is_expected.to eq 1 } end end context 'when augeasproviders_sysctl_hash is defined' do - it 'should run successfully' do - pp =<<-EOS + it 'runs successfully' do + pp = <<-EOS $augeasproviders_sysctl_hash = { 'net.ipv4.ip_forward' => { 'value' => '0' } } class { 'augeasproviders::instances': } EOS - apply_manifest(pp, :catch_failures => true) - expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero + apply_manifest(pp, catch_failures: true) + expect(apply_manifest(pp, catch_failures: true).exit_code).to be_zero end describe linux_kernel_parameter('net.ipv4.ip_forward') do - its(:value) { should eq 0 } + its(:value) { is_expected.to eq 0 } end end end diff --git a/spec/classes/augeasproviders_instances_spec.rb b/spec/classes/augeasproviders_instances_spec.rb index ac1b5f3..16b220e 100644 --- a/spec/classes/augeasproviders_instances_spec.rb +++ b/spec/classes/augeasproviders_instances_spec.rb @@ -1,30 +1,33 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'augeasproviders::instances' do - it { should create_class('augeasproviders::instances') } - it { should contain_class('augeasproviders::params') } + it { is_expected.to create_class('augeasproviders::instances') } + it { is_expected.to contain_class('augeasproviders::params') } context "when resource_defaults => 'foo'" do - let(:params) {{ :resource_defaults => 'foo' }} - it { expect { should create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, /is not a Hash/) } + let(:params) { { resource_defaults: 'foo' } } + + it { expect { is_expected.to create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, %r{is not a Hash}) } end - [ - 'apache_directive', - 'apache_setenv', - 'host', - 'kernel_parameter', - 'mailalias', - 'mounttab', - 'nrpe_command', - 'pam', - 'pg_hba', - 'puppet_auth', - 'shellvar', - 'sshd_config', - 'sshd_config_subsystem', - 'sysctl', - 'syslog', + %w[ + apache_directive + apache_setenv + host + kernel_parameter + mailalias + mounttab + nrpe_command + pam + pg_hba + puppet_auth + shellvar + sshd_config + sshd_config_subsystem + sysctl + syslog ].each do |type| describe "#{type} instances" do include_context type diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 5ab57b6..748c1d3 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,7 +1,8 @@ +# frozen_string_literal: true require 'beaker-rspec/spec_helper' require 'beaker-rspec/helpers/serverspec' -hosts.each do |host| +hosts.each do |_host| # Install Puppet install_puppet end @@ -16,10 +17,10 @@ # Configure all nodes in nodeset c.before :suite do # Install module and dependencies - puppet_module_install(:source => proj_root, :module_name => 'augeasproviders') + puppet_module_install(source: proj_root, module_name: 'augeasproviders') hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs/stdlib'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module', 'install', 'puppetlabs/stdlib'), { acceptable_exit_codes: [0, 1] } end end -end \ No newline at end of file +end diff --git a/spec/support/apache_directive.rb b/spec/support/apache_directive.rb index 8d02eff..ca70487 100644 --- a/spec/support/apache_directive.rb +++ b/spec/support/apache_directive.rb @@ -1,35 +1,36 @@ +# frozen_string_literal: true + shared_examples_for 'apache_directive resource' do - it { should have_apache_directive_resource_count(1) } + it { is_expected.to have_apache_directive_resource_count(1) } it do - should contain_apache_directive('StartServers').only_with({ - 'name' => 'StartServers', - 'ensure' => 'present', - 'args' => '3', - 'target' => '/etc/httpd/conf/httpd.conf', - 'provider' => 'augeas', - }) + expect(subject).to contain_apache_directive('StartServers').only_with({ + 'name' => 'StartServers', + 'ensure' => 'present', + 'args' => '3', + 'target' => '/etc/httpd/conf/httpd.conf', + 'provider' => 'augeas', + }) end end shared_context 'apache_directive' do - it { should have_apache_directive_resource_count(0) } + it { is_expected.to have_apache_directive_resource_count(0) } let :example_params do - {'StartServers' => {'args' => '3', 'target' => '/etc/httpd/conf/httpd.conf'}} + { 'StartServers' => { 'args' => '3', 'target' => '/etc/httpd/conf/httpd.conf' } } end - context "when apache_directive_hash is a Hash" do - let(:params) {{ :apache_directive_hash => example_params }} - let(:facts) {{}} + context 'when apache_directive_hash is a Hash' do + let(:params) { { apache_directive_hash: example_params } } + let(:facts) { {} } include_examples 'apache_directive resource' end - context "when ::augeasproviders_apache_directive_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_apache_directive_hash => example_params }} - + context 'when ::augeasproviders_apache_directive_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_apache_directive_hash: example_params } } include_examples 'apache_directive resource' end diff --git a/spec/support/apache_setenv.rb b/spec/support/apache_setenv.rb index 5f4dcd9..50db5a9 100644 --- a/spec/support/apache_setenv.rb +++ b/spec/support/apache_setenv.rb @@ -1,34 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'apache_setenv resource' do - it { should have_apache_setenv_resource_count(1) } + it { is_expected.to have_apache_setenv_resource_count(1) } it do - should contain_apache_setenv('FOO').only_with({ - 'name' => 'FOO', - 'ensure' => 'present', - 'value' => 'bar', - 'provider' => 'augeas', - }) + expect(subject).to contain_apache_setenv('FOO').only_with({ + 'name' => 'FOO', + 'ensure' => 'present', + 'value' => 'bar', + 'provider' => 'augeas', + }) end end shared_context 'apache_setenv' do - it { should have_apache_setenv_resource_count(0) } + it { is_expected.to have_apache_setenv_resource_count(0) } let :example_params do - {'FOO' => {'value' => 'bar'}} + { 'FOO' => { 'value' => 'bar' } } end - context "when apache_setenv_hash is a Hash" do - let(:params) {{ :apache_setenv_hash => example_params }} - let(:facts) {{}} + context 'when apache_setenv_hash is a Hash' do + let(:params) { { apache_setenv_hash: example_params } } + let(:facts) { {} } include_examples 'apache_setenv resource' end - context "when ::augeasproviders_apache_setenv_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_apache_setenv_hash => example_params }} - + context 'when ::augeasproviders_apache_setenv_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_apache_setenv_hash: example_params } } include_examples 'apache_setenv resource' end diff --git a/spec/support/host.rb b/spec/support/host.rb index 1de346d..d712cd4 100644 --- a/spec/support/host.rb +++ b/spec/support/host.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'host resource' do - it { should have_host_resource_count(1) } + it { is_expected.to have_host_resource_count(1) } it do - should contain_host('foo').only_with({ - 'name' => 'foo', - 'ensure' => 'present', - 'ip' => '192.168.1.1', - 'provider' => 'augeas', - }) + expect(subject).to contain_host('foo').only_with({ + 'name' => 'foo', + 'ensure' => 'present', + 'ip' => '192.168.1.1', + 'provider' => 'augeas', + }) end end shared_context 'host' do - it { should have_host_resource_count(0) } + it { is_expected.to have_host_resource_count(0) } let :example_params do - {'foo' => {'ip' => '192.168.1.1'}} + { 'foo' => { 'ip' => '192.168.1.1' } } end - context "when host_hash is a Hash" do - let(:params) {{ :host_hash => example_params }} - let(:facts) {{}} + context 'when host_hash is a Hash' do + let(:params) { { host_hash: example_params } } + let(:facts) { {} } include_examples 'host resource' end - context "when ::augeasproviders_host_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_host_hash => example_params }} + context 'when ::augeasproviders_host_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_host_hash: example_params } } include_examples 'host resource' end diff --git a/spec/support/kernel_parameter.rb b/spec/support/kernel_parameter.rb index cfe8961..3ae9e7b 100644 --- a/spec/support/kernel_parameter.rb +++ b/spec/support/kernel_parameter.rb @@ -1,32 +1,34 @@ +# frozen_string_literal: true + shared_examples_for 'kernel_parameter resource' do - it { should have_kernel_parameter_resource_count(1) } + it { is_expected.to have_kernel_parameter_resource_count(1) } it do - should contain_kernel_parameter('elevator').only_with({ - 'name' => 'elevator', - 'ensure' => 'present', - 'value' => 'deadline', - }) + expect(subject).to contain_kernel_parameter('elevator').only_with({ + 'name' => 'elevator', + 'ensure' => 'present', + 'value' => 'deadline', + }) end end shared_context 'kernel_parameter' do - it { should have_kernel_parameter_resource_count(0) } + it { is_expected.to have_kernel_parameter_resource_count(0) } let :example_params do - {'elevator' => {'value' => 'deadline'}} + { 'elevator' => { 'value' => 'deadline' } } end - context "when kernel_parameter_hash is a Hash" do - let(:params) {{ :kernel_parameter_hash => example_params }} - let(:facts) {{}} + context 'when kernel_parameter_hash is a Hash' do + let(:params) { { kernel_parameter_hash: example_params } } + let(:facts) { {} } include_examples 'kernel_parameter resource' end - context "when ::augeasproviders_kernel_parameter_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_kernel_parameter_hash => example_params }} + context 'when ::augeasproviders_kernel_parameter_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_kernel_parameter_hash: example_params } } include_examples 'kernel_parameter resource' end diff --git a/spec/support/mailalias.rb b/spec/support/mailalias.rb index 6363716..8af6230 100644 --- a/spec/support/mailalias.rb +++ b/spec/support/mailalias.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'mailalias resource' do - it { should have_mailalias_resource_count(1) } + it { is_expected.to have_mailalias_resource_count(1) } it do - should contain_mailalias('foo').only_with({ - 'name' => 'foo', - 'ensure' => 'present', - 'recipient' => 'bar', - 'provider' => 'augeas', - }) + expect(subject).to contain_mailalias('foo').only_with({ + 'name' => 'foo', + 'ensure' => 'present', + 'recipient' => 'bar', + 'provider' => 'augeas', + }) end end shared_context 'mailalias' do - it { should have_mailalias_resource_count(0) } + it { is_expected.to have_mailalias_resource_count(0) } let :example_params do - {'foo' => {'recipient' => 'bar'}} + { 'foo' => { 'recipient' => 'bar' } } end - context "when mailalias_hash is a Hash" do - let(:params) {{ :mailalias_hash => example_params }} - let(:facts) {{}} + context 'when mailalias_hash is a Hash' do + let(:params) { { mailalias_hash: example_params } } + let(:facts) { {} } include_examples 'mailalias resource' end - context "when ::augeasproviders_mailalias_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_mailalias_hash => example_params }} + context 'when ::augeasproviders_mailalias_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_mailalias_hash: example_params } } include_examples 'mailalias resource' end diff --git a/spec/support/mounttab.rb b/spec/support/mounttab.rb index 1118a6e..baf4a96 100644 --- a/spec/support/mounttab.rb +++ b/spec/support/mounttab.rb @@ -1,35 +1,37 @@ +# frozen_string_literal: true + shared_examples_for 'mounttab resource' do - it { should have_mounttab_resource_count(1) } + it { is_expected.to have_mounttab_resource_count(1) } it do - should contain_mounttab('/mnt').only_with({ - 'name' => '/mnt', - 'ensure' => 'present', - 'device' => '/dev/myvg/mytest', - 'fstype' => 'ext4', - 'options' => 'defaults', - 'provider' => 'augeas', - }) + expect(subject).to contain_mounttab('/mnt').only_with({ + 'name' => '/mnt', + 'ensure' => 'present', + 'device' => '/dev/myvg/mytest', + 'fstype' => 'ext4', + 'options' => 'defaults', + 'provider' => 'augeas', + }) end end shared_context 'mounttab' do - it { should have_mounttab_resource_count(0) } + it { is_expected.to have_mounttab_resource_count(0) } let :example_params do - {'/mnt' => {'device' => '/dev/myvg/mytest', 'fstype' => 'ext4', 'options' => 'defaults'}} + { '/mnt' => { 'device' => '/dev/myvg/mytest', 'fstype' => 'ext4', 'options' => 'defaults' } } end - context "when mounttab_hash is a Hash" do - let(:params) {{ :mounttab_hash => example_params }} - let(:facts) {{}} + context 'when mounttab_hash is a Hash' do + let(:params) { { mounttab_hash: example_params } } + let(:facts) { {} } include_examples 'mounttab resource' end - context "when ::augeasproviders_mounttab_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_mounttab_hash => example_params }} + context 'when ::augeasproviders_mounttab_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_mounttab_hash: example_params } } include_examples 'mounttab resource' end diff --git a/spec/support/nrpe_command.rb b/spec/support/nrpe_command.rb index 259f611..a639654 100644 --- a/spec/support/nrpe_command.rb +++ b/spec/support/nrpe_command.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'nrpe_command resource' do - it { should have_nrpe_command_resource_count(1) } + it { is_expected.to have_nrpe_command_resource_count(1) } it do - should contain_nrpe_command('check_foo').only_with({ - 'name' => 'check_foo', - 'ensure' => 'present', - 'command' => '/usr/bin/check_foo', - 'provider' => 'augeas', - }) + expect(subject).to contain_nrpe_command('check_foo').only_with({ + 'name' => 'check_foo', + 'ensure' => 'present', + 'command' => '/usr/bin/check_foo', + 'provider' => 'augeas', + }) end end shared_context 'nrpe_command' do - it { should have_nrpe_command_resource_count(0) } + it { is_expected.to have_nrpe_command_resource_count(0) } let :example_params do - {'check_foo' => {'command' => '/usr/bin/check_foo'}} + { 'check_foo' => { 'command' => '/usr/bin/check_foo' } } end - context "when nrpe_command_hash is a Hash" do - let(:params) {{ :nrpe_command_hash => example_params }} - let(:facts) {{}} + context 'when nrpe_command_hash is a Hash' do + let(:params) { { nrpe_command_hash: example_params } } + let(:facts) { {} } include_examples 'nrpe_command resource' end - context "when ::augeasproviders_nrpe_command_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_nrpe_command_hash => example_params }} + context 'when ::augeasproviders_nrpe_command_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_nrpe_command_hash: example_params } } include_examples 'nrpe_command resource' end diff --git a/spec/support/pam.rb b/spec/support/pam.rb index 59ac2f9..bbe28ef 100644 --- a/spec/support/pam.rb +++ b/spec/support/pam.rb @@ -1,39 +1,41 @@ +# frozen_string_literal: true + shared_examples_for 'pam resource' do - it { should have_pam_resource_count(1) } + it { is_expected.to have_pam_resource_count(1) } it do - should contain_pam('Add pam_test.so to auth for system-auth').only_with({ - 'name' => 'Add pam_test.so to auth for system-auth', - 'service' => 'system-auth', - 'type' => 'auth', - 'control' => 'sufficient', - 'module' => 'pam_test.so', - 'arguments' => 'test_me_out', - 'position' => 'before module pam_deny.so', - 'target' => '/etc/pam.d/system-auth', - 'provider' => 'augeas', - 'ensure' => 'present', - }) + expect(subject).to contain_pam('Add pam_test.so to auth for system-auth').only_with({ + 'name' => 'Add pam_test.so to auth for system-auth', + 'service' => 'system-auth', + 'type' => 'auth', + 'control' => 'sufficient', + 'module' => 'pam_test.so', + 'arguments' => 'test_me_out', + 'position' => 'before module pam_deny.so', + 'target' => '/etc/pam.d/system-auth', + 'provider' => 'augeas', + 'ensure' => 'present', + }) end end shared_context 'pam' do - it { should have_pam_resource_count(0) } + it { is_expected.to have_pam_resource_count(0) } let :example_params do - { 'Add pam_test.so to auth for system-auth' => {'service' => 'system-auth', 'type' => 'auth', 'control' => 'sufficient', 'module' => 'pam_test.so', 'arguments' => 'test_me_out', 'position' => 'before module pam_deny.so', 'target' => '/etc/pam.d/system-auth', 'provider' => 'augeas', 'ensure' => 'present'}} + { 'Add pam_test.so to auth for system-auth' => { 'service' => 'system-auth', 'type' => 'auth', 'control' => 'sufficient', 'module' => 'pam_test.so', 'arguments' => 'test_me_out', 'position' => 'before module pam_deny.so', 'target' => '/etc/pam.d/system-auth', 'provider' => 'augeas', 'ensure' => 'present' } } end - context "when pam_hash is a Hash" do - let(:params) {{ :pam_hash => example_params }} - let(:facts) {{}} + context 'when pam_hash is a Hash' do + let(:params) { { pam_hash: example_params } } + let(:facts) { {} } include_examples 'pam resource' end - context "when ::augeasproviders_pam_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_pam_hash => example_params }} + context 'when ::augeasproviders_pam_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_pam_hash: example_params } } include_examples 'pam resource' end diff --git a/spec/support/pg_hba.rb b/spec/support/pg_hba.rb index 3b5aed8..e9fae48 100644 --- a/spec/support/pg_hba.rb +++ b/spec/support/pg_hba.rb @@ -1,37 +1,39 @@ +# frozen_string_literal: true + shared_examples_for 'pg_hba resource' do - it { should have_pg_hba_resource_count(1) } + it { is_expected.to have_pg_hba_resource_count(1) } it do - should contain_pg_hba('Default entry').only_with({ - 'name' => 'Default entry', - 'type' => 'local', - 'user' => 'all', - 'database' => 'all', - 'ensure' => 'present', - 'method' => 'md5', - 'target' => '/etc/postgresql/9.1/main/pg_hba.conf', - 'provider' => 'augeas', - }) + expect(subject).to contain_pg_hba('Default entry').only_with({ + 'name' => 'Default entry', + 'type' => 'local', + 'user' => 'all', + 'database' => 'all', + 'ensure' => 'present', + 'method' => 'md5', + 'target' => '/etc/postgresql/9.1/main/pg_hba.conf', + 'provider' => 'augeas', + }) end end shared_context 'pg_hba' do - it { should have_pg_hba_resource_count(0) } + it { is_expected.to have_pg_hba_resource_count(0) } let :example_params do - {'Default entry' => {'type' => 'local', 'user' => 'all', 'database' => 'all', 'method' => 'md5', 'target' => '/etc/postgresql/9.1/main/pg_hba.conf'}} + { 'Default entry' => { 'type' => 'local', 'user' => 'all', 'database' => 'all', 'method' => 'md5', 'target' => '/etc/postgresql/9.1/main/pg_hba.conf' } } end - context "when pg_hba_hash is a Hash" do - let(:params) {{ :pg_hba_hash => example_params }} - let(:facts) {{}} + context 'when pg_hba_hash is a Hash' do + let(:params) { { pg_hba_hash: example_params } } + let(:facts) { {} } include_examples 'pg_hba resource' end - context "when ::augeasproviders_pg_hba_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_pg_hba_hash => example_params }} + context 'when ::augeasproviders_pg_hba_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_pg_hba_hash: example_params } } include_examples 'pg_hba resource' end diff --git a/spec/support/puppet_auth.rb b/spec/support/puppet_auth.rb index 84ee014..3632fdb 100644 --- a/spec/support/puppet_auth.rb +++ b/spec/support/puppet_auth.rb @@ -1,34 +1,36 @@ +# frozen_string_literal: true + shared_examples_for 'puppet_auth resource' do - it { should have_puppet_auth_resource_count(1) } + it { is_expected.to have_puppet_auth_resource_count(1) } it do - should contain_puppet_auth('Deny /facts').only_with({ - 'name' => 'Deny /facts', - 'ensure' => 'present', - 'path' => '/facts', - 'authenticated' => 'any', - 'provider' => 'augeas', - }) + expect(subject).to contain_puppet_auth('Deny /facts').only_with({ + 'name' => 'Deny /facts', + 'ensure' => 'present', + 'path' => '/facts', + 'authenticated' => 'any', + 'provider' => 'augeas', + }) end end shared_context 'puppet_auth' do - it { should have_puppet_auth_resource_count(0) } + it { is_expected.to have_puppet_auth_resource_count(0) } let :example_params do - {'Deny /facts' => {'path' => '/facts', 'authenticated' => 'any'}} + { 'Deny /facts' => { 'path' => '/facts', 'authenticated' => 'any' } } end - context "when puppet_auth_hash is a Hash" do - let(:params) {{ :puppet_auth_hash => example_params }} - let(:facts) {{}} + context 'when puppet_auth_hash is a Hash' do + let(:params) { { puppet_auth_hash: example_params } } + let(:facts) { {} } include_examples 'puppet_auth resource' end - context "when ::augeasproviders_puppet_auth_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_puppet_auth_hash => example_params }} + context 'when ::augeasproviders_puppet_auth_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_puppet_auth_hash: example_params } } include_examples 'puppet_auth resource' end diff --git a/spec/support/shellvar.rb b/spec/support/shellvar.rb index 0095b3e..c5ed98e 100644 --- a/spec/support/shellvar.rb +++ b/spec/support/shellvar.rb @@ -1,35 +1,37 @@ +# frozen_string_literal: true + shared_examples_for 'shellvar resource' do - it { should have_shellvar_resource_count(1) } + it { is_expected.to have_shellvar_resource_count(1) } it do - should contain_shellvar('HOSTNAME').only_with({ - 'variable' => 'HOSTNAME', - 'name' => 'HOSTNAME', - 'ensure' => 'present', - 'target' => '/etc/sysconfig/network', - 'value' => 'host.example.com', - 'provider' => 'augeas', - }) + expect(subject).to contain_shellvar('HOSTNAME').only_with({ + 'variable' => 'HOSTNAME', + 'name' => 'HOSTNAME', + 'ensure' => 'present', + 'target' => '/etc/sysconfig/network', + 'value' => 'host.example.com', + 'provider' => 'augeas', + }) end end shared_context 'shellvar' do - it { should have_shellvar_resource_count(0) } + it { is_expected.to have_shellvar_resource_count(0) } let :example_params do - {'HOSTNAME' => {'target' => '/etc/sysconfig/network', 'value' => 'host.example.com'}} + { 'HOSTNAME' => { 'target' => '/etc/sysconfig/network', 'value' => 'host.example.com' } } end - context "when shellvar_hash is a Hash" do - let(:params) {{ :shellvar_hash => example_params }} - let(:facts) {{}} + context 'when shellvar_hash is a Hash' do + let(:params) { { shellvar_hash: example_params } } + let(:facts) { {} } include_examples 'shellvar resource' end - context "when ::augeasproviders_shellvar_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_shellvar_hash => example_params }} + context 'when ::augeasproviders_shellvar_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_shellvar_hash: example_params } } include_examples 'shellvar resource' end diff --git a/spec/support/ssh_config.rb b/spec/support/ssh_config.rb index 0764ba2..23f0b46 100644 --- a/spec/support/ssh_config.rb +++ b/spec/support/ssh_config.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'ssh_config resource' do - it { should have_ssh_config_resource_count(1) } + it { is_expected.to have_ssh_config_resource_count(1) } it do - should contain_ssh_config('HashKnownHosts').only_with({ - 'name' => 'HashKnownHosts', - 'ensure' => 'present', - 'value' => 'yes', - 'provider' => 'augeas', - }) + expect(subject).to contain_ssh_config('HashKnownHosts').only_with({ + 'name' => 'HashKnownHosts', + 'ensure' => 'present', + 'value' => 'yes', + 'provider' => 'augeas', + }) end end shared_context 'ssh_config' do - it { should have_ssh_config_resource_count(0) } + it { is_expected.to have_ssh_config_resource_count(0) } let :example_params do - {'HashKnownHosts' => {'value' => 'yes'}} + { 'HashKnownHosts' => { 'value' => 'yes' } } end - context "when ssh_config_hash is a Hash" do - let(:params) {{ :ssh_config_hash => example_params }} - let(:facts) {{}} + context 'when ssh_config_hash is a Hash' do + let(:params) { { ssh_config_hash: example_params } } + let(:facts) { {} } include_examples 'ssh_config resource' end - context "when ::augeasproviders_ssh_config_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_ssh_config_hash => example_params }} + context 'when ::augeasproviders_ssh_config_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_ssh_config_hash: example_params } } include_examples 'ssh_config resource' end diff --git a/spec/support/sshd_config.rb b/spec/support/sshd_config.rb index fee7a34..4961e41 100644 --- a/spec/support/sshd_config.rb +++ b/spec/support/sshd_config.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'sshd_config resource' do - it { should have_sshd_config_resource_count(1) } + it { is_expected.to have_sshd_config_resource_count(1) } it do - should contain_sshd_config('PermitRootLogin').only_with({ - 'name' => 'PermitRootLogin', - 'ensure' => 'present', - 'value' => 'yes', - 'provider' => 'augeas', - }) + expect(subject).to contain_sshd_config('PermitRootLogin').only_with({ + 'name' => 'PermitRootLogin', + 'ensure' => 'present', + 'value' => 'yes', + 'provider' => 'augeas', + }) end end shared_context 'sshd_config' do - it { should have_sshd_config_resource_count(0) } + it { is_expected.to have_sshd_config_resource_count(0) } let :example_params do - {'PermitRootLogin' => {'value' => 'yes'}} + { 'PermitRootLogin' => { 'value' => 'yes' } } end - context "when sshd_config_hash is a Hash" do - let(:params) {{ :sshd_config_hash => example_params }} - let(:facts) {{}} + context 'when sshd_config_hash is a Hash' do + let(:params) { { sshd_config_hash: example_params } } + let(:facts) { {} } include_examples 'sshd_config resource' end - context "when ::augeasproviders_sshd_config_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_sshd_config_hash => example_params }} + context 'when ::augeasproviders_sshd_config_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_sshd_config_hash: example_params } } include_examples 'sshd_config resource' end diff --git a/spec/support/sshd_config_subsystem.rb b/spec/support/sshd_config_subsystem.rb index 75848bb..3a1b0e6 100644 --- a/spec/support/sshd_config_subsystem.rb +++ b/spec/support/sshd_config_subsystem.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'sshd_config_subsystem resource' do - it { should have_sshd_config_subsystem_resource_count(1) } + it { is_expected.to have_sshd_config_subsystem_resource_count(1) } it do - should contain_sshd_config_subsystem('sftp').only_with({ - 'name' => 'sftp', - 'ensure' => 'present', - 'command' => '/usr/lib/openssh/sftp-server', - 'provider' => 'augeas', - }) + expect(subject).to contain_sshd_config_subsystem('sftp').only_with({ + 'name' => 'sftp', + 'ensure' => 'present', + 'command' => '/usr/lib/openssh/sftp-server', + 'provider' => 'augeas', + }) end end shared_context 'sshd_config_subsystem' do - it { should have_sshd_config_subsystem_resource_count(0) } + it { is_expected.to have_sshd_config_subsystem_resource_count(0) } let :example_params do - {'sftp' => {'command' => '/usr/lib/openssh/sftp-server'}} + { 'sftp' => { 'command' => '/usr/lib/openssh/sftp-server' } } end - context "when sshd_config_subsystem_hash is a Hash" do - let(:params) {{ :sshd_config_subsystem_hash => example_params }} - let(:facts) {{}} + context 'when sshd_config_subsystem_hash is a Hash' do + let(:params) { { sshd_config_subsystem_hash: example_params } } + let(:facts) { {} } include_examples 'sshd_config_subsystem resource' end - context "when ::augeasproviders_sshd_config_subsystem_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_sshd_config_subsystem_hash => example_params }} + context 'when ::augeasproviders_sshd_config_subsystem_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_sshd_config_subsystem_hash: example_params } } include_examples 'sshd_config_subsystem resource' end diff --git a/spec/support/sysctl.rb b/spec/support/sysctl.rb index 316a589..2a30961 100644 --- a/spec/support/sysctl.rb +++ b/spec/support/sysctl.rb @@ -1,33 +1,35 @@ +# frozen_string_literal: true + shared_examples_for 'sysctl resource' do - it { should have_sysctl_resource_count(1) } + it { is_expected.to have_sysctl_resource_count(1) } it do - should contain_sysctl('vm.foo').only_with({ - 'name' => 'vm.foo', - 'ensure' => 'present', - 'value' => '0', - 'provider' => 'augeas', - }) + expect(subject).to contain_sysctl('vm.foo').only_with({ + 'name' => 'vm.foo', + 'ensure' => 'present', + 'value' => '0', + 'provider' => 'augeas', + }) end end shared_context 'sysctl' do - it { should have_sysctl_resource_count(0) } + it { is_expected.to have_sysctl_resource_count(0) } let :example_params do - {'vm.foo' => {'value' => '0'}} + { 'vm.foo' => { 'value' => '0' } } end - context "when sysctl_hash is a Hash" do - let(:params) {{ :sysctl_hash => example_params }} - let(:facts) {{}} + context 'when sysctl_hash is a Hash' do + let(:params) { { sysctl_hash: example_params } } + let(:facts) { {} } include_examples 'sysctl resource' end - context "when ::augeasproviders_sysctl_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_sysctl_hash => example_params }} + context 'when ::augeasproviders_sysctl_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_sysctl_hash: example_params } } include_examples 'sysctl resource' end diff --git a/spec/support/syslog.rb b/spec/support/syslog.rb index 9cbac7c..1077baa 100644 --- a/spec/support/syslog.rb +++ b/spec/support/syslog.rb @@ -1,36 +1,38 @@ +# frozen_string_literal: true + shared_examples_for 'syslog resource' do - it { should have_syslog_resource_count(1) } + it { is_expected.to have_syslog_resource_count(1) } it do - should contain_syslog('foo').only_with({ - 'name' => 'foo', - 'ensure' => 'present', - 'facility' => 'local2', - 'level' => '*', - 'action_type' => 'file', - 'action' => '/var/log/foo.log', - 'provider' => 'augeas', - }) + expect(subject).to contain_syslog('foo').only_with({ + 'name' => 'foo', + 'ensure' => 'present', + 'facility' => 'local2', + 'level' => '*', + 'action_type' => 'file', + 'action' => '/var/log/foo.log', + 'provider' => 'augeas', + }) end end shared_context 'syslog' do - it { should have_syslog_resource_count(0) } + it { is_expected.to have_syslog_resource_count(0) } let :example_params do - {'foo' => {'facility' => 'local2', 'level' => '*', 'action_type' => 'file', 'action' => '/var/log/foo.log'}} + { 'foo' => { 'facility' => 'local2', 'level' => '*', 'action_type' => 'file', 'action' => '/var/log/foo.log' } } end - context "when syslog_hash is a Hash" do - let(:params) {{ :syslog_hash => example_params }} - let(:facts) {{}} + context 'when syslog_hash is a Hash' do + let(:params) { { syslog_hash: example_params } } + let(:facts) { {} } include_examples 'syslog resource' end - context "when ::augeasproviders_syslog_hash is a Hash" do - let(:params) {{}} - let(:facts) {{ :augeasproviders_syslog_hash => example_params }} + context 'when ::augeasproviders_syslog_hash is a Hash' do + let(:params) { {} } + let(:facts) { { augeasproviders_syslog_hash: example_params } } include_examples 'syslog resource' end diff --git a/spec/support/validate_hash.rb b/spec/support/validate_hash.rb index 8ded9a9..28fa7a4 100644 --- a/spec/support/validate_hash.rb +++ b/spec/support/validate_hash.rb @@ -1,15 +1,19 @@ +# frozen_string_literal: true + shared_examples_for 'validate_hash param' do |hash_param_name| context "when #{hash_param_name} => 'FOO'" do - let(:params) {{ hash_param_name.to_sym => 'FOO' }} - let(:facts) {{}} - it { expect { should create_class('augeasproviders') }.to raise_error(Puppet::Error, /is not a Hash/) } + let(:params) { { hash_param_name.to_sym => 'FOO' } } + let(:facts) { {} } + + it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{is not a Hash}) } end end shared_examples_for 'validate_hash top-scope param' do |hash_variable_name| context "when ::#{hash_variable_name} => 'FOO'" do - let(:params) {{}} - let(:facts) {{ hash_variable_name.to_sym => 'FOO' }} - it { expect { should create_class('augeasproviders') }.to raise_error(Puppet::Error, /is not a Hash/) } + let(:params) { {} } + let(:facts) { { hash_variable_name.to_sym => 'FOO' } } + + it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{is not a Hash}) } end end From 9a52fc38d5d765e41e68cd62ec952698d71b16e5 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:23:27 +0100 Subject: [PATCH 27/51] Purge trailing whitespace in docs --- README.md | 4 ++-- docs/development.md | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2797711..cce1225 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ # Features This module provides is a meta module which gathers all official augeasproviders -modules as dependencies. +modules as dependencies. Augeasproviders modules provide alternative Augeas-based providers for Puppet providers around config files, using the Augeas configuration library to read and modify them. @@ -46,7 +46,7 @@ The following example is the same as above but using a top-scope variable. $augeasproviders_sysctl_hash = { 'net.ipv4.ip_forward' => { 'value' => '1' }, } - + include augeasproviders::instances } diff --git a/docs/development.md b/docs/development.md index c46a73d..f981545 100644 --- a/docs/development.md +++ b/docs/development.md @@ -57,7 +57,7 @@ In the event that you need information from the resource itself in order to dete lens do |resource| resource[:lens] end - + ## Confining your provider @@ -74,7 +74,7 @@ The `augeasproviders` library can take care of automatically declaring some prov "$target/#{resource[:name]}" end -Using the `resource_path` method will automatically declare two provider methods: +Using the `resource_path` method will automatically declare two provider methods: * `exists?` (which checks if the resource path exists) * `destroy` (which removes the resource path and saves the tree) @@ -223,7 +223,7 @@ Augeas has two ways of representing array values in its trees, using either fix For this reason, property accessors offer 3 ways to manage arrays, using the `sublabel` option: * the values are all the nodes matching the path with the given label (`sublabel` not set), e.g. for `foo => ["bar", "baz"]`: - + attr_aug_accessor(:foo, :type => :array ) @@ -235,7 +235,7 @@ For this reason, property accessors offer 3 ways to manage arrays, using the `su { "foo" = "baz" } } * the values are sub-nodes of the path with the given label (`sublabel` set to the label of the sub-nodes), e.g. for `foo => ["bar", "baz"]`: - + attr_aug_accessor(:foo, :type => :array, :sublabel => 'sub' @@ -249,7 +249,7 @@ For this reason, property accessors offer 3 ways to manage arrays, using the `su { "sub" = "baz" } } } * the values are sequential entries under the path with the given label (`sublabel` set to `:seq`), e.g. for `foo => ["bar", "baz"]`: - + attr_aug_accessor(:foo, :type => :array, :sublabel => :seq @@ -267,7 +267,7 @@ In all cases, all existing values are purged before setting the target values. ##### Hash value -In the Augeas tree, hash values are represented by sub-nodes, with optional values (the `:sublabel` option is used to set the value node name). When no value is found in the tree, the accessor method will default to the value of the `:default` option. +In the Augeas tree, hash values are represented by sub-nodes, with optional values (the `:sublabel` option is used to set the value node name). When no value is found in the tree, the accessor method will default to the value of the `:default` option. For example, given `foo => { "a" => "bar", "b" => "baz" }`, with: From 3856e1c2e4287cd90129d2e035ae80730ebd036d Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:20:56 +0100 Subject: [PATCH 28/51] modulesync: manage spec_helper_acceptance.rb --- .sync.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .sync.yml diff --git a/.sync.yml b/.sync.yml new file mode 100644 index 0000000..5d21319 --- /dev/null +++ b/.sync.yml @@ -0,0 +1,3 @@ +--- +spec/spec_helper_acceptance.rb: + unmanaged: false From c2f627795d41ffd37409a52187b3a3d340393ba2 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 14:26:23 +0100 Subject: [PATCH 29/51] spec_helper.rb: Load shared examples --- .sync.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.sync.yml b/.sync.yml index 5d21319..c74bf2e 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,3 +1,6 @@ --- spec/spec_helper_acceptance.rb: unmanaged: false +spec/spec_helper.rb: + spec_overrides: + - "Dir[\"#{__dir__}/support/**/*.rb\"].sort.each { |f| require f }" From 446d9982b4250c7a2087e081c848dbe2958c447e Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 13:47:09 +0100 Subject: [PATCH 30/51] modulesync 5.1.0 --- .editorconfig | 15 ++ .github/CONTRIBUTING.md | 252 +++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE.md | 26 ++++ .github/PULL_REQUEST_TEMPLATE.md | 20 +++ .github/SECURITY.md | 3 + .github/workflows/ci.yml | 90 +++++++++++ .github/workflows/release.yml | 34 +++++ .gitignore | 49 +++--- .msync.yml | 5 + .overcommit.yml | 65 ++++++++ .pmtignore | 37 +++++ .puppet-lint.rc | 3 + .rspec | 5 + .rspec_parallel | 4 + .rubocop.yml | 6 + .travis.yml | 68 --------- .yardopts | 17 --- CONTRIBUTING.md | 56 ------- Dockerfile | 24 +++ Gemfile | 61 ++++---- Rakefile | 92 ++++++++--- spec/spec_helper.rb | 51 ++----- spec/spec_helper_acceptance.rb | 26 +--- 23 files changed, 723 insertions(+), 286 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/SECURITY.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .msync.yml create mode 100644 .overcommit.yml create mode 100644 .pmtignore create mode 100644 .puppet-lint.rc create mode 100644 .rspec create mode 100644 .rspec_parallel create mode 100644 .rubocop.yml delete mode 100644 .travis.yml delete mode 100644 .yardopts delete mode 100644 CONTRIBUTING.md create mode 100644 Dockerfile diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ecb10a8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# editorconfig.org + +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +tab_width = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..048d2b5 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,252 @@ +# Contribution guidelines + +## Table of contents + +* [Contributing](#contributing) +* [Writing proper commits - short version](#writing-proper-commits-short-version) +* [Writing proper commits - long version](#writing-proper-commits-long-version) +* [Dependencies](#dependencies) + * [Note for OS X users](#note-for-os-x-users) +* [The test matrix](#the-test-matrix) +* [Syntax and style](#syntax-and-style) +* [Running the unit tests](#running-the-unit-tests) +* [Unit tests in docker](#unit-tests-in-docker) +* [Integration tests](#integration-tests) + +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little more quickly. + +## Contributing + +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +[Contributor Code of Conduct](https://voxpupuli.org/coc/). + +* Fork the repo. +* Create a separate branch for your change. +* We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. +* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. +* Squash your commits down into logical components. Make sure to rebase against our current master. +* Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review your code. + +Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! + +## Writing proper commits - short version + +* Make commits of logical units. +* Check for unnecessary whitespace with "git diff --check" before committing. +* Commit using Unix line endings (check the settings around "crlf" in git-config(1)). +* Do not check in commented out code or unneeded files. +* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. +* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". +* The body should provide a meaningful commit message, which: + *uses the imperative, present tense: `change`, not `changed` or `changes`. + * includes motivation for the change, and contrasts its implementation with the previous behavior. + * Make sure that you have tests for the bug you are fixing, or feature you are adding. + * Make sure the test suites passes after your commit: + * When introducing a new feature, make sure it is properly documented in the README.md + +## Writing proper commits - long version + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on `master`. + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +By default the tests use a baseline version of Puppet. + +If you have Ruby 2.x or want a specific version of Puppet, +you must set an environment variable such as: + +```sh +export PUPPET_VERSION="~> 5.5.6" +``` + +You can install all needed gems for spec tests into the modules directory by +running: + +```sh +bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" +``` + +If you also want to run acceptance tests: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +``` + +Our all in one solution if you don't know if you need to install or update gems: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +``` + +As an alternative to the `--jobs "$(nproc)` parameter, you can set an +environment variable: + +```sh +BUNDLE_JOBS="$(nproc)" +``` + +### Note for OS X users + +`nproc` isn't a valid command under OS x. As an alternative, you can do: + +```sh +--jobs "$(sysctl -n hw.ncpu)" +``` + +## The test matrix + +### Syntax and style + +The test suite will run [Puppet Lint](http://puppet-lint.com/) and +[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to +check various syntax and style things. You can run these locally with: + +```sh +bundle exec rake lint +bundle exec rake validate +``` + +It will also run some [Rubocop](http://batsov.com/rubocop/) tests +against it. You can run those locally ahead of time with: + +```sh +bundle exec rake rubocop +``` + +### Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. + +To run the linter, the syntax checker and the unit tests: + +```sh +bundle exec rake test +``` + +To run your all the unit tests + +```sh +bundle exec rake spec +``` + +To run a specific spec test set the `SPEC` variable: + +```sh +bundle exec rake spec SPEC=spec/foo_spec.rb +``` + +#### Unit tests in docker + +Some people don't want to run the dependencies locally or don't want to install +ruby. We ship a Dockerfile that enables you to run all unit tests and linting. +You only need to run: + +```sh +docker build . +``` + +Please ensure that a docker daemon is running and that your user has the +permission to talk to it. You can specify a remote docker host by setting the +`DOCKER_HOST` environment variable. it will copy the content of the module into +the docker image. So it will not work if a Gemfile.lock exists. + +### Integration tests + +The unit tests just check the code runs, not that it does exactly what +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +This fires up a new virtual machine (using vagrant) and runs a series of +simple tests against it after applying the module. You can run this +with: + +```sh +BEAKER_setfile=debian10-x64 bundle exec rake beaker +``` + +You can replace the string `debian10` with any common operating system. +The following strings are known to work: + +* ubuntu1604 +* ubuntu1804 +* ubuntu2004 +* debian9 +* debian10 +* centos7 +* centos8 + +For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). + +The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) +repository. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..593e7aa --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..342807b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..cacadf2 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Vox Pupuli Security Policy + +Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d08d05e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: CI + +on: pull_request + +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + +jobs: + setup_matrix: + name: 'Setup Test Matrix' + runs-on: ubuntu-latest + timeout-minutes: 40 + outputs: + puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} + github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} + env: + BUNDLE_WITHOUT: development:system_tests:release + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Run static validations + run: bundle exec rake validate lint check + - name: Run rake rubocop + run: bundle exec rake rubocop + - name: Setup Test Matrix + id: get-outputs + run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false + + unit: + needs: setup_matrix + runs-on: ubuntu-latest + timeout-minutes: 40 + strategy: + fail-fast: false + matrix: + include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} + env: + BUNDLE_WITHOUT: development:system_tests:release + PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" + name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake parallel_spec + + acceptance: + needs: setup_matrix + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: development:test:release + strategy: + fail-fast: false + matrix: + include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} + name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} + BEAKER_setfile: ${{ matrix.setfile.value }} + + tests: + needs: + - unit + - acceptance + runs-on: ubuntu-latest + name: Test suite + steps: + - run: echo Test suite completed diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..664ba69 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: development:test:system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + if: github.repository_owner == 'voxpupuli' + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Build and Deploy + env: + # Configure secrets here: + # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets + BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' + BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' + run: bundle exec rake module:push diff --git a/.gitignore b/.gitignore index 94145ab..9b95224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,23 @@ -pkg -coverage +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +pkg/ +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ .bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ .librarian/ -.tmp/ -modules/ -_site/ -spec/fixtures/manifests -spec/fixtures/modules -yardoc/ +Puppetfile.lock +*.iml +.*.sw? .yardoc/ - -## Ruby -.rvmrc* -.rbenv* -.ruby-* - -## MAC OS -.DS_Store - -## TEXTMATE -*.tmproj -tmtags - -## EMACS -*~ -\#* -.\#* - -## VIM -*.swp -tags +Guardfile diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 0000000..a83abd9 --- /dev/null +++ b/.msync.yml @@ -0,0 +1,5 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +modulesync_config_version: '5.1.0' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 0000000..d367ada --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,65 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + PuppetLint: + enabled: true + description: 'Runs puppet-lint on modified files only' + command: ['bundle', 'exec', 'puppet-lint'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'validate' + - 'test' + - 'rubocop' + command: ['bundle', 'exec', 'rake'] diff --git a/.pmtignore b/.pmtignore new file mode 100644 index 0000000..65f5051 --- /dev/null +++ b/.pmtignore @@ -0,0 +1,37 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +docs/ +pkg/ +Gemfile +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/ +Rakefile +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.github/ +.librarian/ +Puppetfile.lock +*.iml +.editorconfig +.fixtures.yml +.gitignore +.msync.yml +.overcommit.yml +.pmtignore +.rspec +.rspec_parallel +.rubocop.yml +.sync.yml +.*.sw? +.yardoc/ +.yardopts +Dockerfile diff --git a/.puppet-lint.rc b/.puppet-lint.rc new file mode 100644 index 0000000..dd8272c --- /dev/null +++ b/.puppet-lint.rc @@ -0,0 +1,3 @@ +--fail-on-warnings +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..f634583 --- /dev/null +++ b/.rspec @@ -0,0 +1,5 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +--format documentation +--color diff --git a/.rspec_parallel b/.rspec_parallel new file mode 100644 index 0000000..a9a84f8 --- /dev/null +++ b/.rspec_parallel @@ -0,0 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +--format progress diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..53ac189 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,6 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +inherit_gem: + voxpupuli-test: rubocop.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 25b0d39..0000000 --- a/.travis.yml +++ /dev/null @@ -1,68 +0,0 @@ -language: ruby -rvm: - - 2.0.0 -notifications: - email: - - dcleal@redhat.com - - raphael.pinson@camptocamp.com -env: - # Most tests with oldest supported ruby-augeas - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=3.0.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=3.2.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - # Test the latest ruby-augeas (~>) - - PUPPET=3.2.0 RUBY_AUGEAS=0.5 - - PUPPET=3.4 RUBY_AUGEAS=0.5 - # Test other versions of Augeas - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=0.10.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=0.10.0 - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.2.0 - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.2.0 - # Issue #83: test old Augeas with new lenses - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 LENSES=HEAD - - PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 LENSES=HEAD - - PUPPET=3.4 RUBY_AUGEAS=0.5 AUGEAS=1.0.0 LENSES=HEAD - - PUPPET=3.4 RUBY_AUGEAS=0.5 AUGEAS=1.1.0 LENSES=HEAD -matrix: - fast_finish: true - exclude: - # No support for Ruby 2.0 before Puppet 3.2.0 and ruby-augeas 0.5 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - rvm: 2.0.0 - env: PUPPET=3.0.0 RUBY_AUGEAS=0.3.0 - - rvm: 2.0.0 - env: PUPPET=3.2.0 RUBY_AUGEAS=0.3.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=0.10.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=0.10.0 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - rvm: 2.0.0 - env: PUPPET=2.7.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.2.0 - - rvm: 2.0.0 - env: PUPPET=3.0.0 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.2.0 - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.0.0 LENSES=HEAD - - rvm: 2.0.0 - env: PUPPET=3.4 RUBY_AUGEAS=0.3.0 AUGEAS=1.1.0 LENSES=HEAD -install: - - "travis_retry ./.travis.sh" -script: - - AUGEAS_LENS_LIB=augeas/lenses bundle exec rake diff --git a/.yardopts b/.yardopts deleted file mode 100644 index ae42c20..0000000 --- a/.yardopts +++ /dev/null @@ -1,17 +0,0 @@ ---protected ---private ---verbose ---markup markdown ---readme README.md ---tag status ---transitive-tag status ---tag comment ---hide-tag comment ---tag dsl:"DSL" ---no-transitive-tag api ---template-path yardoc/templates ---api public ---api private ---hide-void-return ---output-dir yardoc/ -lib/augeasproviders/**/*.rb diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 5e3dff2..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,56 +0,0 @@ -# Contributing to augeasproviders - -[![Build Status](https://secure.travis-ci.org/hercules-team/augeasproviders.png?branch=master)](http://travis-ci.org/hercules-team/augeasproviders) - -## Writing tests - -Tests for a `typename` provider live at `spec/unit/puppet/typename_spec.rb` and -their corresponding fixture (starting file) under -`spec/fixture/unit/puppet/typename/`. - -Use an rspec context section per fixture and have multiple examples within the -section using it. - -Tests use real resources which are applied via the -`AugeasSpec::Fixtures::apply` method to a temporary file created from the -original fixture. Once applied, the temporary file is tested using one of -two methods: - -1. Load file with ruby-augeas (`aug_open` helper) and perform match/get queries -to test particular features of the tree. -1. Define whole or part of the tree in augparse `{ }` syntax and use `augparse` -or `augparse_filter` helpers to compare the file against the expected tree. - -The latter will be much easier and more robust as it will compare all aspects -of the tree, while the first might be needed for some edge cases (empty files -etc). - -See also this writeup on [testing techniques for Puppet providers using -Augeas](http://m0dlx.com/blog/Testing_techniques_for_Puppet_providers_using_Augeas.html) -which shows this process for augeasproviders. - -Execute `rake spec` in the root directory to run all tests. - -## Thoughts about testing methods - -After applying the resource, there are a few ways we could test the results of -the file. - -* use augparse? No API today, could generate module file and shell out. -* use Config::Augeas::Validator? Need to write separate rules, no rootdir - support and is Perl, not Ruby. -* use XML comparison? No ruby-augeas support for aug_to_xml. -* use ruby-augeas? Using this as we can test for specific nodes, values etc - and compare with rspec. -* use File.read + rspec? Comparing the whole file will be a problem if Augeas - lenses change whitespace. - -## Requirements - -Install bundler and run `bundle install` to get all gems required for -development or see the contents of Gemfile. - -## Patches - -Please send pull requests via GitHub, or patches via git send-email to the -author. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e3cf307 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# MANAGED BY MODULESYNC +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +FROM ruby:2.7 + +WORKDIR /opt/puppet + +# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 +RUN mkdir -p /etc/sv + +ARG PUPPET_VERSION="~> 6.0" +ARG PARALLEL_TEST_PROCESSORS=4 + +# Cache gems +COPY Gemfile . +RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} + +COPY . . + +RUN bundle install +RUN bundle exec rake release_checks + +# Container should not saved +RUN exit 1 diff --git a/Gemfile b/Gemfile index dff3d52..b6dcf45 100644 --- a/Gemfile +++ b/Gemfile @@ -1,37 +1,34 @@ -source 'https://rubygems.org' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -if ENV.key?('PUPPET') - puppetversion = "~> #{ENV['PUPPET']}" -else - puppetversion = ['>= 2.7'] -end -gem 'puppet', puppetversion - -if ENV.key?('RUBY_AUGEAS') - if ENV['RUBY_AUGEAS'] == '0.3.0' - # pre-0.4.1 versions aren't available on rubygems - rbaugversion = {:git => 'git://github.com/domcleal/ruby-augeas.git', :branch => '0.3.0-gem'} - else - rbaugversion = "~> #{ENV['RUBY_AUGEAS']}" - end -else - rbaugversion = ['~> 0.3'] +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +group :test do + gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 1.0', :require => false end -gem 'ruby-augeas', rbaugversion group :development do - gem 'puppet-lint' - gem 'puppet-syntax' - gem 'puppetlabs_spec_helper', '>= 0.4.1' - gem 'rake' - gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git', :ref => '544b168' - gem 'simplecov' - gem 'yard' - gem 'redcarpet', '~> 2.0' - gem 'pry' - gem 'beaker', :require => false, :git => 'https://github.com/puppetlabs/beaker', :ref => 'dbac20fe9' - gem 'beaker-rspec', :require => false - gem 'vagrant-wrapper', :require => false - - gem 'coveralls' unless RUBY_VERSION =~ /^1\.8/ + gem 'guard-rake', :require => false + gem 'overcommit', '>= 0.39.1', :require => false end + +group :system_tests do + gem 'voxpupuli-acceptance', '~> 1.0', :require => false +end + +group :release do + gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' + gem 'voxpupuli-release', '>= 1.2.0', :require => false + gem 'puppet-strings', '>= 2.2', :require => false +end + +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] + +puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +gem 'puppet', puppetversion, :require => false, :groups => [:test] + +# vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 8490143..f92f051 100644 --- a/Rakefile +++ b/Rakefile @@ -1,30 +1,72 @@ -require 'rubygems' -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet-lint/tasks/puppet-lint' -require 'yard' - -exclude_paths = [ - "pkg/**/*", - "vendor/**/*", - "spec/**/*", -] - -task :default => [:spec, :yard, :syntax, :lint] - -desc "Run acceptance tests" -RSpec::Core::RakeTask.new(:acceptance) do |t| - t.pattern = 'spec/acceptance' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end end -YARD::Rake::YardocTask.new do |t| - t.options = [] +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError end -# Disable puppet-lint checks -PuppetLint.configuration.send("disable_80chars") -PuppetLint.configuration.send("disable_class_inherits_from_params_class") +# load optional tasks for releases +# only available if gem group releases is installed +begin + require 'voxpupuli/release/rake_tasks' +rescue LoadError +end -# Ignore files outside this module -PuppetLint.configuration.ignore_paths = exclude_paths -PuppetSyntax.exclude_paths = exclude_paths +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__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' + end +end + +desc 'Generate REFERENCE.md' +task :reference, [:debug, :backtrace] do |t, args| + patterns = '' + Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) +end + +begin + require 'github_changelog_generator/task' + require 'puppet_blacksmith' + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + metadata = Blacksmith::Modulefile.new + config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ + config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} + config.user = 'voxpupuli' + config.project = metadata.metadata['name'] + end + + # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 + require 'rbconfig' + if RbConfig::CONFIG['host_os'] =~ /linux/ + task :changelog do + puts 'Fixing line endings...' + changelog_file = File.join(__dir__, 'CHANGELOG.md') + changelog_txt = File.read(changelog_file) + new_contents = changelog_txt.gsub(%r{\r\n}, "\n") + File.open(changelog_file, "w") {|file| file.puts new_contents } + end + end + +rescue LoadError +end +# vim: syntax=ruby diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 95b4c2b..270d176 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,44 +1,19 @@ -require 'pathname' -dir = Pathname.new(__FILE__).parent -$LOAD_PATH.unshift(dir, File.join(dir, 'fixtures/modules/augeasproviders_core/spec/lib'), File.join(dir, '..', 'lib')) +# frozen_string_literal: true -require 'rubygems' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -require 'simplecov' -unless RUBY_VERSION =~ /^1\.8/ - require 'coveralls' - SimpleCov.formatter = Coveralls::SimpleCov::Formatter -end -SimpleCov.start do - add_group "AugeasProviders Libs", "/lib/augeasproviders/" - add_group "Puppet Types", "/lib/puppet/type/" - add_group "Puppet Providers", "/lib/puppet/provider/" - add_group "Augeas Spec Lib", "/spec/lib/" - - add_filter "/spec/fixtures/" - add_filter "/spec/unit/" - add_filter "/spec/support/" -end - -require 'puppetlabs_spec_helper/module_spec_helper' -require 'augeas_spec' +# 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', __dir__)) -Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules') +require 'voxpupuli/test/spec_helper' -# There's no real need to make this version dependent, but it helps find -# regressions in Puppet -# -# 1. Workaround for issue #16277 where default settings aren't initialised from -# a spec and so the libdir is never initialised (3.0.x) -# 2. Workaround for 2.7.20 that now only loads types for the current node -# environment (#13858) so Puppet[:modulepath] seems to get ignored -# 3. Workaround for 3.5 where context hasn't been configured yet, -# ticket https://tickets.puppetlabs.com/browse/MODULES-823 -# -ver = Gem::Version.new(Puppet.version.split('-').first) -if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver - Dir["#{dir}/fixtures/modules/*/lib"].each { |l| $LOAD_PATH.unshift(l) } +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + facts&.each do |name, value| + add_custom_fact name.to_sym, value + end end -# Load all shared contexts and shared examples -Dir["#{dir}/support/**/*.rb"].sort.each {|f| require f} +Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 748c1d3..d3a6e23 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,26 +1,10 @@ # frozen_string_literal: true -require 'beaker-rspec/spec_helper' -require 'beaker-rspec/helpers/serverspec' -hosts.each do |_host| - # Install Puppet - install_puppet -end +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) +require 'voxpupuli/acceptance/spec_helper_acceptance' - # Readable test descriptions - c.formatter = :documentation +configure_beaker - # Configure all nodes in nodeset - c.before :suite do - # Install module and dependencies - puppet_module_install(source: proj_root, module_name: 'augeasproviders') - - hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs/stdlib'), { acceptable_exit_codes: [0, 1] } - end - end -end +Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f } From e9a4d2caed815a9913de2770793e68d073127fdf Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 2 Dec 2021 15:02:01 +0100 Subject: [PATCH 31/51] Drop EoL operating systems from metadata.json --- metadata.json | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/metadata.json b/metadata.json index 8ab6d8d..052f597 100644 --- a/metadata.json +++ b/metadata.json @@ -66,34 +66,27 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "7", - "8", - "9" + "10", + "11" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04", - "16.04", "18.04", - "18.10", "20.04" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "6", "7", - "8", - "9" + "8" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "6", "7", "8", "9" @@ -122,7 +115,6 @@ { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "6", "7", "8" ] From ebef3f85e1bb4408a9687d79d4cc21d826624f5a Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Sun, 14 Aug 2022 18:26:21 -0400 Subject: [PATCH 32/51] Update from voxpupuli modulesync_config --- .github/CONTRIBUTING.md | 7 ++- .github/workflows/ci.yml | 84 +++-------------------------------- .github/workflows/release.yml | 32 +++++-------- .msync.yml | 2 +- Dockerfile | 2 +- Gemfile | 6 +-- spec/spec_helper.rb | 2 + 7 files changed, 26 insertions(+), 109 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 048d2b5..8b466cf 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet, you must set an environment variable such as: ```sh -export PUPPET_VERSION="~> 5.5.6" +export PUPPET_GEM_VERSION="~> 6.1.0" ``` You can install all needed gems for spec tests into the modules directory by @@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian10-x64 bundle exec rake beaker +BEAKER_setfile=debian11-64 bundle exec rake beaker ``` You can replace the string `debian10` with any common operating system. The following strings are known to work: -* ubuntu1604 * ubuntu1804 * ubuntu2004 -* debian9 * debian10 +* debian11 * centos7 * centos8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d08d05e..8a07791 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,84 +7,12 @@ name: CI on: pull_request concurrency: - group: ${{ github.head_ref }} + group: ${{ github.ref_name }} cancel-in-progress: true jobs: - setup_matrix: - name: 'Setup Test Matrix' - runs-on: ubuntu-latest - timeout-minutes: 40 - outputs: - puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} - github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} - env: - BUNDLE_WITHOUT: development:system_tests:release - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run static validations - run: bundle exec rake validate lint check - - name: Run rake rubocop - run: bundle exec rake rubocop - - name: Setup Test Matrix - id: get-outputs - run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false - - unit: - needs: setup_matrix - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} - env: - BUNDLE_WITHOUT: development:system_tests:release - PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" - name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run tests - run: bundle exec rake parallel_spec - - acceptance: - needs: setup_matrix - runs-on: ubuntu-latest - env: - BUNDLE_WITHOUT: development:test:release - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} - name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run tests - run: bundle exec rake beaker - env: - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} - BEAKER_setfile: ${{ matrix.setfile.value }} - - tests: - needs: - - unit - - acceptance - runs-on: ubuntu-latest - name: Test suite - steps: - - run: echo Test suite completed + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + with: + pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 664ba69..15f1721 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,26 +9,14 @@ on: tags: - '*' -env: - BUNDLE_WITHOUT: development:test:system_tests - jobs: - deploy: - name: 'deploy to forge' - runs-on: ubuntu-latest - if: github.repository_owner == 'voxpupuli' - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Build and Deploy - env: - # Configure secrets here: - # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets - BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' - BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' - run: bundle exec rake module:push + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.msync.yml b/.msync.yml index a83abd9..0235385 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.1.0' +modulesync_config_version: '5.3.0' diff --git a/Dockerfile b/Dockerfile index e3cf307..8dd82d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /opt/puppet # https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 RUN mkdir -p /etc/sv -ARG PUPPET_VERSION="~> 6.0" +ARG PUPPET_GEM_VERSION="~> 6.0" ARG PARALLEL_TEST_PROCESSORS=4 # Cache gems diff --git a/Gemfile b/Gemfile index b6dcf45..07209b7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,10 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -source ENV['GEM_SOURCE'] || "https://rubygems.org" +source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -28,7 +28,7 @@ end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 270d176..86dd55f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,8 @@ require 'voxpupuli/test/spec_helper' +add_mocked_facts! + if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) facts&.each do |name, value| From 4b894d13b214fce5ef89469f90b6b3ab13a19ef1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 2 Oct 2022 14:28:22 +0200 Subject: [PATCH 33/51] modulesync 5.3.0 --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index f92f051..b88386b 100644 --- a/Rakefile +++ b/Rakefile @@ -52,7 +52,7 @@ begin config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.user = 'voxpupuli' - config.project = metadata.metadata['name'] + config.project = 'puppet-augeasproviders' end # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 From 1c700fc06b1680bcf08237d77bb68378c3f66a7a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 20 Dec 2022 14:28:44 +0100 Subject: [PATCH 34/51] modulesync 5.4.0 --- .msync.yml | 2 +- Gemfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.msync.yml b/.msync.yml index 0235385..f3156d1 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.3.0' +modulesync_config_version: '5.4.0' diff --git a/Gemfile b/Gemfile index 07209b7..b3827ba 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 1.0', :require => false + gem 'puppet_metadata', '~> 2.0', :require => false end group :development do From 581e979894dff84e96b40c565dac5ef58c02b134 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Sat, 15 Apr 2023 09:50:06 +0200 Subject: [PATCH 35/51] modulesync 5.5.0 --- .github/SECURITY.md | 3 --- .gitignore | 36 ++++++++++++------------- .msync.yml | 2 +- .pmtignore | 64 ++++++++++++++++++++++----------------------- Gemfile | 3 +-- Rakefile | 36 +++---------------------- 6 files changed, 56 insertions(+), 88 deletions(-) delete mode 100644 .github/SECURITY.md diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index cacadf2..0000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,3 +0,0 @@ -# Vox Pupuli Security Policy - -Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.gitignore b/.gitignore index 9b95224..84fd904 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,23 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -pkg/ -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.librarian/ -Puppetfile.lock +/pkg/ +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/ +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.librarian/ +/Puppetfile.lock *.iml .*.sw? -.yardoc/ -Guardfile +/.yardoc/ +/Guardfile diff --git a/.msync.yml b/.msync.yml index f3156d1..a4b0069 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.4.0' +modulesync_config_version: '5.5.0' diff --git a/.pmtignore b/.pmtignore index 65f5051..58a0408 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,37 +1,37 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -docs/ -pkg/ -Gemfile -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/ -Rakefile -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.github/ -.librarian/ -Puppetfile.lock +/docs/ +/pkg/ +/Gemfile +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/ +/Rakefile +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.github/ +/.librarian/ +/Puppetfile.lock *.iml -.editorconfig -.fixtures.yml -.gitignore -.msync.yml -.overcommit.yml -.pmtignore -.rspec -.rspec_parallel -.rubocop.yml -.sync.yml +/.editorconfig +/.fixtures.yml +/.gitignore +/.msync.yml +/.overcommit.yml +/.pmtignore +/.rspec +/.rspec_parallel +/.rubocop.yml +/.sync.yml .*.sw? -.yardoc/ -.yardopts -Dockerfile +/.yardoc/ +/.yardopts +/Dockerfile diff --git a/Gemfile b/Gemfile index b3827ba..15313c3 100644 --- a/Gemfile +++ b/Gemfile @@ -21,8 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.2.0', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'voxpupuli-release', '~> 2.0', :require => false end gem 'rake', :require => false diff --git a/Rakefile b/Rakefile index b88386b..fc01f6b 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,10 @@ end begin require 'voxpupuli/release/rake_tasks' rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = 'voxpupuli' + GCGConfig.project = 'puppet-augeasproviders' end desc "Run main 'test' task and report merged results to coveralls" @@ -37,36 +41,4 @@ task test_with_coveralls: [:test] do end end -desc 'Generate REFERENCE.md' -task :reference, [:debug, :backtrace] do |t, args| - patterns = '' - Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) -end - -begin - require 'github_changelog_generator/task' - require 'puppet_blacksmith' - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - metadata = Blacksmith::Modulefile.new - config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ - config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." - config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} - config.user = 'voxpupuli' - config.project = 'puppet-augeasproviders' - end - - # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 - require 'rbconfig' - if RbConfig::CONFIG['host_os'] =~ /linux/ - task :changelog do - puts 'Fixing line endings...' - changelog_file = File.join(__dir__, 'CHANGELOG.md') - changelog_txt = File.read(changelog_file) - new_contents = changelog_txt.gsub(%r{\r\n}, "\n") - File.open(changelog_file, "w") {|file| file.puts new_contents } - end - end - -rescue LoadError -end # vim: syntax=ruby From c47703cf7f7dd6a3e8809d29d92a4bd9d04d95fd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 May 2023 10:42:41 +0200 Subject: [PATCH 36/51] modulesync 6.0.0 --- .msync.yml | 2 +- Gemfile | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.msync.yml b/.msync.yml index a4b0069..b929160 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.5.0' +modulesync_config_version: '6.0.0' diff --git a/Gemfile b/Gemfile index 15313c3..98a04cf 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.4', :require => false + gem 'voxpupuli-test', '~> 6.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 2.0', :require => false + gem 'puppet_metadata', '~> 3.0', :require => false end group :development do @@ -16,18 +16,19 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 1.0', :require => false + gem 'voxpupuli-acceptance', '~> 2.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '~> 2.0', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false + gem 'faraday-retry', '~> 2.1', :require => false end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From c138042bbebae19e60e1af9f6af070bbd1483763 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 17 Aug 2023 14:21:29 +0200 Subject: [PATCH 37/51] modulesync 7.0.0 --- .github/CONTRIBUTING.md | 11 +++++++---- .msync.yml | 2 +- Gemfile | 2 +- spec/spec_helper.rb | 1 + spec/spec_helper_acceptance.rb | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cf..6aaa603 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian11-64 bundle exec rake beaker +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` -You can replace the string `debian10` with any common operating system. +You can replace the string `debian11` with any common operating system. The following strings are known to work: -* ubuntu1804 * ubuntu2004 -* debian10 +* ubuntu2204 * debian11 * centos7 * centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). diff --git a/.msync.yml b/.msync.yml index b929160..dd3e957 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '6.0.0' +modulesync_config_version: '7.0.0' diff --git a/Gemfile b/Gemfile index 98a04cf..db21d3b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 6.0', :require => false + gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 3.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 86dd55f..fe60acb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,3 +19,4 @@ end Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f } +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d3a6e23..2681792 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -5,6 +5,6 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' -configure_beaker +configure_beaker(modules: :metadata) Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f } From adbdfafa6f558f0f46bf9dde6b7e05cf6c921d8c Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Fri, 22 Sep 2023 13:25:02 +0200 Subject: [PATCH 38/51] WARNING: lint:endignore comment with no opening lint:ignore: comment found on line 29 --- manifests/params.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 596932c..59f8406 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -26,5 +26,4 @@ 'sysctl' => $defaults, 'syslog' => $defaults, } - # lint:endignore } From 29351c94408aa22162e052afe6be4a5dd0bfa18b Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Fri, 22 Sep 2023 13:44:27 +0200 Subject: [PATCH 39/51] Error messages changed since stronger typing added --- spec/classes/augeasproviders_instances_spec.rb | 2 +- spec/support/validate_hash.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/classes/augeasproviders_instances_spec.rb b/spec/classes/augeasproviders_instances_spec.rb index 16b220e..af369e3 100644 --- a/spec/classes/augeasproviders_instances_spec.rb +++ b/spec/classes/augeasproviders_instances_spec.rb @@ -9,7 +9,7 @@ context "when resource_defaults => 'foo'" do let(:params) { { resource_defaults: 'foo' } } - it { expect { is_expected.to create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, %r{is not a Hash}) } + it { expect { is_expected.to create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, %r{expects a Hash value, got String}) } end %w[ diff --git a/spec/support/validate_hash.rb b/spec/support/validate_hash.rb index 28fa7a4..ba10d71 100644 --- a/spec/support/validate_hash.rb +++ b/spec/support/validate_hash.rb @@ -5,7 +5,7 @@ let(:params) { { hash_param_name.to_sym => 'FOO' } } let(:facts) { {} } - it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{is not a Hash}) } + it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{expects a Hash value, got String}) } end end @@ -14,6 +14,6 @@ let(:params) { {} } let(:facts) { { hash_variable_name.to_sym => 'FOO' } } - it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{is not a Hash}) } + it { expect { is_expected.to create_class('augeasproviders') }.to raise_error(Puppet::Error, %r{expects a Hash value, got String}) } end end From b781b6987b635d7dfdb14a143141bb35f69da88a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 15 Dec 2023 11:46:33 +0100 Subject: [PATCH 40/51] modulesync 7.2.0 --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- .msync.yml | 2 +- .pmtignore | 1 + Gemfile | 8 +++----- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a07791..b66d8ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,6 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 with: pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15f1721..55324aa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index dd3e957..f818344 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.0.0' +modulesync_config_version: '7.2.0' diff --git a/.pmtignore b/.pmtignore index 58a0408..10b9830 100644 --- a/.pmtignore +++ b/.pmtignore @@ -35,3 +35,4 @@ /.yardoc/ /.yardopts /Dockerfile +/HISTORY.md diff --git a/Gemfile b/Gemfile index db21d3b..a4a3b20 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 3.0', :require => false + gem 'puppet_metadata', '~> 3.5', :require => false end group :development do @@ -16,13 +16,11 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 2.0', :require => false + gem 'voxpupuli-acceptance', '~> 3.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false - gem 'voxpupuli-release', '~> 3.0', :require => false - gem 'faraday-retry', '~> 2.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false end gem 'rake', :require => false From 28daee8d1d4afccdea02f372c04ac827feee8614 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 6 Feb 2024 12:23:03 +0100 Subject: [PATCH 41/51] modulesync 7.3.0 --- .github/workflows/ci.yml | 7 ++++++- .msync.yml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b66d8ca..7216724 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,12 @@ name: CI -on: pull_request +on: + pull_request: {} + push: + branches: + - main + - master concurrency: group: ${{ github.ref_name }} diff --git a/.msync.yml b/.msync.yml index f818344..f46ee02 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.2.0' +modulesync_config_version: '7.3.0' From f96cb9b458d00390b7f95ad961079c0eef1ff4da Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 5 Apr 2024 00:56:52 +0200 Subject: [PATCH 42/51] actually apply the sysctl hash to test --- spec/acceptance/augeasproviders_instances_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/acceptance/augeasproviders_instances_spec.rb b/spec/acceptance/augeasproviders_instances_spec.rb index 519089a..3c2f87b 100644 --- a/spec/acceptance/augeasproviders_instances_spec.rb +++ b/spec/acceptance/augeasproviders_instances_spec.rb @@ -24,7 +24,9 @@ class { 'augeasproviders::instances': it 'runs successfully' do pp = <<-EOS $augeasproviders_sysctl_hash = { 'net.ipv4.ip_forward' => { 'value' => '0' } } - class { 'augeasproviders::instances': } + class { 'augeasproviders::instances': + sysctl_hash => $augeasproviders_sysctl_hash, + } EOS apply_manifest(pp, catch_failures: true) From 72e14164eca43a42aef6003898226a366506b567 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 5 Apr 2024 19:12:59 +0200 Subject: [PATCH 43/51] rewrite check to use native rspec syntax --- spec/classes/augeasproviders_instances_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/augeasproviders_instances_spec.rb b/spec/classes/augeasproviders_instances_spec.rb index af369e3..5a4cb56 100644 --- a/spec/classes/augeasproviders_instances_spec.rb +++ b/spec/classes/augeasproviders_instances_spec.rb @@ -9,7 +9,7 @@ context "when resource_defaults => 'foo'" do let(:params) { { resource_defaults: 'foo' } } - it { expect { is_expected.to create_class('augeasproviders::instances') }.to raise_error(Puppet::Error, %r{expects a Hash value, got String}) } + it { is_expected.to compile.and_raise_error(%r{expects a Hash value, got String}) } end %w[ From 607b3880444725edf258b7f5897db71d9f2b4d5b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 Apr 2024 13:05:50 +0200 Subject: [PATCH 44/51] modulesync 7.4.0 --- .github/CONTRIBUTING.md | 16 +++++++++++++--- .gitignore | 2 ++ .msync.yml | 2 +- Dockerfile | 24 ------------------------ 4 files changed, 16 insertions(+), 28 deletions(-) delete mode 100644 Dockerfile diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6aaa603..8809327 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -131,19 +131,29 @@ You can install all needed gems for spec tests into the modules directory by running: ```sh -bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" +bundle config set --local path '.vendor/' +bundle config set --local without 'development system_tests release' +bundle install --jobs "$(nproc)" ``` If you also want to run acceptance tests: ```sh -bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +bundle config set --local path '.vendor/' +bundle config set --local without 'development release' +bundle config set --local with 'system_tests' +bundle install --jobs "$(nproc)" ``` Our all in one solution if you don't know if you need to install or update gems: ```sh -bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +bundle config set --local path '.vendor/' +bundle config set --local without 'development release' +bundle config set --local with 'system_tests' +bundle install --jobs "$(nproc)" +bundle update +bundle clean ``` As an alternative to the `--jobs "$(nproc)` parameter, you can set an diff --git a/.gitignore b/.gitignore index 84fd904..adea1b0 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ .*.sw? /.yardoc/ /Guardfile +bolt-debug.log +.rerun.json diff --git a/.msync.yml b/.msync.yml index f46ee02..28b61dc 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.3.0' +modulesync_config_version: '7.4.0' diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8dd82d6..0000000 --- a/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# MANAGED BY MODULESYNC -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - -FROM ruby:2.7 - -WORKDIR /opt/puppet - -# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 -RUN mkdir -p /etc/sv - -ARG PUPPET_GEM_VERSION="~> 6.0" -ARG PARALLEL_TEST_PROCESSORS=4 - -# Cache gems -COPY Gemfile . -RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} - -COPY . . - -RUN bundle install -RUN bundle exec rake release_checks - -# Container should not saved -RUN exit 1 From 2378643466a9fe664837c08649898e3aebfe2de5 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 25 Apr 2024 16:31:16 +0200 Subject: [PATCH 45/51] modulesync 7.5.0 --- .msync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.msync.yml b/.msync.yml index 28b61dc..ade23f9 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.4.0' +modulesync_config_version: '7.5.0' From 54f1a47695c86d8e6b3c30dad78720a01fbe0217 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 3 Jun 2024 17:09:00 +0200 Subject: [PATCH 46/51] modulesync 8.0.0 --- .github/workflows/ci.yml | 2 -- .msync.yml | 2 +- .overcommit.yml | 8 +++++--- .rspec | 5 ----- .rspec_parallel | 4 ---- Gemfile | 4 ++-- 6 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 .rspec delete mode 100644 .rspec_parallel diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7216724..1f82c4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,5 +19,3 @@ jobs: puppet: name: Puppet uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 - with: - pidfile_workaround: 'false' diff --git a/.msync.yml b/.msync.yml index ade23f9..011e730 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.5.0' +modulesync_config_version: '8.0.0' diff --git a/.overcommit.yml b/.overcommit.yml index d367ada..4ed994c 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -43,10 +43,12 @@ PreCommit: enabled: true description: 'Runs rubocop on modified files only' command: ['bundle', 'exec', 'rubocop'] - PuppetLint: + RakeTarget: enabled: true - description: 'Runs puppet-lint on modified files only' - command: ['bundle', 'exec', 'puppet-lint'] + description: 'Runs lint on modified files only' + targets: + - 'lint' + command: ['bundle', 'exec', 'rake'] YamlSyntax: enabled: true JsonSyntax: diff --git a/.rspec b/.rspec deleted file mode 100644 index f634583..0000000 --- a/.rspec +++ /dev/null @@ -1,5 +0,0 @@ -# Managed by modulesync - DO NOT EDIT -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - ---format documentation ---color diff --git a/.rspec_parallel b/.rspec_parallel deleted file mode 100644 index a9a84f8..0000000 --- a/.rspec_parallel +++ /dev/null @@ -1,4 +0,0 @@ -# Managed by modulesync - DO NOT EDIT -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - ---format progress diff --git a/Gemfile b/Gemfile index a4a3b20..ec7b4cd 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 7.0', :require => false + gem 'voxpupuli-test', '~> 7.2', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 3.5', :require => false + gem 'puppet_metadata', '~> 4.0', :require => false end group :development do From 6663a35636af0e55075d50972ce1d83ad6b523ea Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 3 Jun 2024 18:19:37 +0200 Subject: [PATCH 47/51] modulesync 8.0.1 --- .msync.yml | 2 +- spec/spec.opts | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 spec/spec.opts diff --git a/.msync.yml b/.msync.yml index 011e730..876cb3b 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '8.0.0' +modulesync_config_version: '8.0.1' diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 91cd642..0000000 --- a/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace From 811d75b0aa7ff6162756442fad1c60360416b918 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 12 Jun 2024 11:06:56 +0200 Subject: [PATCH 48/51] modulesync 9.0.0 --- .github/labeler.yml | 3 +++ .msync.yml | 2 +- Gemfile | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .github/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..7899de8 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,3 @@ +--- +skip-changelog: + - head-branch: ['^release-*', 'release'] diff --git a/.msync.yml b/.msync.yml index 876cb3b..3607168 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '8.0.1' +modulesync_config_version: '9.0.0' diff --git a/Gemfile b/Gemfile index ec7b4cd..27cdc0d 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 7.2', :require => false + gem 'voxpupuli-test', '~> 8.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 4.0', :require => false From 7d7f6a18436e9b21d912813ddc7f8bd1f5018c51 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 9 Jul 2024 14:43:32 +0200 Subject: [PATCH 49/51] modulesync 9.1.0 --- .github/CONTRIBUTING.md | 12 ++++++++-- .github/labeler.yml | 3 +++ .github/release.yml | 42 +++++++++++++++++++++++++++++++++++ .github/workflows/labeler.yml | 17 ++++++++++++++ .github/workflows/release.yml | 7 ++++++ .msync.yml | 2 +- .puppet-lint.rc | 3 +++ Gemfile | 2 +- spec/spec_helper.rb | 4 ++++ 9 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 .github/release.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8809327..daceb64 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -245,15 +245,23 @@ with: BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` +or + +```sh +BEAKER_PUPPET_COLLECTION=none BEAKER_setfile=archlinux-64 bundle exec rake beaker +``` + +This latter example will use the distribution's own version of Puppet. + You can replace the string `debian11` with any common operating system. The following strings are known to work: * ubuntu2004 * ubuntu2204 * debian11 -* centos7 -* centos8 +* debian12 * centos9 +* archlinux * almalinux8 * almalinux9 * fedora36 diff --git a/.github/labeler.yml b/.github/labeler.yml index 7899de8..f2d08d6 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,3 +1,6 @@ --- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + skip-changelog: - head-branch: ['^release-*', 'release'] diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..f5b5d7a --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,42 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes + +changelog: + exclude: + labels: + - duplicate + - invalid + - modulesync + - question + - skip-changelog + - wont-fix + - wontfix + + categories: + - title: Breaking Changes 🛠 + labels: + - backwards-incompatible + + - title: New Features 🎉 + labels: + - enhancement + + - title: Bug Fixes 🐛 + labels: + - bug + + - title: Documentation Updates 📚 + labels: + - documentation + - docs + + - title: Dependency Updates ⬆️ + labels: + - dependencies + + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..66127cd --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,17 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: "Pull Request Labeler" + +on: + pull_request_target: {} + +jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55324aa..93b33c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,3 +20,10 @@ jobs: # https://docs.github.com/en/actions/security-guides/encrypted-secrets username: ${{ secrets.PUPPET_FORGE_USERNAME }} api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} + + create-github-release: + name: Create GitHub Release + runs-on: ubuntu-latest + steps: + - name: Create GitHub release + uses: voxpupuli/gha-create-a-github-release@v1 diff --git a/.msync.yml b/.msync.yml index 3607168..95e8c97 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.0.0' +modulesync_config_version: '9.1.0' diff --git a/.puppet-lint.rc b/.puppet-lint.rc index dd8272c..05d28a2 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,3 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --fail-on-warnings --no-parameter_documentation-check --no-parameter_types-check diff --git a/Gemfile b/Gemfile index 27cdc0d..7123c66 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 8.0', :require => false + gem 'voxpupuli-test', '~> 9.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 4.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fe60acb..5a5a9b3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,10 @@ require 'voxpupuli/test/spec_helper' +RSpec.configure do |c| + c.facterdb_string_keys = false +end + add_mocked_facts! if File.exist?(File.join(__dir__, 'default_module_facts.yml')) From 01a695f1d0386a759dec61a54b0f36ed5e9a8332 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 13 Sep 2024 13:49:48 +0200 Subject: [PATCH 50/51] modulesync 9.2.0 --- .github/workflows/ci.yml | 3 ++- .github/workflows/labeler.yml | 1 + .github/workflows/release.yml | 1 + .msync.yml | 2 +- .pmtignore | 1 + Gemfile | 2 +- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f82c4c..8c32acf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ name: CI +# yamllint disable-line rule:truthy on: pull_request: {} push: @@ -18,4 +19,4 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v3 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 66127cd..73be88d 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -4,6 +4,7 @@ name: "Pull Request Labeler" +# yamllint disable-line rule:truthy on: pull_request_target: {} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93b33c2..1b14775 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ name: Release +# yamllint disable-line rule:truthy on: push: tags: diff --git a/.msync.yml b/.msync.yml index 95e8c97..8606f6e 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.1.0' +modulesync_config_version: '9.2.0' diff --git a/.pmtignore b/.pmtignore index 10b9830..a9d37aa 100644 --- a/.pmtignore +++ b/.pmtignore @@ -20,6 +20,7 @@ /.github/ /.librarian/ /Puppetfile.lock +/Puppetfile *.iml /.editorconfig /.fixtures.yml diff --git a/Gemfile b/Gemfile index 7123c66..2ac98f8 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' +puppetversion = ENV['PUPPET_GEM_VERSION'] || [">= 7.24", "< 9"] gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From af953c1ee80c1c718e6e877aa45370a56b5dcbf8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 16 Sep 2024 20:13:12 +0200 Subject: [PATCH 51/51] modulesync 9.3.0 --- .github/workflows/release.yml | 2 +- .msync.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b14775..4adf65c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v3 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index 8606f6e..ac84b45 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.2.0' +modulesync_config_version: '9.3.0'