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

iis_root errors on 'duplicate collection entry of type 'mimeMap' #199

Closed
electronicalias opened this issue Aug 6, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@electronicalias
Copy link

commented Aug 6, 2015

Apologies if this isn't the right place but I've been banging my head against the wall trying to figure out why this isn't working.

I'm using chef-client 12.4.1 (in local mode with -z) and the latest version of this IIS coobook. The windows cookbook is also up to date. The OS is an AWS AMI of Windows 2008 r2.

My code is as follows:

if node['bwkzrole'] == "webserver"
  iis_root 'configuredd' do
    add_default_documents ['index.cfm']
    action :add
    add_mime_maps [
          "fileExtension='.ipx',mimeType='application/x-ipix'",
          "fileExtension='.sco',mimeType='application/x-sibileus-scorch'",
          "fileExtension='.mp4',mimeType='video/mp4v-es'",
          "fileExtension='.sitx',mimeType='application/x-stuffitx'",
          "fileExtension='.indd',mimeType='application/x-indesign'",
          "fileExtension='.indt',mimeType='application/octet-stream'",
          "fileExtension='.inx',mimeType='application/octet-stream'",
          "fileExtension='.dmg',mimeType='application/x-apple-diskimage'",
          "fileExtension='.emf',mimeType='image/x-emf'",
          "fileExtension='.properties',mimeType='text/plain'",
          "fileExtension='.xfdf',mimeType='application/vnd.adobe.xfdf'",
          "fileExtension='.vob',mimeType='video/dvd'",
          "fileExtension='.m4v',mimeType='video/x-m4v'",
          "fileExtension='.json',mimeType='application/json'",
          "fileExtension='.oft',mimeType='application/vnd.ms-outlook'",
          "fileExtension='.idml',mimeType='application/epub%u002bzip'",
          "fileExtension='.air',mimeType='application/vnd.adobe.air-application-installer-package zip'",
          "fileExtension='.svg',mimeType='application/svg%u002bxml'",
          "fileExtension='.woff',mimeType='image/eps'",
          "fileExtension='.ai',mimeType='image/ai'",
          "fileExtension='.eps',mimeType='image/eps'"
        ]
  end
end

This runs the first time, subsequent runs do not work and give the following message:

    STDOUT: ERROR ( message:New mimeMap object missing required attributes. Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' s
et to '.sco'
    . )

As with the iis_config resource, I have tried adding the following 'work around' to deal with error 183. As with most commands, windows tends to give too much back and causes things to fail, I added the following line to resources/root.rb:

attribute :returns, :kind_of => [Integer, Array], :default => [0,183]

That also didn't work. I have tried to specify the :config option, using the 'default_documents' and 'mime_types' but unfortunately I get similar errors when the mime types are either missing or present. I also have tried deleting the default list of mime_types from resources/root.rb, which now looks like:

attribute :returns, :kind_of => [Integer, Array], :default => [0,183]
attribute :default_documents_enabled, kind_of: [TrueClass, FalseClass], default: true
attribute :default_documents, kind_of: Array, default: ['Default.htm', 'Default.asp', 'index.htm', 'index.html', 'iisstart.htm', 'default.aspx']
attribute :mime_maps, kind_of: Array, default: []
attribute :add_default_documents, kind_of: Array, default: []
attribute :delete_default_documents, kind_of: Array, default: []
attribute :add_mime_maps, kind_of: Array, default: []
attribute :delete_mime_maps, kind_of: Array, default: []

So, can anyone help here, is there a bug for 2008 r2, I'd rather not have to hack together some powershell script and use this, unfortunately I don't know how to fix it.

Thanks
Phil Smith

@EasyAsABC123

This comment has been minimized.

Copy link
Collaborator

commented Aug 6, 2015

@electronicalias this is exactly the place to complain about this stuff.

👍

I'll launch a win2008r2 box and test this out with vagrant, i'll be using the provided recipe snippet. Please remember that when "working around" error codes you can just add it to the provider

  iis_root 'configuredd' do
    add_default_documents ['index.cfm']
    action :add
    returns [0,183]
    add_mime_maps [
          "fileExtension='.ipx',mimeType='application/x-ipix'",
          "fileExtension='.sco',mimeType='application/x-sibileus-scorch'",
          "fileExtension='.mp4',mimeType='video/mp4v-es'",
          "fileExtension='.sitx',mimeType='application/x-stuffitx'",
          "fileExtension='.indd',mimeType='application/x-indesign'",
          "fileExtension='.indt',mimeType='application/octet-stream'",
          "fileExtension='.inx',mimeType='application/octet-stream'",
          "fileExtension='.dmg',mimeType='application/x-apple-diskimage'",
          "fileExtension='.emf',mimeType='image/x-emf'",
          "fileExtension='.properties',mimeType='text/plain'",
          "fileExtension='.xfdf',mimeType='application/vnd.adobe.xfdf'",
          "fileExtension='.vob',mimeType='video/dvd'",
          "fileExtension='.m4v',mimeType='video/x-m4v'",
          "fileExtension='.json',mimeType='application/json'",
          "fileExtension='.oft',mimeType='application/vnd.ms-outlook'",
          "fileExtension='.idml',mimeType='application/epub%u002bzip'",
          "fileExtension='.air',mimeType='application/vnd.adobe.air-application-installer-package zip'",
          "fileExtension='.svg',mimeType='application/svg%u002bxml'",
          "fileExtension='.woff',mimeType='image/eps'",
          "fileExtension='.ai',mimeType='image/ai'",
          "fileExtension='.eps',mimeType='image/eps'"
        ]
  end
@electronicalias

This comment has been minimized.

Copy link
Author

commented Aug 6, 2015

Thanks and thanks for jumping on this. Not complaining, it's been a good experience so far and I'm a complete novice, both with Chef and Ruby to be honest.

If you mean adding the following:

returns [0,183]

I did, got an error message that it wasn't supported:

NoMethodError
-------------
undefined method `returns' for LWRP resource iis_root from cookbook iis

Just so you're aware, I've run a set of recipes to get this far, install IIS, features, folders and other software, this is one of the last steps. My structure is like this:

cookbooks
 - iis
 - windows
 - websites
   - recipes
     - default.rb

Let me know if you need any more information.

@EasyAsABC123 EasyAsABC123 added the bug label Oct 30, 2015

@EasyAsABC123

This comment has been minimized.

Copy link
Collaborator

commented Dec 1, 2015

This bug does exist it appears to be an issue with multiple iis_root providers being used in a recipe. I'll have to look into making this better.

@tas50 tas50 removed the bug label Aug 2, 2016

@EasyAsABC123

This comment has been minimized.

Copy link
Collaborator

commented May 9, 2017

@electronicalias this is resolved in #351

@EasyAsABC123 EasyAsABC123 referenced this issue May 9, 2017

Merged

`iis_root` custom resource #351

4 of 4 tasks complete

@EasyAsABC123 EasyAsABC123 changed the title iis_root errors on 'duplicate collection entyr of type 'mimeMap' iis_root errors on 'duplicate collection entry of type 'mimeMap' May 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.