class CollinsShell::Ipmi
Public Class Methods
ipmi_options(required = false)
click to toggle source
# File lib/collins_shell/ipmi.rb, line 16 def self.ipmi_options required = false method_option :ipmi_username, :type => :string, :required => required, :desc => 'IPMI username' method_option :ipmi_password, :type => :string, :required => required, :desc => 'IPMI password' method_option :address, :type => :string, :required => required, :desc => 'IPMI address' method_option :gateway, :type => :string, :required => required, :desc => 'IPMI gateway' method_option :netmask, :type => :string, :required => required, :desc => 'IPMI netmask' end
print_ipmi(ipmi)
click to toggle source
# File lib/collins_shell/ipmi.rb, line 24 def self.print_ipmi ipmi puts("address,gateway,netmask,username,password") puts([ipmi.address,ipmi.gateway,ipmi.netmask,ipmi.username,ipmi.password].join(',')) end
Public Instance Methods
create()
click to toggle source
# File lib/collins_shell/ipmi.rb, line 49 def create call_collins get_collins_client, "create ipmi" do |client| ipmi = client.ipmi_create options.tag, options.ipmi_username, options.ipmi_password, options.address, options.gateway, options.netmask if ipmi then asset = client.get options.tag CollinsShell::Ipmi.print_ipmi asset.ipmi else say_error "create IPMI address" end end end
generate()
click to toggle source
# File lib/collins_shell/ipmi.rb, line 33 def generate call_collins get_collins_client, "generate ipmi" do |client| ipmi = client.ipmi_allocate options.tag, :pool => options.pool if ipmi then asset = client.get options.tag CollinsShell::Ipmi.print_ipmi asset.ipmi else say_error "generate IPMI address" end end end
pools()
click to toggle source
# File lib/collins_shell/ipmi.rb, line 83 def pools call_collins get_collins_client, "ipmi pools" do |client| # NAME, NETWORK, START_ADDRESS, SPECIFIED_GATEWAY, GATEWAY, BROADCAST, POSSIBLE_ADDRESSES header = [["Pool","Network","Gateway","Broadcast","Possible Addresses","Start Address","Specified Gateway"]] rows = client.ipmi_pools.map do |pool| [pool["NAME"], pool["NETWORK"], pool["GATEWAY"], pool["BROADCAST"], pool["POSSIBLE_ADDRESSES"], pool["START_ADDRESS"], pool["SPECIFIED_GATEWAY"]] end print_table header + rows end end
update()
click to toggle source
# File lib/collins_shell/ipmi.rb, line 65 def update call_collins get_collins_client, "update ipmi" do |client| ipmi = client.ipmi_update options.tag, :username => options.ipmi_username, :password => options.ipmi_password, :address => options.address, :gateway => options.gateway, :netmask => options.netmask if ipmi then asset = client.get options.tag CollinsShell::Ipmi.print_ipmi asset.ipmi else say_error "update IPMI address" end end end