Class: UserdataController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/userdata_controller.rb

Constant Summary collapse

FILTERS =

Skip default filters for user-data

[
  :require_login,
  :session_expiry,
  :update_activity_time,
  :set_taxonomy,
  :authorize,
  :verify_authenticity_token
].freeze

Instance Method Summary collapse

Instance Method Details

#metadataObject



25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/userdata_controller.rb', line 25

def 
  data = {
    :'instance-id' => "i-#{Digest::SHA1.hexdigest(@host.id.to_s)[0..17]}",
    :hostname => @host.name,
    :mac => @host.mac,
    :'local-ipv4' => @host.ip,
    :'local-hostname' => @host.name
  }
  render :plain => data.map { |key, value| "#{key}: #{value}" }.join("\n")
end

#userdataObject



20
21
22
23
# File 'app/controllers/userdata_controller.rb', line 20

def userdata
  template = render_userdata_template
  render :plain => template if template
end