Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stdlib deprecation #641

Merged
merged 3 commits into from
Dec 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ fixtures:
repositories:
"stdlib":
"repo": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"ref": "4.5.0"
symlinks:
"apt": "#{source_dir}"
3 changes: 3 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
docker_sets:
- set: docker/ubuntu-14.04
- set: docker/debian-8

spec/spec_helper.rb:
allow_deprecations: true
10 changes: 5 additions & 5 deletions manifests/key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
6 changes: 4 additions & 2 deletions spec/defines/setting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@

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 /)
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
Expand Down
8 changes: 0 additions & 8 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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