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 2012 R2 Issue #295

Closed
rossedman opened this issue Mar 17, 2016 · 6 comments
Closed

Windows 2012 R2 Issue #295

rossedman opened this issue Mar 17, 2016 · 6 comments

Comments

@rossedman
Copy link

Hey everyone,

I am getting an action_reload error. I see that there is a method in ConsulServiceWindows called action_restart. I am not sure if this is where the disconnect is. Has anyone else experienced this?

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

NoMethodError
-------------
No resource or method named `action_reload' for `ConsulCookbook::Provider::ConsulServiceWindows ""'

Resource Declaration:
---------------------
# In C:\Users\vagrant\AppData\Local\Temp\kitchen\cookbooks\consul\recipes\default.rb

 50: consul_service node['consul']['service_name'] do |r|
 51:   unless platform?('windows')
 52:     user node['consul']['service_user']
 53:     group node['consul']['service_group']
 54:   end
 55:   version node['consul']['version']

Compiled Resource:
------------------
# Declared in C:\Users\vagrant\AppData\Local\Temp\kitchen\cookbooks\consul\recipes\default.rb:50:in `from_file'

consul_service("consul") do
  action [:enable]
  updated true
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  declared_type :consul_service
  cookbook_name :consul
  recipe_name "default"
  version "0.6.3"
  config_file "C:\\Program Files\\consul\\consul.json"
  config_dir "C:\\Program Files\\consul\\conf.d"
  install_path "C:\\Program Files\\consul"
  install_method "binary"
  binary_url "https://releases.hashicorp.com/consul/%{version}/%{filename}.zip"
  source_url "https://github.com/hashicorp/consul"
  nssm_params {"AppDirectory"=>"C:\\Program Files\\consul\\data", "AppStdout"=>"C:\\Program Files\\consul\\stdout.log", "AppStderr"=>"C:\\Program Files\\consul\\error.log", "AppRotateFiles"=>1, "AppRotateOnline"=>1, "AppRotateBytes"=>20000000}
  data_dir "C:\\Program Files\\consul\\data"
end

This also has a reference in the error log to line 50 in the consul::default recipe:

config = consul_config service_name do |r|
  unless windows?
    owner node['consul']['service_user']
    group node['consul']['service_group']
  end
  node['consul']['config'].each_pair { |k, v| r.send(k, v) }
  notifies :reload, "consul_service[#{service_name}]", :delayed
end

Any help would be greatly appreciated. Thanks so much. This cookbook has been amazing so far.

johnbellone pushed a commit that referenced this issue Mar 17, 2016
This addresses #295; because the nssm manager does not support the
concept of reloading this is going to be no-op action that we're simply
going to warn about in the Chef logs.
@johnbellone
Copy link
Contributor

Please give it a test with the latest version. I added a no-op action for reload on Windows.

@rossedman
Copy link
Author

@johnbellone thank you very much. Also wanted to say how nice this cookbook is. Really like the libraries and how they are built. Much appreciated. Will report back on this.

@wstaples
Copy link

What about shelling out to consul directly?
the command consul reload would accomplish most of what is needed.

I would be nice if I could still use the notifies :reload that way it will reload the service on OS's that support it.

Here are some issues that would need to be addressed.

  1. we need to see if the consul service is running. If not we don't need to do anything changes will be picked up when it is started. If we try anyway consul will return some kind of error
  2. we need to provide the IP address and port consul reload -rpc-addr=127.0.0.1:8400
  3. we may need to provide SSL certs as well

There is also the question of using chefs service reload resource to do something that is not a service reload. I'm not sure if its a best practice.

@rossedman
Copy link
Author

@wstaples To my understanding the reload wasn't removed. There was a missing method for the Windows reload call that was filled in just with a dummy method. This wouldn't effect any Linux distros or how the reload works.

@wstaples
Copy link

@rossedman I know that it wont effect any linux distros. The issue is It will not actually do anything on windows to make a new config change work. Consider the following scenario:

  1. setup a check, service, or some piece of config
  2. Use test kitchen to converge a windows box.
  3. test your setup and it works
  4. change a check or service def in the cookbook
  5. converge again
  6. whatever change you made has not been applied to the running consul service
  7. manually run consul --reload or use nssm to restart the service and your change will take effect.

@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

3 participants