Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Vm#set_description error #922

Merged
merged 1 commit into from
Sep 30, 2024
Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Sep 30, 2024

It appears at some point we assumed that all methods that end up calling run_command_via_parent assume the argument is a hash and not a simple string.

>> 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...

```
>> 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...
```
@agrare
Copy link
Member Author

agrare commented Sep 30, 2024

Ran a live test against a vSphere system,

> vm.description
=> nil
> vm.set_description("new description test")
> vm.ext_management_system.refresh
> vm.reload.description
=> "new description test"

@Fryguy Fryguy merged commit b070f71 into ManageIQ:master Sep 30, 2024
4 checks passed
@agrare agrare deleted the fix_vm_set_description branch September 30, 2024 17:13
@Fryguy
Copy link
Member

Fryguy commented Oct 8, 2024

Backported to radjabov in commit 1f1ec1e.

commit 1f1ec1e3cb5d1dc230eb4a575d36e9b20e630724
Author: Jason Frey <fryguy9@gmail.com>
Date:   Mon Sep 30 13:05:12 2024 -0400

    Merge pull request #922 from agrare/fix_vm_set_description
    
    Fix Vm#set_description error
    
    (cherry picked from commit b070f714d1bb4d887479b0de120ca6d1d87d2d48)

Fryguy added a commit that referenced this pull request Oct 8, 2024
Fix Vm#set_description error

(cherry picked from commit b070f71)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants