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

Unlock attribute within section #241

Closed
surrealchemist opened this issue Jan 28, 2016 · 9 comments
Closed

Unlock attribute within section #241

surrealchemist opened this issue Jan 28, 2016 · 9 comments

Comments

@surrealchemist
Copy link

In some cases you may need to unlock an attribute (this is IIS configuration attribute I am talking about not chef attribute) within a section in the configuration editor, but I only see options to unlock a section.

For example, in my case I need to go into "system.webServer/httpErrors" and unlock the "defaultPath" attribute so the application can override it. It doesn't look like appcmd has a way to do it, but I found some powershell code that would allow me to do it (Not sure if this is included without installing anything extra):

powershell_script 'Unlock the httpErrors defaultPath attribute' do
  code <<-EOH
  Remove-WebConfigurationLock -Filter "system.webServer/httpErrors/@defaultPath"
  EOH
end

Perhaps this would be a more efficient way to edit the global config than appcmd and allow for more features.

@spuder
Copy link
Contributor

spuder commented Mar 6, 2016

appcmd is able to do locking / unlocking. I'm not sure if this is the same unlocking that you are referring to.

#208 (comment)

Eventually I'd like to add more of the appcmd commands. If appcmd unlock works the same as Remove-WebConfigurationLock it should be a pretty easy feature to add.

@EasyAsABC123
Copy link
Contributor

@surrealchemist if this fixes it

%windir%\System32\inetsrv\appcmd unlock config -section:system.webserver/httperrors

then the chef code would be

iis_section 'unlocks httpErrors for webserver' do
  section 'system.webserver/httperrors'
  action :unlock
end

@EasyAsABC123
Copy link
Contributor

will be testing this soon

@tas50
Copy link
Contributor

tas50 commented Mar 7, 2017

@EasyAsABC123 Did you ever get a chance to test this issue?

@EasyAsABC123
Copy link
Contributor

@tas50 i've been waiting for the original poster to respond. I wasn't able to replicate, but I suppose i can try to replicate again.

@surrealchemist
Copy link
Author

surrealchemist commented Mar 8, 2017

Sorry I never replied. Unfortunately I am no longer working at the company where I was writing the playbook that used this so I'm not really able to test at this point myself.

@EasyAsABC123
Copy link
Contributor

@surrealchemist no worries, thanks for reporting the issue. i'll work on replicating it locally for me.

@EasyAsABC123
Copy link
Contributor

waiting until iis_section is on the block for re-write, at that time this will have tests

@EasyAsABC123
Copy link
Contributor

This can be done with, test will be added soon...this isn't idempotent, closing issue

iis_section 'unlocks httpErrors for webserver' do
  section 'system.webserver/httperrors'
  action :unlock
end

iis_config 'change @httpErrors' do
  cfg_cmd '"MACHINE/WEBROOT/APPHOST/" -section:"system.webServer/httpErrors" -lockAttributes:"allowAbsolutePathsWhenDelegated" -commit:apphost'
  action :set
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants