Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1765132 - convert_string_to_bool doesn't deal with array type
Summary: convert_string_to_bool doesn't deal with array type
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Compute Resources - RHEV
Version: 6.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.7.0
Assignee: Shira Maximov
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-10-24 12:24 UTC by Shira Maximov
Modified: 2023-03-24 15:46 UTC (History)
8 users (show)

Fixed In Version: tfm-rubygem-fog-ovirt-1.2.3,foreman-1.24.1.9-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1814425 (view as bug list)
Environment:
Last Closed: 2020-04-14 13:39:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
foreman-tail (2.92 KB, text/plain)
2020-03-12 13:43 UTC, Lukáš Hellebrandt
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 28121 0 Normal Closed convert_string_to_bool doesn't deal with array type 2020-12-28 13:27:53 UTC
Red Hat Knowledge Base (Solution) 5203731 0 None None None 2020-07-05 07:27:10 UTC

Description Shira Maximov 2019-10-24 12:24:36 UTC
There is still another bug in the convert_string_to_bool 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: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: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:in `map'
/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:in `block 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:in `convert_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:in `save'
/usr/share/foreman/app/models/compute_resources/foreman/model/ovirt.rb:242:in `start_vm'

Comment 1 Shira Maximov 2019-10-24 12:24:40 UTC
Created from redmine issue https://projects.theforeman.org/issues/28121

Comment 5 Bryan Kearney 2019-10-24 14:05:23 UTC
Upstream bug assigned to mshira

Comment 7 Shira Maximov 2019-10-27 07:49:47 UTC
Adding steps to reproduce:

running this following command ( use arrays inside volume,  please notice this is not how we usually send our parameters, this is not a vaild input normally) 
 hammer host create --hostgroup ovirt --location tlv --organization redhat --name deleteme1 --ip 192.168.122.78 --volume "capacity=[],wipe_after_delete=[bla]"

Comment 9 Shira Maximov 2019-10-28 13:53:39 UTC
I'm adding a comment for the steps to reproduce: the hostgroup should relay on an existing hostgroup of ovirt compute resource.

Comment 10 Bryan Kearney 2019-12-03 17:06:35 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28121 has been resolved.

Comment 19 Lukáš Hellebrandt 2020-03-12 13:41:38 UTC
FailedQA with Sat 6.7 snap 15.

These look OK:
# hammer host create --hostgroup testgrp --location-id 2 --organization-id 1 --name lhellebr-delme-convert --ip 192.168.122.78 --volume "capacity=[],wipe_after_delete=[bla],storage_domain=<UUID>"
Host created.
# hammer host create --hostgroup testgrp --location-id 2 --organization-id 1 --name lhellebr-delme-convert5 --ip 192.168.122.81 --volume "size_gb=20,wipe_after_delete=1,storage_domain=c4fc24ba-651a-4db6-a137-c5ad8a4a921f"

Also tested if it's possible to create a host through WebUI. It is.


However, notice that "capacity" parameter used in the first command and in reproducer in comment 7 is incorrect - it should be "size_gb". When entering an array to "size_gb", I get an error:
# hammer host create --hostgroup testgrp --location-id 2 --organization-id 1 --name lhellebr-delme-convert10 --ip 192.168.122.86 --volume "size_gb=[20],wipe_after_delete=[bla],storage_domain=<UUID>"
Could not create the host:
  Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.

Traceback not useful but attached.

Comment 20 Lukáš Hellebrandt 2020-03-12 13:43:11 UTC
Created attachment 1669656 [details]
foreman-tail

Comment 21 Shira Maximov 2020-03-12 14:18:15 UTC
Hi Lukas, as I wrote in #comment 7, please notice this is not how we usually send our parameters, this is not a valid input normally
 
this BZ only applies to the error: NoMethodError: undefined method `each' for #<Fog::Ovirt::Compute::Interface:0x007f0b76120628>
and I gave an easy resporducer for it: hammer host create --hostgroup testgrp --location-id 2 --organization-id 1 --name lhellebr-delme-convert --ip 192.168.122.78 --volume "capacity=[],wipe_after_delete=[bla],storage_domain=<UUID>" 
but it's not a valid command !!!
 
so, if this command is working properly (even though it's not valid)  please verify this BZ.
If you want, you can open a new BZ, but it would probably won't get accepted because this is not a valid input.

Comment 22 Mike McCune 2020-03-12 18:57:31 UTC
moving back ON_QA for verification based on Shira's comments. If this is inaccurate and we need to keep this bug ASSIGNED, let us know but it does sound like we can file a more minor bug based on the comments above.

Comment 23 Lukáš Hellebrandt 2020-03-13 10:23:06 UTC
This bugzilla is about Satellite incorrectly handling array type input where such an input is, itself, incorrect. Examples of such inputs are Shira's comment 7 or my comment 19. Both of those commands are invalid. In case of comment 7, the bug is fixed. In case of comment 19, the bug manifests by a different error message (ISE 500 which is definitely correct behavior). That's not a "fix" I'm willing to verify. I also don't think this should be a blocker.

This probably happened because "capacity" is not a correct parameter name so its value was ignored - however, correct parameter name "size_gb" causes the bug to manifest. Maybe Shira forgot about fixing this one since she incorrectly used "capacity".

Comment 24 Lukáš Hellebrandt 2020-03-13 10:25:21 UTC
s/definitely correct/definitely incorrect/

Comment 25 Shira Maximov 2020-03-16 07:30:40 UTC
I understand the confusion, 
Please understand, we first found the issue in the UI (not in hammer), and in order to help you and others to review the fix, I created a hammer command reproducer.
this hammer command will only be relevant in case we are not entering "size_gb", the reason is the when you enter size_gb it automatically will try to convert the input into int, and if the input is [], then it won't work:
https://github.com/fog/fog-ovirt/blob/b676d73c1fce11c67a8dce46f9b5092073bf0dff/lib/fog/ovirt/requests/compute/v4/add_volume.rb 


that's why I requested to test it with capacity, (you can also test it with other staff, as long is it not on ovirt valid properties)


also, this BZ was opened for a specific error message, that error message is not reproducible and you are getting a different one which should probably have it's own BZ.

Comment 26 Shira Maximov 2020-03-16 14:03:12 UTC
I and Lukas talked and we agreed that he will verify this BZ and open a different issue. thanks.

Comment 27 Lukáš Hellebrandt 2020-03-16 14:11:48 UTC
Since Shira is both reporter and assignee of this BZ and she considers my reproducer to be out of scope of this BZ, I'm verifying this (Shira's reproducer doesn't manifest the bug, my reproducer shows different error message). I will report another BZ because ISE is not a correct way to handle incorrect user input.

Comment 28 Bryan Kearney 2020-04-14 13:39:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1454


Note You need to log in before you can comment on or make changes to this bug.