Skip to content

Commit

Permalink
Fix Vm#set_description error
Browse files Browse the repository at this point in the history
```
>> vm.set_description("new-description")
app/models/vm_or_template.rb:380:in `merge': no implicit conversion of String into Hash (TypeError)

    options = {:user_event => "Console Request Action [#{verb}], VM [#{name}]"}.merge(options)
                                                                                      ^^^^^^^
	from app/models/vm_or_template.rb:380:in `run_command_via_parent'
	from /home/grare/adam/src/manageiq/manageiq-providers-vmware/app/models/manageiq/providers/vmware/infra_manager/vm_or_template_shared/operations.rb:43:in `raw_set_description'
	from app/models/vm_or_template/operations.rb:95:in `set_description'
	from (irb):12:in `<main>'
	from <internal:kernel>:187:in `loop'
	from railties (7.0.8.4) lib/rails/commands/console/console_command.rb:74:in `start'
	from railties (7.0.8.4) lib/rails/commands/console/console_command.rb:19:in `start'
	from railties (7.0.8.4) lib/rails/commands/console/console_command.rb:106:in `perform'
	from thor (1.3.2) lib/thor/command.rb:28:in `run'
	from thor (1.3.2) lib/thor/invocation.rb:127:in `invoke_command'
	from thor (1.3.2) lib/thor.rb:538:in `dispatch'
	from railties (7.0.8.4) lib/rails/command/base.rb:87:in `perform'
	from railties (7.0.8.4) lib/rails/command.rb:48:in `invoke'
	from railties (7.0.8.4) lib/rails/commands.rb:18:in `<main>'
	from /usr/lib/ruby/3.3.0/bundled_gems.rb:75:in `require'
	from /usr/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require'
	... 2 levels...
```
  • Loading branch information
agrare committed Sep 30, 2024
1 parent 8dbccde commit 6cc6801
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/manageiq/providers/vmware/infra_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,9 @@ def vm_quick_stats(obj, options = {})
end
alias_method :host_quick_stats, :vm_quick_stats

def vm_set_description(vm, new_description, options = {})
def vm_set_description(vm, options = {})
options[:spec] = VimHash.new("VirtualMachineConfigSpec") do |spec|
spec.annotation = new_description
spec.annotation = options.delete(:new_description)
end

vm_reconfigure(vm, options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def raw_rename(new_name)
end

def raw_set_description(new_description)
run_command_via_parent(:vm_set_description, new_description)
run_command_via_parent(:vm_set_description, :new_description => new_description)
end

def log_user_event(event_message)
Expand Down

0 comments on commit 6cc6801

Please sign in to comment.