Class: ProxyAPI::TFTP

Inherits:
Resource show all
Defined in:
lib/proxy_api/tftp.rb

Instance Attribute Summary

Attributes inherited from Resource

#url

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ TFTP


3
4
5
6
7
# File 'lib/proxy_api/tftp.rb', line 3

def initialize args
  @url     = args[:url] + "/tftp"
  @variant = args[:variant]
  super args
end

Instance Method Details

#bootServerObject

returns the TFTP boot server for this proxy


35
36
37
38
39
40
41
42
# File 'lib/proxy_api/tftp.rb', line 35

def bootServer
  if (response = parse(get("serverName"))) and response["serverName"].present?
    return response["serverName"]
  end
  false
rescue RestClient::ResourceNotFound
  nil
end

#create_default(args) ⇒ Object

Create a default pxe menu

args

: Hash containing

:menu => String containing the menu text

Returns : Boolean status


48
49
50
# File 'lib/proxy_api/tftp.rb', line 48

def create_default args
  parse(post(args, "create_default"))
end

#delete(mac) ⇒ Object

Deletes a TFTP boot entry

mac

: String in coloned sextuplet format

Returns : Boolean status


21
22
23
# File 'lib/proxy_api/tftp.rb', line 21

def delete mac
  parse(super("#{@variant}/#{mac}"))
end

#fetch_boot_file(args) ⇒ Object

Requests that the proxy download the bootfile from the media's source

args

: Hash containing

:prefix => String containing the location within the TFTP tree to store the file
:path   => String containing the URL of the file to download

Returns : Boolean status


30
31
32
# File 'lib/proxy_api/tftp.rb', line 30

def fetch_boot_file args
  parse(post(args, "fetch_boot_file"))
end

#set(mac, args) ⇒ Object

Creates a TFTP boot entry

mac

: MAC address

args

: Hash containing

:pxeconfig => String containing the configuration

Returns : Boolean status


14
15
16
# File 'lib/proxy_api/tftp.rb', line 14

def set mac, args
  parse(post(args, "#{@variant}/#{mac}"))
end