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

The mount resource is not idempotent on windows #3861

Closed
jaym opened this issue Sep 2, 2015 · 4 comments
Closed

The mount resource is not idempotent on windows #3861

jaym opened this issue Sep 2, 2015 · 4 comments
Labels

Comments

@jaym
Copy link
Contributor

jaym commented Sep 2, 2015

I cannot run the mount resource twice. If I run the following recipe twice, it fails on the second go.

mount "T:" do
  action [:mount]
  device "\\\\localhost\\C$"
end
C:\workspace\chef [jdm/bundle-exec +31 ~0 -0 !]> bundle exec chef-apply mount.rb
DL is deprecated, please use Fiddle
Recipe: (chef-apply cookbook)::(chef-apply recipe)
  * mount[T:] action mount

    ================================================================================
    Error executing action `mount` on resource 'mount[T:]'
    ================================================================================

    Chef::Exceptions::UnsupportedAction
    -----------------------------------
    #<Chef::Provider::Mount::Windows:0x4336fe0> does not implement #mount_options_unchanged?

    Resource Declaration:
    ---------------------
    # In mount.rb

      1: mount "T:" do
      2:   action [:mount]
      3:   device "\\\\localhost\\C$"
      4: end

    Compiled Resource:
    ------------------
    # Declared in mount.rb:1:in `run_chef_recipe'

    mount("T:") do
      action [:mount]
      supports {:remount=>false}
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      mount_point "T:"
      device "\\\\localhost\\C$"
      device_type :device
      fsck_device "-"
      fstype "auto"
      options ["defaults"]
      dump 0
      pass 2
      declared_type :mount
      cookbook_name "(chef-apply cookbook)"
      recipe_name "(chef-apply recipe)"
    end

[2015-09-02T09:10:49-07:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
[2015-09-02T09:10:49-07:00] FATAL: Chef::Exceptions::UnsupportedAction: mount[T:] ((chef-apply cookbook)::(chef-apply recipe) line 1) had an error: Chef::Exceptions::UnsupportedAction: #<Chef::Provider::Mount::Windows:0x4336fe0> does not implement #mount_options_unchanged?

stacktrace.out:

C:\workspace\chef [jdm/bundle-exec +31 ~0 -0 !]> cat C:/chef/cache/chef-stacktrace.out
Generated at 2015-09-02 09:10:49 -0700
Chef::Exceptions::UnsupportedAction: mount[T:] ((chef-apply cookbook)::(chef-apply recipe) line  1) had an error: Chef::Exceptions::UnsupportedAction: #<Chef::Provider::Mount::Windows:0x4336f e0> does not implement #mount_options_unchanged?
C:/workspace/chef/lib/chef/provider/mount.rb:126:in `mount_options_unchanged?'
C:/workspace/chef/lib/chef/provider/mount.rb:46:in `action_mount'
C:/workspace/chef/lib/chef/provider.rb:144:in `run_action'
C:/workspace/chef/lib/chef/resource.rb:585:in `run_action'
C:/workspace/chef/lib/chef/runner.rb:49:in `run_action'
C:/workspace/chef/lib/chef/runner.rb:81:in `block (2 levels) in converge'
C:/workspace/chef/lib/chef/runner.rb:81:in `each'
C:/workspace/chef/lib/chef/runner.rb:81:in `block in converge'
C:/workspace/chef/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_re source'
C:/workspace/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
C:/workspace/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block '
C:/workspace/chef/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/workspace/chef/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
C:/workspace/chef/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/workspace/chef/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
C:/workspace/chef/lib/chef/runner.rb:80:in `converge'
C:/workspace/chef/lib/chef/application/apply.rb:189:in `run_chef_recipe'
C:/workspace/chef/lib/chef/application/apply.rb:198:in `run_application'
C:/workspace/chef/lib/chef/application/apply.rb:211:in `run'
C:/workspace/chef/bin/chef-apply:25:in `<top (required)>'
C:/tools/Ruby200p645/lib/ruby/gems/2.0.0/bin/chef-apply:23:in `load'
C:/tools/Ruby200p645/lib/ruby/gems/2.0.0/bin/chef-apply:23:in `<main>'
@lamont-granquist
Copy link
Contributor

I think I've seen this a few times now in tickets, i think this is a dup.

@lamont-granquist lamont-granquist added this to the Accepted Minor milestone Oct 7, 2015
@ghost
Copy link

ghost commented Oct 29, 2015

I have the same problem since the last update of chef azure extensions, workaround with a guard:

mount "Z:" do
    action :mount
    device "\\\\localhost\\C$"
    guard_interpreter :powershell_script
    not_if "Test-Path z:"
end

@MichaelPereira
Copy link
Contributor

@lamont-granquist: This problem is still biting anyone who tries to use the mount resource on Windows, can the workaround provided by @eguerints be integrated into the official mount resource doc while the problem is not resolved? I can make the change and submit the PR at chef/chef-web-docs

@btm
Copy link
Contributor

btm commented Apr 1, 2016

Fixed by #4692.

@btm btm closed this as completed Apr 1, 2016
@thommay thommay added Type: Bug Does not work as expected. Priority: Medium and removed Bug labels Jan 25, 2017
@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants