Put the nil check back when building the results hash.
authorMahlon E. Smith <mahlon@martini.nu>
Tue, 06 Sep 2016 10:57:38 -0700
changeset 3 d46ca2b52efe
parent 2 3d395894a3cf
child 4 e6eb11b1e00d
Put the nil check back when building the results hash.
lib/arborist/monitor/snmp.rb
--- a/lib/arborist/monitor/snmp.rb	Mon Sep 05 20:59:01 2016 -0700
+++ b/lib/arborist/monitor/snmp.rb	Tue Sep 06 10:57:38 2016 -0700
@@ -23,7 +23,7 @@
 	log_to :arborist
 
 	# The version of this library.
-	VERSION = '0.2.0'
+	VERSION = '0.2.1'
 
 	# "Modes" that this monitor understands.
 	VALID_MODES = %i[ disk load memory swap process ]
@@ -248,8 +248,8 @@
 		# Map everything back to identifier -> attribute(s), and send to the manager.
 		#
 		reply = self.results.each_with_object({}) do |(address, results), hash|
-			identifier = self.identifiers[ address ].first
-			hash[ identifier ] = results
+			identifier = self.identifiers[ address ] or next
+			hash[ identifier.first ] = results
 		end
 		self.log.debug "Sending to manager: %p" % [ reply ]
 		return reply