Class: ForemanNetbox::SyncHost::SyncVirtualMachine::Validate

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

Instance Method Summary collapse

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/interactors/foreman_netbox/sync_host/sync_virtual_machine/validate.rb', line 9

def call
  validator = ForemanNetbox::VirtualMachineContract.new.call(netbox_params)

  return if validator.success?

  message = validator.errors
                     .messages
                     .map { |m| "#{m.path} #{m.text}" }
                     .to_sentence
  context.fail!(error: _('Invalid Virtual Machine parameters: %s') % message)
end