diff options
-rw-r--r-- | Gemfile.lock | 10 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb | 39 | ||||
-rw-r--r-- | chef-config/lib/chef-config/version.rb | 2 | ||||
-rwxr-xr-x | ci/verify-chef.sh | 4 | ||||
-rw-r--r-- | lib/chef/provider/package/zypper.rb | 14 | ||||
-rw-r--r-- | lib/chef/version.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/package/zypper_spec.rb | 20 |
8 files changed, 58 insertions, 35 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index 4988559d09..118a87a84c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,9 +17,9 @@ GIT PATH remote: . specs: - chef (12.12.24) + chef (12.13.3) bundler (>= 1.10) - chef-config (= 12.12.24) + chef-config (= 12.13.3) chef-zero (~> 4.5) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -45,9 +45,9 @@ PATH specinfra (~> 2.10) syslog-logger (~> 1.6) uuidtools (~> 2.1.5) - chef (12.12.24-universal-mingw32) + chef (12.13.3-universal-mingw32) bundler (>= 1.10) - chef-config (= 12.12.24) + chef-config (= 12.13.3) chef-zero (~> 4.5) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -88,7 +88,7 @@ PATH PATH remote: chef-config specs: - chef-config (12.12.24) + chef-config (12.13.3) fuzzyurl (~> 0.8.0) mixlib-config (~> 2.0) mixlib-shellout (~> 2.0) @@ -1 +1 @@ -12.12.24
\ No newline at end of file +12.13.3
\ No newline at end of file diff --git a/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb b/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb index c8bcd4ab77..b6dab451c7 100644 --- a/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb +++ b/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb @@ -1,3 +1,5 @@ +require 'chef/mixin/shell_out' + module KitchenAcceptance class Kitchen < Chef::Resource resource_name :kitchen @@ -33,25 +35,30 @@ module KitchenAcceptance property :kitchen_options, String, default: lazy { ENV["PROJECT_NAME"] ? "-c -l debug" : "-c" } action :run do - execute "bundle exec kitchen #{command}#{instances ? " #{instances}" : ""}#{kitchen_options ? " #{kitchen_options}" : ""}" do - cwd kitchen_dir - env({ - "KITCHEN_DRIVER" => driver, - "KITCHEN_INSTANCES" => instances, - "KITCHEN_LOCAL_YAML" => ::File.expand_path("../../.kitchen.#{driver}.yml", __FILE__), - "KITCHEN_CHEF_PRODUCT" => chef_product, - "KITCHEN_CHEF_CHANNEL" => chef_channel, - "KITCHEN_CHEF_VERSION" => chef_version, - "ARTIFACTORY_USERNAME" => artifactory_username, - "ARTIFACTORY_PASSWORD" => artifactory_password - }.merge(new_resource.env)) - end + ruby_block "copy_kitchen_logs_to_data_path" do block do + cmd_env = { + "KITCHEN_DRIVER" => driver, + "KITCHEN_INSTANCES" => instances, + "KITCHEN_LOCAL_YAML" => ::File.expand_path("../../.kitchen.#{driver}.yml", __FILE__), + "KITCHEN_CHEF_PRODUCT" => chef_product, + "KITCHEN_CHEF_CHANNEL" => chef_channel, + "KITCHEN_CHEF_VERSION" => chef_version, + "ARTIFACTORY_USERNAME" => artifactory_username, + "ARTIFACTORY_PASSWORD" => artifactory_password + }.merge(new_resource.env) suite = kitchen_dir.split("/").last - kitchen_log_path = ENV["WORKSPACE"] ? "#{ENV["WORKSPACE"]}/chef-acceptance-data/logs" : "#{kitchen_dir}/../.acceptance_data/logs/kitchen" - FileUtils.mkdir_p("#{kitchen_log_path}/#{suite}") - FileUtils.cp_r("#{kitchen_dir}/.kitchen/logs/", "#{kitchen_log_path}/#{suite}") + kitchen_log_path = ENV["WORKSPACE"] ? "#{ENV["WORKSPACE"]}/chef-acceptance-data/logs" : "#{kitchen_dir}/../.acceptance_data/logs/" + + begin + shell_out!("bundle exec kitchen #{command}#{instances ? " #{instances}" : ""}#{kitchen_options ? " #{kitchen_options}" : ""}", + env: cmd_env, + cwd: kitchen_dir) + ensure + FileUtils.mkdir_p("#{kitchen_log_path}/#{suite}/#{command}") + FileUtils.cp_r("#{kitchen_dir}/.kitchen/logs/.", "#{kitchen_log_path}/#{suite}/#{command}") + end end end end diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb index c082a79274..d77fbe3df7 100644 --- a/chef-config/lib/chef-config/version.rb +++ b/chef-config/lib/chef-config/version.rb @@ -21,7 +21,7 @@ module ChefConfig CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__) - VERSION = "12.12.24" + VERSION = "12.13.3" end # diff --git a/ci/verify-chef.sh b/ci/verify-chef.sh index 71d4afe0df..e56b44798c 100755 --- a/ci/verify-chef.sh +++ b/ci/verify-chef.sh @@ -106,8 +106,8 @@ if [ "x$ACCEPTANCE" != "x" ]; then cd $SUITE_PATH - env PATH=$PATH AWS_SSH_KEY_ID=$AWS_SSH_KEY_ID bundle install --deployment - env PATH=$PATH AWS_SSH_KEY_ID=$AWS_SSH_KEY_ID KITCHEN_DRIVER=ec2 KITCHEN_CHEF_CHANNEL=unstable bundle exec chef-acceptance test --force-destroy --data-path $WORKSPACE/chef-acceptance-data +# env PATH=$PATH AWS_SSH_KEY_ID=$AWS_SSH_KEY_ID bundle install --deployment +# env PATH=$PATH AWS_SSH_KEY_ID=$AWS_SSH_KEY_ID KITCHEN_DRIVER=ec2 KITCHEN_CHEF_CHANNEL=unstable bundle exec chef-acceptance test --force-destroy --data-path $WORKSPACE/chef-acceptance-data else PATH=/opt/$PROJECT_NAME/bin:/opt/$PROJECT_NAME/embedded/bin:$PATH export PATH diff --git a/lib/chef/provider/package/zypper.rb b/lib/chef/provider/package/zypper.rb index 5ee1dbea8e..e20a7332f7 100644 --- a/lib/chef/provider/package/zypper.rb +++ b/lib/chef/provider/package/zypper.rb @@ -38,15 +38,15 @@ class Chef status = shell_out_with_timeout!("zypper --non-interactive info #{package_name}") status.stdout.each_line do |line| case line - when /^Version: (.+)$/ - candidate_version = $1 - Chef::Log.debug("#{new_resource} version #{$1}") - when /^Installed: Yes$/ + when /^Version *: (.+) *$/ + candidate_version = $1.strip + Chef::Log.debug("#{new_resource} version #{candidate_version}") + when /^Installed *: Yes *$/ is_installed = true Chef::Log.debug("#{new_resource} is installed") - when /^Status: out-of-date \(version (.+) installed\)$/ - current_version = $1 - Chef::Log.debug("#{new_resource} out of date version #{$1}") + when /^Status *: out-of-date \(version (.+) installed\) *$/ + current_version = $1.strip + Chef::Log.debug("#{new_resource} out of date version #{current_version}") end end current_version = candidate_version if is_installed diff --git a/lib/chef/version.rb b/lib/chef/version.rb index 82060f7a3c..82efffdaa5 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -21,7 +21,7 @@ class Chef CHEF_ROOT = File.expand_path("../..", __FILE__) - VERSION = "12.12.24" + VERSION = "12.13.3" end # diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb index df0a1da9a2..8838c26b71 100644 --- a/spec/unit/provider/package/zypper_spec.rb +++ b/spec/unit/provider/package/zypper_spec.rb @@ -72,7 +72,7 @@ describe Chef::Provider::Package::Zypper do provider.load_current_resource end - it "should set the installed version if zypper info has one" do + it "should set the installed version if zypper info has one (zypper version < 1.13.0)" do status = double(:stdout => "Version: 1.0\nInstalled: Yes\n", :exitstatus => 0) allow(provider).to receive(:shell_out!).and_return(status) @@ -80,7 +80,15 @@ describe Chef::Provider::Package::Zypper do provider.load_current_resource end - it "should set the candidate version if zypper info has one" do + it "should set the installed version if zypper info has one (zypper version >= 1.13.0)" do + status = double(:stdout => "Version : 1.0 \nInstalled : Yes \n", :exitstatus => 0) + + allow(provider).to receive(:shell_out!).and_return(status) + expect(current_resource).to receive(:version).with(["1.0"]).and_return(true) + provider.load_current_resource + end + + it "should set the candidate version if zypper info has one (zypper version < 1.13.0)" do status = double(:stdout => "Version: 1.0\nInstalled: No\nStatus: out-of-date (version 0.9 installed)", :exitstatus => 0) allow(provider).to receive(:shell_out!).and_return(status) @@ -88,6 +96,14 @@ describe Chef::Provider::Package::Zypper do expect(provider.candidate_version).to eql(["1.0"]) end + it "should set the candidate version if zypper info has one (zypper version >= 1.13.0)" do + status = double(:stdout => "Version : 1.0 \nInstalled : No \nStatus : out-of-date (version 0.9 installed)", :exitstatus => 0) + + allow(provider).to receive(:shell_out!).and_return(status) + provider.load_current_resource + expect(provider.candidate_version).to eql(["1.0"]) + end + it "should return the current resouce" do expect(provider.load_current_resource).to eql(current_resource) end |