bin/check-dhcp.rb in sensu-plugins-dhcp-0.0.4 vs bin/check-dhcp.rb in sensu-plugins-dhcp-1.0.0

- old
+ new

@@ -72,11 +72,11 @@ description: 'Enable verbose debugging output', short: '-d', long: '--debug', boolean: true - def dhcp_discover # rubocop:disable all + def dhcp_discover request = DHCP::Discover.new listensock = UDPSocket.new sendsock = UDPSocket.new @@ -103,11 +103,11 @@ # and set this as the gateway address in the DHCP message request.giaddr = IPAddr.new(sendsock.addr.last).to_i end # #YELLOW - if config[:debug] # rubocop:disable IfUnlessModifier + if config[:debug] puts request end sendsock.send(request.pack, 0) @@ -130,11 +130,11 @@ # Returns a DHCP::Message object, or nil if not parseable DHCP::Message.from_udp_payload(data[0]) end - def run # rubocop:disable all + def run response = dhcp_discover if response puts response if config[:debug] if config[:offer] || config[:ipaddr] @@ -155,10 +155,10 @@ else critical "Message received from #{config[:server]} not a DHCP offer" end else # Is response a DHCP message? - if response.is_a?(DHCP::Message) + if response.is_a?(DHCP::Message) # rubocop:disable Style/IfInsideElse ok 'Received DHCP response' else critical "Message received from #{config[:server]} not a valid DHCP response" end end