Class: ForemanNetbox::SyncHost::SyncVirtualMachine::SyncInterfaces::SyncIpAddresses::Find

Inherits:
Object
  • Object
show all
Includes:
Interactor
Defined in:
app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/find.rb

Instance Method Summary collapse

Instance Method Details

#callObject



11
12
13
14
15
16
# File 'app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/find.rb', line 11

def call
  context.ip_addresses = ForemanNetbox::API.client.ipam.ip_addresses.filter(params)
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

#paramsObject



18
19
20
21
22
# File 'app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/find.rb', line 18

def params
  {
    virtual_machine_id: context.virtual_machine.id,
  }
end