diff options
-rw-r--r-- | Gemfile | 10 | ||||
-rw-r--r-- | chef-config/lib/chef-config/config.rb | 3 | ||||
-rw-r--r-- | lib/chef/dsl/declare_resource.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/mount/windows.rb | 6 | ||||
-rw-r--r-- | spec/unit/provider/mount/windows_spec.rb | 12 |
5 files changed, 28 insertions, 7 deletions
@@ -17,6 +17,12 @@ group(:maintenance) do gem "netrc" end +group(:pry) do + gem "pry" + gem "pry-byebug" + gem "pry-stack_explorer" +end + group(:ruby_prof) do # may need to disable this in insolation on fussy builds like AIX, RHEL4, etc gem "ruby-prof" @@ -31,10 +37,6 @@ group(:development, :test) do gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master" gem "ruby-shadow", platforms: :ruby unless RUBY_PLATFORM.downcase =~ /(aix|cygwin)/ - - gem "pry" - gem "pry-byebug" - gem "pry-stack_explorer" end group(:travis) do diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb index 3a20469397..d2a4bddba0 100644 --- a/chef-config/lib/chef-config/config.rb +++ b/chef-config/lib/chef-config/config.rb @@ -703,6 +703,9 @@ module ChefConfig # Use atomic updates (i.e. move operation) while updating contents # of the files resources. When set to false copy operation is # used to update files. + # + # NOTE: CHANGING THIS SETTING MAY CAUSE CORRUPTION, DATA LOSS AND + # INSTABILITY. default :file_atomic_update, true # There are 3 possible values for this configuration setting. diff --git a/lib/chef/dsl/declare_resource.rb b/lib/chef/dsl/declare_resource.rb index 9a59859d5a..e57bc0f4c4 100644 --- a/lib/chef/dsl/declare_resource.rb +++ b/lib/chef/dsl/declare_resource.rb @@ -88,9 +88,7 @@ class Chef # def build_resource(type, name, created_at = nil, run_context: self.run_context, &resource_attrs_block) created_at ||= caller[0] - Thread.exclusive do - require "chef/resource_builder" unless defined?(Chef::ResourceBuilder) - end + require "chef/resource_builder" unless defined?(Chef::ResourceBuilder) Chef::ResourceBuilder.new( type: type, diff --git a/lib/chef/provider/mount/windows.rb b/lib/chef/provider/mount/windows.rb index 3ffe326cac..0fb5aa7645 100644 --- a/lib/chef/provider/mount/windows.rb +++ b/lib/chef/provider/mount/windows.rb @@ -80,6 +80,12 @@ class Chef end end + private + + def mount_options_unchanged? + @current_resource.device == @new_resource.device + end + end end end diff --git a/spec/unit/provider/mount/windows_spec.rb b/spec/unit/provider/mount/windows_spec.rb index ab7a161c08..ec1945de50 100644 --- a/spec/unit/provider/mount/windows_spec.rb +++ b/spec/unit/provider/mount/windows_spec.rb @@ -120,6 +120,18 @@ describe Chef::Provider::Mount::Windows do @provider.mount_fs end + context "mount_options_unchanged?" do + it "should return true if mounted device is the same" do + allow(@current_resource).to receive(:device).and_return(GUID) + expect(@provider.send :mount_options_unchanged?).to be true + end + + it "should return false if mounted device has changed" do + allow(@current_resource).to receive(:device).and_return("XXXX") + expect(@provider.send :mount_options_unchanged?).to be false + end + end + it "should not mount the filesystem if it is mounted and the options have not changed" do expect(@vol).to_not receive(:add) allow(@current_resource).to receive(:mounted).and_return(true) |