From e5d46560e4be3b5a17ce5c260f9ed1f051d731c3 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Sun, 27 Nov 2016 16:26:20 +0000 Subject: [PATCH 1/3] Update to require using stdlib 4.13 for deprecation function --- .fixtures.yml | 1 - .sync.yml | 3 +++ metadata.json | 2 +- spec/defines/setting_spec.rb | 4 +--- spec/spec_helper.rb | 8 -------- spec/spec_helper_acceptance.rb | 2 +- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 578437cb9f..0c221f0da7 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,6 +2,5 @@ fixtures: repositories: "stdlib": "repo": "git://github.com/puppetlabs/puppetlabs-stdlib.git" - "ref": "4.5.0" symlinks: "apt": "#{source_dir}" diff --git a/.sync.yml b/.sync.yml index bf2a8818d4..1e54e2104c 100644 --- a/.sync.yml +++ b/.sync.yml @@ -4,3 +4,6 @@ docker_sets: - set: docker/ubuntu-14.04 - set: docker/debian-8 + +spec/spec_helper.rb: + allow_deprecations: true diff --git a/metadata.json b/metadata.json index d34221c752..1b21a5c193 100644 --- a/metadata.json +++ b/metadata.json @@ -8,7 +8,7 @@ "project_page": "https://github.com/puppetlabs/puppetlabs-apt", "issues_url": "https://tickets.puppetlabs.com/browse/MODULES", "dependencies": [ - {"name":"puppetlabs/stdlib","version_requirement":">= 4.5.0 < 5.0.0"} + {"name":"puppetlabs/stdlib","version_requirement":">= 4.13.0 < 5.0.0"} ], "operatingsystem_support": [ { diff --git a/spec/defines/setting_spec.rb b/spec/defines/setting_spec.rb index a326bdbdd3..319074be2a 100644 --- a/spec/defines/setting_spec.rb +++ b/spec/defines/setting_spec.rb @@ -95,9 +95,7 @@ context 'with priority=1.2' do let(:params) { default_params.merge({ :priority => 1.2 }) } - it do - expect { subject.call }.to raise_error(Puppet::Error, /be an integer /) - end + it { is_expected.to compile.and_raise_error(/input needs to be a String/) } end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9ae37b1729..22d5d689f4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,14 +1,6 @@ #This file is generated by ModuleSync, do not edit. require 'puppetlabs_spec_helper/module_spec_helper' -if Puppet.version.to_f >= 4.5 - RSpec.configure do |c| - c.before :each do - Puppet.settings[:strict] = :error - end - end -end - # put local configuration and setup into spec_helper_local begin require 'spec_helper_local' diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index a5ce06fc45..3f87bd13da 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -44,7 +44,7 @@ def retry_on_error_matching(max_retry_count = 3, retry_wait_interval_secs = 5, e hosts.each do |host| copy_module_to(host, :source => proj_root, :module_name => 'apt') shell("/bin/touch #{default['puppetpath']}/hiera.yaml") - on host, puppet('module install puppetlabs-stdlib --version 4.5.0'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module install puppetlabs-stdlib --version 4.13.1') end end end From 71305efaf9ee58f3e4edbafb148dd01a022df706 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Sun, 27 Nov 2016 17:03:26 +0000 Subject: [PATCH 2/3] Use the stdlib deprecation() function --- manifests/key.pp | 10 +++++----- manifests/source.pp | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifests/key.pp b/manifests/key.pp index 914ec88ca4..148a751de6 100644 --- a/manifests/key.pp +++ b/manifests/key.pp @@ -14,35 +14,35 @@ ) { if $key != undef { - warning('$key is deprecated and will be removed in the next major release. Please use $id instead.') + deprecation('apt $key', '$key is deprecated and will be removed in the next major release. Please use $id instead.') $_id = $key } else { $_id = $id } if $key_content != undef { - warning('$key_content is deprecated and will be removed in the next major release. Please use $content instead.') + deprecation('apt $key_content', '$key_content is deprecated and will be removed in the next major release. Please use $content instead.') $_content = $key_content } else { $_content = $content } if $key_source != undef { - warning('$key_source is deprecated and will be removed in the next major release. Please use $source instead.') + deprecation('apt $key_source', '$key_source is deprecated and will be removed in the next major release. Please use $source instead.') $_source = $key_source } else { $_source = $source } if $key_server != undef { - warning('$key_server is deprecated and will be removed in the next major release. Please use $server instead.') + deprecation('apt $key_server', '$key_server is deprecated and will be removed in the next major release. Please use $server instead.') $_server = $key_server } else { $_server = $server } if $key_options != undef { - warning('$key_options is deprecated and will be removed in the next major release. Please use $options instead.') + deprecation('apt $key_options', '$key_options is deprecated and will be removed in the next major release. Please use $options instead.') $_options = $key_options } else { $_options = $options diff --git a/manifests/source.pp b/manifests/source.pp index 9adf6a2336..a189c5f456 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -30,15 +30,15 @@ $_before = Apt::Setting["list-${title}"] if $include_src != undef { - warning("\$include_src is deprecated and will be removed in the next major release, please use \$include => { 'src' => ${include_src} } instead") + deprecation('apt $include_src', "\$include_src is deprecated and will be removed in the next major release, please use \$include => { 'src' => ${include_src} } instead") } if $include_deb != undef { - warning("\$include_deb is deprecated and will be removed in the next major release, please use \$include => { 'deb' => ${include_deb} } instead") + deprecation('apt $include_deb', "\$include_deb is deprecated and will be removed in the next major release, please use \$include => { 'deb' => ${include_deb} } instead") } if $required_packages != undef { - warning('$required_packages is deprecated and will be removed in the next major release, please use package resources instead.') + deprecation('apt $required_packages', '$required_packages is deprecated and will be removed in the next major release, please use package resources instead.') exec { "Required packages: '${required_packages}' for ${name}": command => "${::apt::params::provider} -y install ${required_packages}", logoutput => 'on_failure', @@ -50,19 +50,19 @@ } if $key_server != undef { - warning("\$key_server is deprecated and will be removed in the next major release, please use \$key => { 'server' => ${key_server} } instead.") + deprecation('apt $key_server', "\$key_server is deprecated and will be removed in the next major release, please use \$key => { 'server' => ${key_server} } instead.") } if $key_content != undef { - warning("\$key_content is deprecated and will be removed in the next major release, please use \$key => { 'content' => ${key_content} } instead.") + deprecation('apt $key_content', "\$key_content is deprecated and will be removed in the next major release, please use \$key => { 'content' => ${key_content} } instead.") } if $key_source != undef { - warning("\$key_source is deprecated and will be removed in the next major release, please use \$key => { 'source' => ${key_source} } instead.") + deprecation('apt $key_source', "\$key_source is deprecated and will be removed in the next major release, please use \$key => { 'source' => ${key_source} } instead.") } if $trusted_source != undef { - warning('$trusted_source is deprecated and will be removed in the next major release, please use $allow_unsigned instead.') + deprecation('apt $trusted_source', '$trusted_source is deprecated and will be removed in the next major release, please use $allow_unsigned instead.') $_allow_unsigned = $trusted_source } else { $_allow_unsigned = $allow_unsigned From 253cb90b902d707a1f8c112400bf49cbaa39e42d Mon Sep 17 00:00:00 2001 From: Helen Campbell Date: Wed, 14 Dec 2016 14:37:54 +0000 Subject: [PATCH 3/3] Fix for tests against PR-641 --- spec/defines/setting_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/defines/setting_spec.rb b/spec/defines/setting_spec.rb index 319074be2a..e1163a0df8 100644 --- a/spec/defines/setting_spec.rb +++ b/spec/defines/setting_spec.rb @@ -95,7 +95,11 @@ context 'with priority=1.2' do let(:params) { default_params.merge({ :priority => 1.2 }) } - it { is_expected.to compile.and_raise_error(/input needs to be a String/) } + if Puppet.version.to_f >= 4.0 || ENV["FUTURE_PARSER"] == 'yes' + it { is_expected.to compile.and_raise_error(/input needs to be a String/) } + else + it { is_expected.to compile.and_raise_error(/priority must be an integer or a zero-padded integer/) } + end end end