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

windows_http_acl does not work on non-English Windows #379

Open
maltewitt opened this issue Jul 14, 2016 · 6 comments
Open

windows_http_acl does not work on non-English Windows #379

maltewitt opened this issue Jul 14, 2016 · 6 comments
Labels
Type: Bug Doesn't work as expected.

Comments

@maltewitt
Copy link

maltewitt commented Jul 14, 2016

Cookbook version

1.39.2

Chef-client version

12.9.38

Platform Details

Windows 7 Enterprise (German)

Scenario:

When trying to use the windows_http_acl resource, it fails while checking if the requested URL is already registered.
This works fine, if I use an English Windows or an English language pack and switch language to English for the current user.

Steps to Reproduce:

Install some non-English language pack (i.e. German) and switch current users language settings to that language. Try running a recipe with windows_http_acl resource used.

windows_http_acl "http://+:#{node[:cp_suite_drop][:airport]}/" do
    user "Jeder"
end

Expected Result:

windows_http_acl should not fail, but successfully register the requested URL

Actual Result:

Generated at 2016-07-14 16:52:25 +0200
Mixlib::ShellOut::ShellCommandFailed: windows_http_acl[http://+:8086/](cp_suite_drop::zip line 60) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of C:\Windows\system32\netsh.exe http add urlacl url=http://+:8086/ user="Jeder" ----
STDOUT: Die URL-Reservierung konnte nicht hinzugef�gt werden. Fehler: 183

Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist.
STDERR:
---- End output of C:\Windows\system32\netsh.exe http add urlacl url=http://+:8086/ user="Jeder" ----

@maltewitt
Copy link
Author

I just looked into http_acl.rb and noticed that getCurrentAcl is parsing netsh output and looking for the string "User:". Using German Windows, this would be "Benutzer:"

def getCurrentAcl
  cmd = shell_out!("#{@command} http show urlacl url=#{@current_resource.url}")
  Chef::Log.debug "netsh reports: #{cmd.stdout}"

  m = cmd.stdout.scan(/User:\s*(.+)/)
  ...

@mwrock
Copy link
Contributor

mwrock commented Jul 15, 2016

seems like we need to find another API to get this info in a language agnostic format

@maltewitt
Copy link
Author

To get around this issue in my case I put the http_acl stuff into a new cookbook and wrote a library for getting current urlacl using Windows-API via FFI.
Of course I would be willing to share that code, but I am not sure if windows cookbook wants to depend on ffi gem... Let me know if you are interested in my solution.

@mwrock
Copy link
Contributor

mwrock commented Jul 21, 2016

chef core already depends and makes ample use of it. I for one would be very open to reviewing such a PR.

@maltewitt
Copy link
Author

Best way to share would probably be creating a fork and moving my changes to that fork, followed by a pull request, right? (sorry for that github-beginner-question ;-) )

@mwrock
Copy link
Contributor

mwrock commented Jul 21, 2016

No worries. Thats exactly right.

@tas50 tas50 added the Type: Bug Doesn't work as expected. label Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Doesn't work as expected.
Development

No branches or pull requests

3 participants