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

consul_service reload on Windows fails #334

Closed
anuriq opened this issue Jul 5, 2016 · 7 comments
Closed

consul_service reload on Windows fails #334

anuriq opened this issue Jul 5, 2016 · 7 comments

Comments

@anuriq
Copy link

anuriq commented Jul 5, 2016

@Ginja @jirkafajfr
Referring to #330

Check cwd parameter of execute block:

         * consul_service[consul] action reload
           * execute[Reload consul] action run

             ================================================================================
             Error executing action `run` on resource 'execute[Reload consul]'
             ================================================================================

             SystemCallError
             ---------------
             The directory name is invalid. - CreateProcessW

             Resource Declaration:
             ---------------------
             # In C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/consul/libraries/consul_service_windows.rb

       68:           execute 'Reload consul' do
       69:             command 'consul.exe reload'
       70:             cwd ::File.dirname(new_resource.program)
       71:             action :run
       72:           end
       73:         end

             Compiled Resource:
             ------------------
             # Declared in C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/consul/libraries/consul_service_windows.rb:68:in `block in action_reload'

             execute("Reload consul") do
        action [:run]
        retries 0
        retry_delay 2
        default_guard_interpreter :execute
        command "consul.exe reload"
        backup 5
        cwd "/usr/local/bin"
        returns 0
        declared_type :execute
        cookbook_name "mycookbook"
             end

             Platform:
             ---------
             i386-mingw32


           ================================================================================
           Error executing action `reload` on resource 'consul_service[consul]'
           ================================================================================

           SystemCallError
           ---------------
           execute[Reload consul] (C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/consul/libraries/consul_service_windows.rb line 68) had an error: SystemCallError: The directory name is invalid. - CreateProcessW

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

           142: consul_service 'consul' do
           143:   action :reload
           144: end

           Compiled Resource:
           ------------------
           # Declared in C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/env-fdm-scep/recipes/default.rb:142:in `from_file'

           consul_service("consul") do
             action [:reload]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             declared_type :consul_service
             cookbook_name "env-fdm-scep"
             recipe_name "default"
             program "/usr/local/bin/consul"
           end

           Platform:
           ---------
           i386-mingw32


       Running handlers:
       [2016-07-05T13:03:53+03:00] ERROR: Running exception handlers
       Running handlers complete
       [2016-07-05T13:03:53+03:00] ERROR: Exception handlers complete
       Chef Client failed. 6 resources updated in 46 seconds
@jirkafajfr
Copy link

Hi,

are you sure that:

  • consul::default is in your run list prior to resource definition which notifies restart (even in second run)? ln-74. sets consul_service.program to same value as consul_installation.consul_program.
  • aren't you defining own consul_service[consul] and not specifying program property? Notify then doesn't know which resource should be executed (resource cloning).
  • are you using binary installation? Other versions won't work since they don't provide proper consul_program for windows environments (but you would not pass even installation).

@jirkafajfr
Copy link

jirkafajfr commented Jul 5, 2016

Hi @anuriq,

its actually visible in your log:

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

142: consul_service 'consul' do
143:   action :reload
144: end

You should not have two resources of same type which are sharing name (see CHEF-3694). Since program property is not set in your definition it will use default and fail.

I don't think that you should reload config with each converge. But equivalent to your code would be

log 'reload consul' do
  notifies :reload, 'consul_service[consul]', :immediate
end

@anuriq
Copy link
Author

anuriq commented Jul 5, 2016

Hi @jirkafajfr
I provided wrong log. In this case i added consul_service explicitly.
I define consul_service['consul'] one time in a "base" cookbook with action :nothing. Then definitions notify it. I'll provide correct log, where no duplicate consul_service is defined and error is the same.

@jirkafajfr
Copy link

I think that's actually your problem. You should not define consul_service[consul] at all. It's already defined in consul cookbook default recipe with proper parameters.

@anuriq
Copy link
Author

anuriq commented Jul 7, 2016

we just have a really weird installation method for consul. you are right. thanks!

@anuriq anuriq closed this as completed Jul 7, 2016
@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants