diff options
-rw-r--r-- | CHANGELOG.md | 8 | ||||
-rw-r--r-- | Gemfile.lock | 10 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | chef-config/lib/chef-config/version.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/windows_task.rb | 18 | ||||
-rw-r--r-- | lib/chef/version.rb | 2 | ||||
-rw-r--r-- | spec/unit/knife/data_bag_create_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/provider/windows_task_spec.rb | 16 |
8 files changed, 40 insertions, 24 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e94da967b..366158fc8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,17 @@ <!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ --> -<!-- latest_release 13.6.31 --> -## [v13.6.31](https://github.com/chef/chef/tree/v13.6.31) (2017-12-10) +<!-- latest_release 13.6.33 --> +## [v13.6.33](https://github.com/chef/chef/tree/v13.6.33) (2017-12-11) #### Merged Pull Requests -- Ensure data bags names can contain reserved words [#6636](https://github.com/chef/chef/pull/6636) ([EmFl](https://github.com/EmFl)) +- Invalid date error on windows_task with frequency :on_logon [#6618](https://github.com/chef/chef/pull/6618) ([NimishaS](https://github.com/NimishaS)) <!-- latest_release --> <!-- release_rollup since=13.6.4 --> ### Changes since 13.6.4 release #### Merged Pull Requests +- Invalid date error on windows_task with frequency :on_logon [#6618](https://github.com/chef/chef/pull/6618) ([NimishaS](https://github.com/NimishaS)) <!-- 13.6.33 --> +- Fix sneaky chefstyle violations [#6655](https://github.com/chef/chef/pull/6655) ([thommay](https://github.com/thommay)) <!-- 13.6.32 --> - Ensure data bags names can contain reserved words [#6636](https://github.com/chef/chef/pull/6636) ([EmFl](https://github.com/EmFl)) <!-- 13.6.31 --> - windows_task: Add additional input validation to properties [#6628](https://github.com/chef/chef/pull/6628) ([tas50](https://github.com/tas50)) <!-- 13.6.30 --> - Solaris: Fix svcadm clear to only run in maintenance state [#6631](https://github.com/chef/chef/pull/6631) ([jaymalasinha](https://github.com/jaymalasinha)) <!-- 13.6.29 --> diff --git a/Gemfile.lock b/Gemfile.lock index dd375d8409..4fa35ca36d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,10 +17,10 @@ GIT PATH remote: . specs: - chef (13.6.31) + chef (13.6.33) addressable bundler (>= 1.10) - chef-config (= 13.6.31) + chef-config (= 13.6.33) chef-zero (>= 13.0) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -47,10 +47,10 @@ PATH specinfra (~> 2.10) syslog-logger (~> 1.6) uuidtools (~> 2.1.5) - chef (13.6.31-universal-mingw32) + chef (13.6.33-universal-mingw32) addressable bundler (>= 1.10) - chef-config (= 13.6.31) + chef-config (= 13.6.33) chef-zero (>= 13.0) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -92,7 +92,7 @@ PATH PATH remote: chef-config specs: - chef-config (13.6.31) + chef-config (13.6.33) addressable fuzzyurl mixlib-config (~> 2.0) @@ -1 +1 @@ -13.6.31
\ No newline at end of file +13.6.33
\ No newline at end of file diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb index 6957649c6e..2302ac7381 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 = "13.6.31" + VERSION = "13.6.33" end # diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb index cd2b7e38b5..02e45cb9e0 100644 --- a/lib/chef/provider/windows_task.rb +++ b/lib/chef/provider/windows_task.rb @@ -81,18 +81,16 @@ class Chef return end # Setting the attributes of new_resource as current_resource. - # This is required to maintain idempotency when the user is not passing start_day and start_time - # because SCHTASK.exe sets them by default as the current time and day. - # So the current_resource will always have start_time and start_days set for an existing task, - # even though the user didn't pass it. So we set the new_resource attributes as the current_resource attributes + # This is required to handle update scenarios when the user specifies + # only those attributes in the recipe which require update resource_attributes.each do |attribute| new_resource_attribute = new_resource.send(attribute) current_resource_attribute = current_resource.send(attribute) # We accept start_day in mm/dd/yyyy format only. Hence while copying the start_day from system to new_resource.start_day, # we are converting from system date format to mm/dd/yyyy - current_resource_attribute = convert_system_date_to_mm_dd_yyyy(current_resource_attribute) if attribute == "start_day" + current_resource_attribute = convert_system_date_to_mm_dd_yyyy(current_resource_attribute) if attribute == "start_day" && current_resource_attribute != "N/A" # Convert start_time into 24hr time format - current_resource_attribute = DateTime.parse(current_resource_attribute).strftime("%H:%M") if attribute == "start_time" + current_resource_attribute = DateTime.parse(current_resource_attribute).strftime("%H:%M") if attribute == "start_time" && current_resource_attribute != "N/A" new_resource.send("#{attribute}=", current_resource_attribute ) if current_resource_attribute && new_resource_attribute.nil? end end @@ -105,8 +103,8 @@ class Chef options["SD"] = convert_user_date_to_system_date "12/12/2012" else options["SC"] = schedule - options["ST"] = new_resource.start_time unless new_resource.start_time.nil? - options["SD"] = convert_user_date_to_system_date new_resource.start_day unless new_resource.start_day.nil? + options["ST"] = new_resource.start_time unless new_resource.start_time.nil? || new_resource.start_time == "N/A" + options["SD"] = convert_user_date_to_system_date new_resource.start_day unless new_resource.start_day.nil? || new_resource.start_day == "N/A" end options["MO"] = new_resource.frequency_modifier if frequency_modifier_allowed options["I"] = new_resource.idle_time unless new_resource.idle_time.nil? @@ -233,8 +231,8 @@ class Chef current_resource.idle_time != new_resource.idle_time || current_resource.random_delay != new_resource.random_delay || !new_resource.execution_time_limit.include?(current_resource.execution_time_limit) || - (new_resource.start_day && start_day_updated?) || - (new_resource.start_time && start_time_updated?) + (new_resource.start_day && new_resource.start_day != "N/A" && start_day_updated?) || + (new_resource.start_time && new_resource.start_time != "N/A" && start_time_updated?) begin return true if new_resource.day.to_s.casecmp(current_resource.day.to_s) != 0 || new_resource.months.to_s.casecmp(current_resource.months.to_s) != 0 diff --git a/lib/chef/version.rb b/lib/chef/version.rb index 6c11e78644..fd9521b028 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -23,7 +23,7 @@ require "chef/version_string" class Chef CHEF_ROOT = File.expand_path("../..", __FILE__) - VERSION = Chef::VersionString.new("13.6.31") + VERSION = Chef::VersionString.new("13.6.33") end # diff --git a/spec/unit/knife/data_bag_create_spec.rb b/spec/unit/knife/data_bag_create_spec.rb index f7dfc075e1..c586a8df1d 100644 --- a/spec/unit/knife/data_bag_create_spec.rb +++ b/spec/unit/knife/data_bag_create_spec.rb @@ -79,7 +79,7 @@ describe Chef::Knife::DataBagCreate do expect { knife.run }.to exit_with_code(1) end end - + context "when part of the name is a reserved name" do before do exception = double("404 error", :code => "404") @@ -89,7 +89,7 @@ describe Chef::Knife::DataBagCreate do .and_raise(Net::HTTPServerException.new("404", exception)) end end - + it "will create a data bag containing a reserved word" do %w{node role client environment}.each do |name| knife.name_args = ["sudoing_#{name}_admins"] @@ -100,7 +100,7 @@ describe Chef::Knife::DataBagCreate do end end end - + context "when given one argument" do before do knife.name_args = [bag_name] diff --git a/spec/unit/provider/windows_task_spec.rb b/spec/unit/provider/windows_task_spec.rb index 04326f1b51..ce0fe9e50e 100644 --- a/spec/unit/provider/windows_task_spec.rb +++ b/spec/unit/provider/windows_task_spec.rb @@ -137,6 +137,22 @@ describe Chef::Provider::WindowsTask do expect(new_resource).to be_updated_by_last_action end + context "when start_day and start_time are N/A for frequency :on_logon" do + it "doesn't update the start_day and start_time of new_resource" do + task_hash[:on_logon] = true + task_hash[:StartDate] = "N/A" + task_hash[:StartTime] = "N/A" + allow(provider).to receive(:load_task_hash).and_return(task_hash) + current_resource = provider.load_current_resource + allow(provider).to receive(:task_need_update?).and_return(true) + allow(provider).to receive(:run_schtasks) + expect(provider).not_to receive(:convert_system_date_to_mm_dd_yyyy) + expect(DateTime).not_to receive(:parse) + expect(new_resource.start_day).to eq(nil) + expect(new_resource.start_time).to eq(nil) + end + end + context "when task is not existing" do before do allow(provider).to receive(:load_task_hash) |