fog / fog-ovirt

MIT License
11 stars 21 forks source link

Fixes #28121 - Fix convert_string_to_bool to deal with Array #77

Closed shiramax closed 4 years ago

shiramax commented 4 years ago

The PR fixes a bug in the convert_string_to_bool function. ATM the function It doesn't validate the data type of the item in value.map (when it's an array). It caused the same error. It happens when deploying a host to oVirt (from Foreman 1.23):

NoMethodError: undefined method each' for #<Fog::Ovirt::Compute::Interface:0x007f0b76120628> /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-ovirt-1.2.1/lib/fog/ovirt/compute/v4.rb:116:inconvert_string_to_bool' /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-ovirt-1.2.1/lib/fog/ovirt/compute/v4.rb:124:in block (2 levels) in convert_string_to_bool' /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-core-2.1.0/lib/fog/core/collection.rb:18:inmap' /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-core-2.1.0/lib/fog/core/collection.rb:18:in map' /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-ovirt-1.2.1/lib/fog/ovirt/compute/v4.rb:124:inblock in convert_string_to_bool' /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-ovirt-1.2.1/lib/fog/ovirt/compute/v4.rb:116:in each' /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-ovirt-1.2.1/lib/fog/ovirt/compute/v4.rb:116:inconvert_string_to_bool' /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-ovirt-1.2.1/lib/fog/ovirt/requests/compute/v4/update_vm.rb:9:in update_vm' /usr/share/foreman/vendor/ruby/2.3.0/gems/fog-ovirt-1.2.1/lib/fog/ovirt/models/compute/server.rb:177:insave' /usr/share/foreman/app/models/compute_resources/foreman/model/ovirt.rb:242:in `start_vm'

shiramax commented 4 years ago

see issue: https://github.com/fog/fog-ovirt/issues/62

shiramax commented 4 years ago

@orrabin , @ShimShtein please review :)

shiramax commented 4 years ago

thanks @ShimShtein, can you please review again :) ?

ShimShtein commented 4 years ago

merged, Thanks @shiramax!