extensions/deregistration.rb
# Remove the Sensu client from the registry, using the Sensu
# API. This method returns `true` if the Sensu client deletion
# was successful.
#
# @param event [Hash]
# @return [TrueClass, FalseClass]
Remove the Sensu client from the registry, using the Sensu
API. This method returns `true` if the Sensu client deletion
was successful.
Remove the Sensu client from the registry using the Sensu API . This method returns ` true ` if the Sensu client deletion was successful .
def remove_sensu_client!(event)
        http = Net::HTTP.new(api.fetch(:host, '127.0.0.1'), api.fetch(:port, 4567))
        client_name = event[:client][:name]
        request = Net::HTTP::Delete.new("/clients/#{client_name}")
        if api[:user] && api[:password]
          request.basic_auth(api[:user], api[:password])
        end
        response = http.request(request)
        response.code == '202'
      end
def remove_sensu_client! ( event ) http = Net :: HTTP . new ( api . fetch ( :host , '127.0.0.1' ) , api . fetch ( :port , 4567 ) ) client_name = event [ :client ] [ :name ] request = Net :: HTTP :: Delete . new ( "/clients/#{client_name}" ) if api [ :user ] && api [ :password ] request . basic_auth ( api [ :user ] , api [ :password ] ) end response = http . request ( request ) response . code == '202' end
Remove the Sensu client from the registry, using the Sensu
API.
Remove the Sensu client from the registry using the Sensu API .
None
TrueClass, FalseClass
event
<not_specific>
<not_specific>
None