Class: Chef::Handler::ConsulRelease

Inherits:
Chef::Handler show all
Defined in:
lib/chef/handler/consul_release.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, session, key) ⇒ ConsulRelease

Returns a new instance of ConsulRelease.



24
25
26
27
28
# File 'lib/chef/handler/consul_release.rb', line 24

def initialize(host, session, key)
  @host = host
  @session = session
  @key = key
end

Instance Method Details

#reportObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/chef/handler/consul_release.rb', line 30

def report
  Chef::Log.info "Removing Consul lock"

  Diplomat.configure do |config|
    config.url = 'http://' + @host + ':8500'
  end

  Diplomat::Lock.release(@key,@session)
  Diplomat::Session.destroy(@session)
end