class HammerCLIForeman::ComputeAttribute
Public Class Methods
alter_interface(interface)
click to toggle source
# File lib/hammer_cli_foreman/compute_attribute.rb, line 24 def self.alter_interface(interface) # move each attribute starting with "compute_" to compute_attributes interface.keys.each do |key| if key.start_with? 'compute_' interface[key.gsub('compute_', '')] = interface.delete(key) end end interface end
alter_interfaces_list(interfaces_list)
click to toggle source
# File lib/hammer_cli_foreman/compute_attribute.rb, line 34 def self.alter_interfaces_list(interfaces_list) interfaces_list.collect do |nic| alter_interface(nic) end end
attribute_hash(attribute_list)
click to toggle source
# File lib/hammer_cli_foreman/compute_attribute.rb, line 20 def self.attribute_hash(attribute_list) attribute_list.size.times.map { |idx| idx.to_s }.zip(attribute_list).to_h end
get_params(options)
click to toggle source
# File lib/hammer_cli_foreman/compute_attribute.rb, line 9 def self.get_params(options) params = {} params['compute_attribute'] = {} profile = HammerCLIForeman.record_to_common_format( HammerCLIForeman.foreman_resource(:compute_profiles).call(:show, 'id' => options['option_compute_profile_id'] ) ) params['compute_attribute'] = profile['compute_attributes'].select { |hash| hash['compute_resource_id'] == options['option_compute_resource_id']}[0] || {} params['compute_attribute'].delete('attributes') if params['compute_attribute']['attributes'] params end