Skip to content

Instantly share code, notes, and snippets.

@nuheluxulu

nuheluxulu/error Secret

Created April 27, 2019 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuheluxulu/7c425025a503c50b991bab75659d64be to your computer and use it in GitHub Desktop.
Save nuheluxulu/7c425025a503c50b991bab75659d64be to your computer and use it in GitHub Desktop.
1) Proxmox nodes should get a list of nodes
Failure/Error:
def initialize(**opts)
@cpu = opts['cpu']
@level = opts['level']
@maxcpu = opts['maxcpu']
@maxmem = opts['maxmem']
@mem = opts['mem']
@node = opts['node']
@ssl_fingerprint = opts['ssl_fingerprint']
@status = opts['status']
@uptime = opts['uptime']
ArgumentError:
wrong number of arguments (given 1, expected 0)
class Node
attr_reader :cpu,:level, :maxcpu, :maxmem, :mem, :node, :ssl_fingerprint, :status, :uptime, :id, :type, :disk, :maxdisk
def initialize(**opts)
@cpu = opts['cpu']
@level = opts['level']
@maxcpu = opts['maxcpu']
@maxmem = opts['maxmem']
@mem = opts['mem']
@node = opts['node']
@ssl_fingerprint = opts['ssl_fingerprint']
@status = opts['status']
@uptime = opts['uptime']
@id = opts['id']
@type = opts['type']
@disk = opts['disk']
@maxdisk = opts['maxdisk']
end
def self.factory_from_json(json_data)
puts json_data.class
puts json_data
puts json_data.first
puts json_data.first.class
puts json_data['cpu']
puts json_data['cpu'].class
Node.new({"node"=>"my_node", "mem"=>65118486528, "cpu"=>0.0878811061129038, "maxcpu"=>16, "id"=>"node/my_node", "status"=>"online", "type"=>"node", "level"=>"", "maxmem"=>84452896768, "disk"=>4445147136, "uptime"=>27682668, "maxdisk"=>38836535296, "ssl_fingerprint"=>"0E:C1:C1:ED:54:33:CD:8D:D0:31:FF:42:DF:21:8A:4D:9E:CB:1D:22:FE:CD:4C:E9:F7:77:0B:EB:60:5E:A5:83"})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment