Class: ForemanNetbox::DeleteHost::DeleteVirtualMachine
- Inherits:
-
Object
- Object
- ForemanNetbox::DeleteHost::DeleteVirtualMachine
- Includes:
- Interactor
- Defined in:
- app/interactors/foreman_netbox/delete_host/delete_virtual_machine.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 |
# File 'app/interactors/foreman_netbox/delete_host/delete_virtual_machine.rb', line 12 def call ForemanNetbox::API.client.virtualization.virtual_machines.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 |