Class: ForemanNetbox::SyncHost::SyncVirtualMachine::Update

Inherits:
Object
  • Object
show all
Includes:
Concerns::AssignTags, Concerns::PrimaryIps, Interactor
Defined in:
app/interactors/foreman_netbox/sync_host/sync_virtual_machine/update.rb

Constant Summary collapse

ATTRIBUTES =
%i[name cluster disk memory primary_ip4 primary_ip6 tenant vcpus].freeze

Instance Method Summary collapse

Methods included from Concerns::AssignTags

#assign_tags_to, #default_tag_ids

Methods included from Concerns::PrimaryIps

#ip_addresses_map, #primary_ip4, #primary_ip6

Instance Method Details

#callObject



21
22
23
24
25
26
27
28
29
# File 'app/interactors/foreman_netbox/sync_host/sync_virtual_machine/update.rb', line 21

def call
  assign_new_attributes
  assign_tags_to(virtual_machine)

  virtual_machine.save
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