Sha256: ce71eddd26a6cf4b6a337134e5448a4939eea6c70f0f9ec8209e7ae28ec33c88

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

module ProxyAPI
  class TFTP < Resource
    def initialize args
      @url     = args[:url] + "/tftp"
      @variant = args[:variant]
      super args
    end

    # Creates a TFTP boot entry
    # [+mac+]  : MAC address
    # [+args+] : Hash containing
    #    :pxeconfig => String containing the configuration
    # Returns  : Boolean status
    def set mac, args
      parse(post(args, "#{@variant}/#{mac}"))
    end

    # Deletes a TFTP boot entry
    # [+mac+] : String in coloned sextuplet format
    # Returns : Boolean status
    def delete mac
      parse(super("#{@variant}/#{mac}"))
    end

    # 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
    def fetch_boot_file args
      parse(post(args, "fetch_boot_file"))
    end

    # returns the TFTP boot server for this proxy
    def bootServer
      if (response = parse(get("serverName"))) and response["serverName"].present?
        return response["serverName"]
      end
      false
    rescue RestClient::ResourceNotFound
      nil
    end

    # Create a default pxe menu
    # [+args+] : Hash containing
    #   :menu => String containing the menu text
    # Returns    : Boolean status
    def create_default args
      parse(post(args, "create_default"))
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/lib/proxy_api/tftp.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/lib/proxy_api/tftp.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/lib/proxy_api/tftp.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/lib/proxy_api/tftp.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/lib/proxy_api/tftp.rb