Skip to content

Commit 116dce4

Browse files
committed
Fix remove network monitors method network monitor validation in NetworkMonitor
1 parent ad346cf commit 116dce4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/softlayer/NetworkMonitor.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,16 @@ def self.remove_network_monitor_notification_users(server, user_customers, optio
246246
end
247247

248248
##
249-
# Removes the list of network monitors from their associated servers
249+
# Removes the list of network monitors from their associated servers. Accpets a list of NetworkMonitor instances or id's.
250250
#
251251
def self.remove_network_monitors(network_monitors, options = {})
252252
softlayer_client = options[:client] || Client.default_client
253253
raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client
254254

255255
network_monitors_data = network_monitors.map do |network_monitor|
256-
raise "#{__method__} requires a network monitor instance or id but non provided" if !network_monitor || !(network_monitor.kind_of?(Hash) && network_monitor['id'])
256+
raise "#{__method__} requires a network monitor instance or id but non provided" if !network_monitor || (!network_monitor.kind_of?(NetworkMonitor) && network_monitor.empty?)
257257

258-
network_monitor.kind_of?(Hash) ? { 'id' => network_monitor['id'] } : { 'id' => network_monitor }
258+
network_monitor.kind_of?(NetworkMonitor) ? { 'id' => network_monitor['id'] } : { 'id' => network_monitor }
259259
end
260260

261261
softlayer_client[:Network_Monitor_Version1_Query_Host].deleteObjects(network_monitors_data)

0 commit comments

Comments
 (0)