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

Cookbook issue with Windows path #48

Closed
cjohannsen81 opened this Issue May 21, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@cjohannsen81
Contributor

cjohannsen81 commented May 21, 2016

Hey,

I just tested the cookbook against a Windows node and it fails:

 cjo@Christians-MBP  ~/Downloads/chef-repo/cookbooks/atom git:(master) ✗ kitchen converge
-----> Starting Kitchen (v1.7.3)
-----> Converging <default-windows-2012r2>...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 4.2.1...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)

       Transferring files to <default-windows-2012r2>
       Starting Chef Client, version 12.10.24
       resolving cookbooks for run list: ["audit::default"]
       Synchronizing Cookbooks:
         - audit (0.8.0)
       Installing Cookbook Gems:
       Compiling Cookbooks...
       Converging 2 resources
       Recipe: audit::default
         * compliance_profile[windows] action fetch
           * chef_gem[inspec] action install (up to date)
       [2016-05-21T10:21:42-07:00] WARN: Using inspec version: (0.22.1)
           - install/update inspec
           * directory[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/compliance] action create (up to date)
       URL: https://192.168.178.221/api/owners/base/compliance/windows/tar

           ================================================================================
           Error executing action `fetch` on resource 'compliance_profile[windows]'
           ================================================================================

           Errno::EACCES
           -------------
           Permission denied @ sys_fail2 - (C:/Users/vagrant/AppData/Local/Temp/foo20160521-2220-1c553kw, C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/compliance/base_windows.tgz)

           Resource Declaration:
           ---------------------
           # In C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/audit/recipes/default.rb

            30:   compliance_profile p do
            31:     owner o
            32:     server server
            33:     token token
            34:     inspec_version node['audit']['inspec_version']
            35:     action [:fetch, :execute]
            36:   end
            37: end

           Compiled Resource:
           ------------------
           # Declared in C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/audit/recipes/default.rb:30:in `block in from_file'

           compliance_profile("windows") do
             action [:fetch, :execute]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             declared_type :compliance_profile
             cookbook_name "audit"
             recipe_name "default"
             owner "base"
             server #<URI::HTTPS:0x0000000132e3e8 URL:https://192.168.178.221/api/owners/base/compliance/windows/tar>
             token "eyJhbGciOiJSUzI1NiIsImtpZCI6InFfa3ZHdWVLSHJhSkRCelY0NjBEMFBVb0g1ZnFTTGhSdC1odGh0WGhHbVZPNFJXeHRLNTYzR2JZbmNtNlRkRWVlZTFjdUJwUDJvWDkyRC1ndWRneEhXSUZybF85Yno0cGVVNTVvcDNmekNaeUxDWTk0RDNiMlhXRE9rdy1CTVhIM2dpTmtIeHVjblRMV045LS04eU9aY0p0WXliOU9DNDV1ZUFjNkc2YkhoYWY5YTZlbTZfelNiMlFmN01FN2h2bDJtX2JzVW9LUzB4RGNpYjdRb2FYTldNamdqX3A1b2xHUEdzaVZ3SzA4RXR4MmVva0FENk1MeEdIYlB0ZFRpOTFDQzFPVVhIOFUzQXVUc2tsOVZwci14OG91SDBnRzB6NlZYT3FWM0JzczNZbVQ1czhGWktTWVdseE9hcFRtSGJ1UlZqZ2hCcUVraHZjdnBnZ2ZYRG1CUT09IiwidHlwIjoiSldUIn0.eyJhdWQiOiIwTHZDTVh3ODUwVXg0Rzh5U2ljWW9BUVpnR2ZCRUpkV2VPQkxHWVo3dmtFPUB2YWdyYW50LXVidW50dS10cnVzdHktNjQiLCJjb25uZWN0b3JfaWQiOiJDb21wbGlhbmNlIFNlcnZlciIsImNvbm5lY3Rvcl9pbmZvIjoiaHR0cHM6Ly92YWdyYW50LXVidW50dS10cnVzdHktNjQvYXBpLyIsImNvbm5lY3Rvcl90eXBlIjoiY29tcGxpYW5jZSIsImVtYWlsIjoiY2hyaXN0aWFuQGNvbXBsaWFuY2UuZmFrZSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJleHAiOjEuNDYzODg0M2UrMDksImlhdCI6MS40NjM4NDExZSswOSwiaXNzIjoiaHR0cHM6Ly92YWdyYW50LXVidW50dS10cnVzdHktNjQiLCJuYW1lIjoiY2hyaXN0aWFuIiwic3ViIjoiOWZkYWFmNDUtZWI0YS00MDYzLWJkOWQtZjRmMDk1YjU2ODg3In0.O4YpXz3PeJf91eEXwh7QGLt6u1sfyaVUwD4VcrfRmH-zJ97a3NNXffS_v4gkmFJokw_3ZR6m8qbdW3E9y4lXKSMQroLkISH10D1QMNNbbN8tC1Qjj-gbYu7Vp4vkwgSi8gt88E418GLwo7rY3AdFW03T6aRhqaMWZEJulEFEX8-xXuBrJN7Vgg1MaoLSZ-Ac9ono5MLA25Os9DoDEB9Kkmf2crSEyqd-QigurVNmf6smUmkoWuhUa_-XjqkXK5VMwE3Q51pQaIgzNfaJlXEZG-ol3Fb3ziYZ3syNJr_0M2BcUX4YTZStsf2wCtG-Z0SKK8CDRQylaLP1lb418NE-EA"
             inspec_version "0.22.1"
             profile "windows"
           end

           Platform:
           ---------
           x64-mingw32


       Running handlers:
       [2016-05-21T10:21:43-07:00] ERROR: Running exception handlers
       Running handlers complete
       [2016-05-21T10:21:43-07:00] ERROR: Exception handlers complete
       Chef Client failed. 0 resources updated in 11 seconds
       [2016-05-21T10:21:43-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
       [2016-05-21T10:21:43-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2016-05-21T10:21:43-07:00] FATAL: Errno::EACCES: compliance_profile[windows] (audit::default line 30) had an error: Errno::EACCES: Permission denied @ sys_fail2 - (C:/Users/vagrant/AppData/Local/Temp/foo20160521-2220-1c553kw, C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/compliance/base_windows.tgz)
>>>>>> Converge failed on instance <default-windows-2012r2>.
>>>>>> Please see .kitchen/logs/default-windows-2012r2.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: WinRM exited (1) for command: [
$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH","Machine")

& $env:systemdrive\opscode\chef\bin\chef-client.bat --local-mode --config $env:TEMP\kitchen\client.rb --log_level auto --force-formatter --no-color --json-attributes $env:TEMP\kitchen\dna.json --chef-zero-port 8889]
>>>>>> ----------------------

While checking the code it seems that the Windows path has forward instead of backward slashes.

[2016-05-21T10:21:43-07:00] FATAL: Errno::EACCES: compliance_profile[windows] (audit::default line 30) had an error: Errno::EACCES: Permission denied @ sys_fail2 - (C:/Users/vagrant/AppData/Local/Temp/foo20160521-2220-1c553kw, C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/compliance/base_windows.tgz)
`

Seems that the path relies on Chef::Config but for direct connections that does not work.

@cjohannsen81

This comment has been minimized.

Show comment
Hide comment
@cjohannsen81

cjohannsen81 May 26, 2016

Contributor

Fixed

Contributor

cjohannsen81 commented May 26, 2016

Fixed

@iennae iennae removed the in progress label May 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment