class HammerCLIForeman::ComputeAttribute::RemoveInterface
Using the Update command because removing an interface is done by modifying existing compute_attribute
Public Instance Methods
request_params()
click to toggle source
# File lib/hammer_cli_foreman/compute_attribute.rb, line 198 def request_params params = HammerCLIForeman::ComputeAttribute.get_params(options) raise ArgumentError, "Compute profile value to update does not exist yet; it needs to be created first" if !params['compute_attribute'].key?('id') compute_resource_name = HammerCLIForeman.record_to_common_format(HammerCLIForeman.foreman_resource(:compute_resources).call(:show, 'id' => options["option_compute_resource_id"] ))["provider_friendly_name"].downcase interfaces_attr_name = ::HammerCLIForeman.compute_resources[compute_resource_name].interfaces_attrs_name params['id'] = params['compute_attribute']['id'] if params['compute_attribute']['vm_attrs'][interfaces_attr_name].has_key?(option_interface_id.to_s) params['compute_attribute']['vm_attrs'][interfaces_attr_name].delete(option_interface_id.to_s) else signal_usage_error _('unknown interface id') end params end
validate_options()
click to toggle source
Calls superclass method
# File lib/hammer_cli_foreman/compute_attribute.rb, line 192 def validate_options super validator.any(:option_compute_profile_id, :option_compute_profile_name).required validator.any(:option_compute_resource_id, :option_compute_resource_name).required end