Class: Chef::Handler::ConsulRelease
- Inherits:
-
Chef::Handler
- Object
- Chef::Handler
- Chef::Handler::ConsulRelease
- Defined in:
- lib/chef/handler/consul_release.rb
Instance Method Summary collapse
-
#initialize(host, session, key) ⇒ ConsulRelease
constructor
A new instance of ConsulRelease.
- #report ⇒ Object
Constructor Details
#initialize(host, session, key) ⇒ ConsulRelease
Returns a new instance of ConsulRelease.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/chef/handler/consul_release.rb', line 24 def initialize(host, session, key) @host = host @session = session @key = key Chef::Log.info("Consul release handler host: #{@host}") Chef::Log.info("Consul release handler key: #{@key}") Chef::Log.info("Consul release handler session: #{@session}") end |
Instance Method Details
#report ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/chef/handler/consul_release.rb', line 35 def report Chef::Log.info "Removing Consul lock" Diplomat.configure do |config| config.url = 'http://' + @host + ':8500' end Chef::Log.info("Releasing consul lock #{@key}?release?#{@session}@#{@host}") Diplomat::Lock.release(@key,@session) Diplomat::Session.destroy(@session) end |