Class: PuavoRest::BootConfigurations

Inherits:
PuavoSinatra
  • Object
show all
Defined in:
resources/boot_configurations.rb

Constant Summary

Constant Summary

Constants inherited from PuavoSinatra

PuavoSinatra::ROOT

Instance Method Summary (collapse)

Methods inherited from PuavoSinatra

#auth, #basic_auth, #flog, #flog=, #from_post, #json_params, #kerberos, #legacy_server_auth, #limit, #pw_mgmt_server_auth, #server_auth, #txt

Instance Method Details

- (Object) boot_configuration



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'resources/boot_configurations.rb', line 53

def boot_configuration
  auth :server_auth

  log_attrs = {
    :mac_address => params["mac_address"]
  }

  # Get Device or LtspServer
  begin
    host = Host.by_mac_address!(params["mac_address"])
  rescue NotFound => e
    log_attrs[:unregistered] = true
    # Create dummy host object for getting boot configuration for unregistered device
    host = UnregisteredDevice.new
  end


  if not log_attrs[:unregistered]
    log_attrs.merge!(host.to_hash)
    host.save_boot_time
  end

  flog.info "send boot configuration", :host => log_attrs

  host.grub_boot_configuration
end