Bug 1625258 - Having empty "Allocation (GB)" when creating a new Host, nil:NilClass returned on creating the Host
Summary: Having empty "Allocation (GB)" when creating a new Host, nil:NilClass returne...
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Compute Resources - libvirt
Version: 6.3.3
Hardware: x86_64
OS: Linux
Target Milestone: 6.8.0
Assignee: Aditi Puntambekar
QA Contact: Radek Mynar
Depends On:
TreeView+ depends on / blocked
Reported: 2018-09-04 13:41 UTC by Pavel Moravec
Modified: 2020-11-20 17:29 UTC (History)
7 users (show)

Fixed In Version: foreman-2.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-10-27 12:57:59 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 24852 0 Normal Closed Having empty "Allocation (GB)" when creating a new Host, nil:NilClass returned on creating the Host 2020-11-20 16:17:37 UTC
Red Hat Product Errata RHSA-2020:4366 0 None None None 2020-10-27 12:58:18 UTC

Description Pavel Moravec 2018-09-04 13:41:06 UTC
Description of problem:
When creating a new Host and specifying on Virtual Machine tab "Allocation(GB)" as empty, Host create fails with

NoMethodError: undefined method `[]' for nil:NilClass

error. It is more user-unfriendly also due to the fact that the Allocation(GB) is purged when one clicks to "Size" button right from the value.

Version-Release number of selected component (if applicable):
Sat 6.3.3
Sat 6.4 beta (checked it's also there)

How reproducible:

Steps to Reproduce:
1. Start creating a new Host
2. In Virtual Machine tab, click to "Size" button (or leave "Allocation(GB)" empty either way)
3. Fill all other parameters properly.
4. Submit the Host

Actual results:
Host create fails with "undefined method `[]' for nil:NilClass"

Expected results:
Either no error (if the parameter can have empty value with some meaning), or provide some meaningfull error message before tryng to create the host (e.g. similar to leaving root password empty).

Additional info:
2018-09-04 15:20:37 18507e4a [app] [W] Failed to create a compute satotest (Libvirt) instance pmoravec-test.sysmgmt.lan: undefined method `[]' for nil:NilClass

 NoMethodError: undefined method `[]' for nil:NilClass
 /opt/theforeman/tfm/root/usr/share/gems/gems/fog-libvirt-0.2.0/lib/fog/libvirt/models/compute/volume.rb:119:in `split_size_unit'
 (erb):3:in `to_xml'

Relevant code:

112         def split_size_unit(text)
113           if text.kind_of? Integer
114             # if text is an integer, match will fail
115             size    = text
116             unit    = 'G'
117           else
118             matcher = text.match(/(\d+)(.+)/)
119             size    = matcher[1]
120             unit    = matcher[2]
121           end
122           [size, unit]
123         end

that simply does not count with empty value in text

Comment 2 Ivan Necas 2018-09-07 16:18:19 UTC
Created redmine issue https://projects.theforeman.org/issues/24852 from this bug

Comment 3 Bryan Kearney 2019-11-14 13:03:19 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/24852 has been resolved.

Comment 4 Radek Mynar 2020-06-26 16:59:30 UTC
VERIFIED with Satellite 6.8 SNAP 5.0

I followed steps from initial comment and I also deleted the text field manually as it keeps prefilled "0G" when switching 'None'/'Size' buttons. Host creation continued successfully when value was empty.

Comment 7 errata-xmlrpc 2020-10-27 12:57:59 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 (Important: Satellite 6.8 release), and where to find the updated
files, follow the link below.

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


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