Class: ForemanNetbox::DeleteHost::DeleteDevice

Inherits:
Object
  • Object
show all
Includes:
Interactor
Defined in:
app/interactors/foreman_netbox/delete_host/delete_device.rb

Instance Method Summary collapse

Instance Method Details

#callObject



12
13
14
15
16
17
# File 'app/interactors/foreman_netbox/delete_host/delete_device.rb', line 12

def call
  ForemanNetbox::API.client.dcim.devices.find_by(name: context.host.name)&.delete
rescue NetboxClientRuby::LocalError, NetboxClientRuby::ClientError, NetboxClientRuby::RemoteError => e
  ::Foreman::Logging.logger('foreman_netbox/import').error("#{self.class} error #{e}: #{e.backtrace}")
  context.fail!(error: "#{self.class}: #{e}")
end