diff options
23 files changed, 266 insertions, 77 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a3597e..0a63ec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ +##2014-07-14 - Supported Release 4.3.1 +### Summary +This supported release updates the metadata.json to work around upgrade behavior of the PMT. + +#### Bugfixes +- Synchronize metadata.json with PMT-generated metadata to pass checksums + +##2014-06-27 - Supported Release 4.3.0 +### Summary +This release is the first supported release of the stdlib 4 series. It remains +backwards-compatible with the stdlib 3 series. It adds two new functions, one bugfix, and many testing updates. + +#### Features +- New `bool2str()` function +- New `camalcase()` function + +#### Bugfixes +- Fix `has_interface_with()` when interfaces fact is nil + +##2014-06-04 - Release 4.2.2 +### Summary + +This release adds PE3.3 support in the metadata and fixes a few tests. + ## 2014-05-08 - Release - 4.2.1 ### Summary This release moves a stray symlink that can cause problems. @@ -18,7 +18,6 @@ group :development, :test do gem 'puppet-lint', :require => false gem 'pry', :require => false gem 'simplecov', :require => false - gem 'beaker', :require => false gem 'beaker-rspec', :require => false end diff --git a/Modulefile b/Modulefile deleted file mode 100644 index c5da72d..0000000 --- a/Modulefile +++ /dev/null @@ -1,11 +0,0 @@ -name 'puppetlabs-stdlib' -version '4.2.1' -source 'git://github.com/puppetlabs/puppetlabs-stdlib.git' -author 'puppetlabs' -license 'Apache 2.0' -summary 'Puppet Module Standard Library' -description 'Standard Library for Puppet Modules' -project_page 'https://github.com/puppetlabs/puppetlabs-stdlib' - -## Add dependencies, if any: -# dependency 'username/name', '>= 1.2.0' diff --git a/lib/puppet/parser/functions/has_interface_with.rb b/lib/puppet/parser/functions/has_interface_with.rb index 7f150a7..927b0df 100644 --- a/lib/puppet/parser/functions/has_interface_with.rb +++ b/lib/puppet/parser/functions/has_interface_with.rb @@ -25,7 +25,7 @@ has_interface_with("lo") => true interfaces = lookupvar('interfaces') # If we do not have any interfaces, then there are no requested attributes - return false if (interfaces == :undefined) + return false if (interfaces == :undefined || interfaces.nil?) interfaces = interfaces.split(',') diff --git a/metadata.json b/metadata.json index 9d3847b..bce75e0 100644 --- a/metadata.json +++ b/metadata.json @@ -1,11 +1,20 @@ { + "name": "puppetlabs-stdlib", + "version": "4.3.1", + "author": "puppetlabs", + "summary": "Puppet Module Standard Library", + "license": "Apache 2.0", + "source": "git://github.com/puppetlabs/puppetlabs-stdlib", + "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib", + "issues_url": "https://github.com/puppetlabs/puppetlabs-stdlib/issues", "operatingsystem_support": [ { "operatingsystem": "RedHat", "operatingsystemrelease": [ "4", "5", - "6" + "6", + "7" ] }, { @@ -13,7 +22,8 @@ "operatingsystemrelease": [ "4", "5", - "6" + "6", + "7" ] }, { @@ -21,7 +31,8 @@ "operatingsystemrelease": [ "4", "5", - "6" + "6", + "7" ] }, { @@ -29,7 +40,8 @@ "operatingsystemrelease": [ "4", "5", - "6" + "6", + "7" ] }, { @@ -49,7 +61,8 @@ "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "10.04", - "12.04" + "12.04", + "14.04" ] }, { @@ -84,22 +97,15 @@ "requirements": [ { "name": "pe", - "version_requirement": "3.2.x" + "version_requirement": "3.3.x" }, { "name": "puppet", "version_requirement": ">=2.7.20 <4.0.0" } ], - "name": "puppetlabs-stdlib", - "version": "4.2.1", - "source": "git://github.com/puppetlabs/puppetlabs-stdlib", - "author": "puppetlabs", - "license": "Apache 2.0", - "summary": "Puppet Module Standard Library", "description": "Standard Library for Puppet Modules", - "project_page": "https://github.com/puppetlabs/puppetlabs-stdlib", "dependencies": [ - + ] } diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb index dbc28da..a16a710 100755 --- a/spec/acceptance/chop_spec.rb +++ b/spec/acceptance/chop_spec.rb @@ -19,7 +19,7 @@ describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operat end it 'should eat the last two characters of \r\n' do - pp = <<-EOS + pp = <<-'EOS' $input = "test\r\n" if size($input) != 6 { fail("Size of ${input} is not 6.") diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index aa7b14c..12da0cd 100755 --- a/spec/acceptance/ensure_packages_spec.rb +++ b/spec/acceptance/ensure_packages_spec.rb @@ -4,15 +4,13 @@ require 'spec_helper_acceptance' describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do describe 'success' do it 'ensure_packages a package' do - apply_manifest('package { "zsh": ensure => absent, }') + apply_manifest('package { "rake": ensure => absent, provider => "gem", }') pp = <<-EOS - $a = "zsh" - ensure_packages($a) + $a = "rake" + ensure_packages($a,{'provider' => 'gem'}) EOS - apply_manifest(pp, :expect_changes => true) do |r| - expect(r.stdout).to match(/Package\[zsh\]\/ensure: (created|ensure changed 'purged' to 'present')/) - end + apply_manifest(pp, :expect_changes => true) end it 'ensures a package already declared' it 'takes defaults arguments' diff --git a/spec/acceptance/ensure_resource_spec.rb b/spec/acceptance/ensure_resource_spec.rb index c4d8887..2aad243 100755 --- a/spec/acceptance/ensure_resource_spec.rb +++ b/spec/acceptance/ensure_resource_spec.rb @@ -4,15 +4,13 @@ require 'spec_helper_acceptance' describe 'ensure_resource function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do describe 'success' do it 'ensure_resource a package' do - apply_manifest('package { "zsh": ensure => absent, }') + apply_manifest('package { "rake": ensure => absent, provider => "gem", }') pp = <<-EOS - $a = "zsh" - ensure_resource('package', $a) + $a = "rake" + ensure_resource('package', $a, {'provider' => 'gem'}) EOS - apply_manifest(pp, :expect_changes => true) do |r| - expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/) - end + apply_manifest(pp, :expect_changes => true) end it 'ensures a resource already declared' it 'takes defaults arguments' diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index fc8bea2..c37b35a 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -4,18 +4,31 @@ require 'spec_helper_acceptance' describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do describe 'success' do let(:facts_d) do - if fact('is_pe') == "true" - '/etc/puppetlabs/facter/facts.d' + if fact('is_pe', '--puppet') == "true" + if fact('osfamily') =~ /windows/i + if fact('kernelmajversion').to_f < 6.0 + 'C:/Documents and Settings/All Users/Application Data/PuppetLabs/facter/facts.d' + else + 'C:/ProgramData/PuppetLabs/facter/facts.d' + end + else + '/etc/puppetlabs/facter/facts.d' + end else '/etc/facter/facts.d' end end after :each do - shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi") + shell("if [ -f '#{facts_d}/fqdn.txt' ] ; then rm '#{facts_d}/fqdn.txt' ; fi") + end + before :all do + #No need to create on windows, PE creates by default + if fact('osfamily') !~ /windows/i + shell("mkdir -p '#{facts_d}'") + end end it 'fqdn_rotates floats' do - shell("mkdir -p #{facts_d}") - shell("echo 'fqdn=fakehost.localdomain' > #{facts_d}/fqdn.txt") + shell("echo fqdn=fakehost.localdomain > '#{facts_d}/fqdn.txt'") pp = <<-EOS $a = ['a','b','c','d'] $o = fqdn_rotate($a) diff --git a/spec/acceptance/get_module_path_spec.rb b/spec/acceptance/get_module_path_spec.rb index 34d91fa..6ac690c 100755 --- a/spec/acceptance/get_module_path_spec.rb +++ b/spec/acceptance/get_module_path_spec.rb @@ -3,22 +3,6 @@ require 'spec_helper_acceptance' describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do describe 'success' do - it 'get_module_paths stdlib' do - pp = <<-EOS - $a = $::is_pe ? { - 'true' => '/opt/puppet/share/puppet/modules/stdlib', - 'false' => '/etc/puppet/modules/stdlib', - } - $o = get_module_path('stdlib') - if $o == $a { - notify { 'output correct': } - } - EOS - - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/Notice: output correct/) - end - end it 'get_module_paths dne' do pp = <<-EOS $a = $::is_pe ? { @@ -28,6 +12,8 @@ describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(f $o = get_module_path('dne') if $o == $a { notify { 'output correct': } + } else { + notify { "failed; module path is '$o'": } } EOS diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb index 91fc9a0..b1a677e 100755 --- a/spec/acceptance/getparam_spec.rb +++ b/spec/acceptance/getparam_spec.rb @@ -3,18 +3,17 @@ require 'spec_helper_acceptance' describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do describe 'success' do - it 'getparam a package' do + it 'getparam a notify' do pp = <<-EOS - user { "rspec": - ensure => present, - managehome => true, + notify { 'rspec': + message => 'custom rspec message', } - $o = getparam(User['rspec'], 'managehome') + $o = getparam(Notify['rspec'], 'message') notice(inline_template('getparam is <%= @o.inspect %>')) EOS apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/getparam is true/) + expect(r.stdout).to match(/getparam is "custom rspec message"/) end end end diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb index 41ae19f..9590193 100755 --- a/spec/acceptance/has_interface_with_spec.rb +++ b/spec/acceptance/has_interface_with_spec.rb @@ -1,11 +1,11 @@ #! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' -describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do +describe 'has_interface_with function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do describe 'success' do it 'has_interface_with existing ipaddress' do pp = <<-EOS - $a = '127.0.0.1' + $a = $::ipaddress $o = has_interface_with('ipaddress', $a) notice(inline_template('has_interface_with is <%= @o.inspect %>')) EOS @@ -27,7 +27,17 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include end it 'has_interface_with existing interface' do pp = <<-EOS - $a = 'lo' + if $osfamily == 'Solaris' or $osfamily == 'Darwin' { + $a = 'lo0' + }elsif $osfamily == 'windows' { + $a = $::kernelmajversion ? { + /6\.(2|3|4)/ => 'Ethernet0', + /6\.(0|1)/ => 'Local_Area_Connection', + /5\.(1|2)/ => undef, #Broken current in facter + } + }else { + $a = 'lo' + } $o = has_interface_with($a) notice(inline_template('has_interface_with is <%= @o.inspect %>')) EOS diff --git a/spec/acceptance/has_ip_address_spec.rb b/spec/acceptance/has_ip_address_spec.rb index 7d5fd87..149a10d 100755 --- a/spec/acceptance/has_ip_address_spec.rb +++ b/spec/acceptance/has_ip_address_spec.rb @@ -1,7 +1,7 @@ #! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' -describe 'has_ip_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do +describe 'has_ip_address function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do describe 'success' do it 'has_ip_address existing ipaddress' do pp = <<-EOS diff --git a/spec/acceptance/has_ip_network_spec.rb b/spec/acceptance/has_ip_network_spec.rb index 692eaf9..7d2f34e 100755 --- a/spec/acceptance/has_ip_network_spec.rb +++ b/spec/acceptance/has_ip_network_spec.rb @@ -1,7 +1,7 @@ #! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' -describe 'has_ip_network function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do +describe 'has_ip_network function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do describe 'success' do it 'has_ip_network existing ipaddress' do pp = <<-EOS diff --git a/spec/acceptance/loadyaml_spec.rb b/spec/acceptance/loadyaml_spec.rb index 944a727..1e910a9 100644 --- a/spec/acceptance/loadyaml_spec.rb +++ b/spec/acceptance/loadyaml_spec.rb @@ -1,16 +1,18 @@ #! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' +tmpdir = default.tmpdir('stdlib') + describe 'loadyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do describe 'success' do it 'loadyamls array of values' do - shell('echo "--- + shell("echo '--- aaa: 1 bbb: 2 ccc: 3 - ddd: 4" > /testyaml.yaml') + ddd: 4' > #{tmpdir}/testyaml.yaml") pp = <<-EOS - $o = loadyaml('/testyaml.yaml') + $o = loadyaml('#{tmpdir}/testyaml.yaml') notice(inline_template('loadyaml[aaa] is <%= @o["aaa"].inspect %>')) notice(inline_template('loadyaml[bbb] is <%= @o["bbb"].inspect %>')) notice(inline_template('loadyaml[ccc] is <%= @o["ccc"].inspect %>')) diff --git a/spec/acceptance/nodesets/windows-2003-i386.yml b/spec/acceptance/nodesets/windows-2003-i386.yml new file mode 100644 index 0000000..47dadbd --- /dev/null +++ b/spec/acceptance/nodesets/windows-2003-i386.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2003_i386: + roles: + - agent + - default + platform: windows-2003-i386 + template: win-2003-i386 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2003-x86_64.yml b/spec/acceptance/nodesets/windows-2003-x86_64.yml new file mode 100644 index 0000000..6a884bc --- /dev/null +++ b/spec/acceptance/nodesets/windows-2003-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2003_x86_64: + roles: + - agent + - default + platform: windows-2003-x86_64 + template: win-2003-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2008-x86_64.yml b/spec/acceptance/nodesets/windows-2008-x86_64.yml new file mode 100644 index 0000000..ae3c11d --- /dev/null +++ b/spec/acceptance/nodesets/windows-2008-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2008_x86_64: + roles: + - agent + - default + platform: windows-2008-x86_64 + template: win-2008-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2008r2-x86_64.yml b/spec/acceptance/nodesets/windows-2008r2-x86_64.yml new file mode 100644 index 0000000..63923ac --- /dev/null +++ b/spec/acceptance/nodesets/windows-2008r2-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2008r2: + roles: + - agent + - default + platform: windows-2008r2-x86_64 + template: win-2008r2-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2012-x86_64.yml b/spec/acceptance/nodesets/windows-2012-x86_64.yml new file mode 100644 index 0000000..eaa4eca --- /dev/null +++ b/spec/acceptance/nodesets/windows-2012-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2012: + roles: + - agent + - default + platform: windows-2012-x86_64 + template: win-2012-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/nodesets/windows-2012r2-x86_64.yml b/spec/acceptance/nodesets/windows-2012r2-x86_64.yml new file mode 100644 index 0000000..1f0ea97 --- /dev/null +++ b/spec/acceptance/nodesets/windows-2012r2-x86_64.yml @@ -0,0 +1,26 @@ +HOSTS: + ubuntu1204: + roles: + - master + - database + - dashboard + platform: ubuntu-12.04-amd64 + template: ubuntu-1204-x86_64 + hypervisor: vcloud + win2012r2: + roles: + - agent + - default + platform: windows-2012r2-x86_64 + template: win-2012r2-x86_64 + hypervisor: vcloud +CONFIG: + nfs_server: none + ssh: + keys: "~/.ssh/id_rsa-acceptance" + consoleport: 443 + datastore: instance0 + folder: Delivery/Quality Assurance/Enterprise/Dynamic + resourcepool: delivery/Quality Assurance/Enterprise/Dynamic + pooling_api: http://vcloud.delivery.puppetlabs.net/ + pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/ diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb index aeec67a..71a4c84 100755 --- a/spec/acceptance/validate_augeas_spec.rb +++ b/spec/acceptance/validate_augeas_spec.rb @@ -1,7 +1,7 @@ #! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' -describe 'validate_augeas function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do +describe 'validate_augeas function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) do describe 'prep' do it 'installs augeas for tests' end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 8e56daa..e9ccc68 100755 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -26,6 +26,15 @@ RSpec.configure do |c| # Configure all nodes in nodeset c.before :suite do - puppet_module_install(:source => proj_root, :module_name => 'stdlib') + hosts.each do |host| + if host['platform'] !~ /windows/i + copy_root_module_to(host, :source => proj_root, :module_name => 'stdlib') + end + end + hosts.each do |host| + if host['platform'] =~ /windows/i + on host, puppet('plugin download') + end + end end end |