Project

General

Profile

Actions

Refactor #24852

closed

Having empty "Allocation (GB)" when creating a new Host, nil:NilClass returned on creating the Host

Added by Ivan Necas over 5 years ago. Updated about 2 months ago.

Status:
Closed
Priority:
Immediate
Category:
Host creation
Target version:
-
Difficulty:
medium
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1625258

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.

How reproducible:
100%

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

Additionally, we could default to size value value in the UI, so that people don't run into the empty value issue that likely + it would provide a good example of what values are expected.

Additional info:
backtrace:
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 = matcher1
120 unit = matcher2
121 end
122 [size, unit]
123 end

that simply does not count with empty value in text

Actions #1

Updated by Aditi Puntambekar over 5 years ago

  • Subject changed from Having empty "Allocation (GB)" when creating a new Host, nil:NilClass returned on creating the Host to Having empty "Allocation (GB)" when creating a new Host, nil:NilClass returned on creating the Host
  • Assignee set to Aditi Puntambekar
Actions #2

Updated by Aditi Puntambekar over 5 years ago

Hello,
I was able to reproduce this on libvirt compute resource, but is this also an issue for other compute resources ?

Actions #3

Updated by Ivan Necas over 5 years ago

As the report says: the source of the issue seems to be in fog-libvirt, so I don't expect other compute resources being affected by this

Actions #4

Updated by The Foreman Bot over 5 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6300 added
Actions #5

Updated by The Foreman Bot over 4 years ago

  • Fixed in Releases 2.0.0 added
Actions #6

Updated by Aditi Puntambekar over 4 years ago

  • Status changed from Ready For Testing to Closed
Actions #7

Updated by HaroldLapse HaroldLapse about 2 months ago

  • Tracker changed from Bug to Refactor
  • Category changed from Compute resources - libvirt to Host creation
  • Assignee changed from Aditi Puntambekar to Griffin Sullivan
  • Priority changed from Normal to Immediate
  • Difficulty set to medium
  • Triaged changed from No to Yes
  • Found in Releases 0.1 added

После долгих поисков я наконец-то нашел идеальное место для своего сайта! Виртуальный хостинг, который предоставляет надежность, скорость и доступные цены. Мой сайт теперь работает стабильно, а поддержка клиентов всегда на связи, готовая помочь в любой ситуации. Очень доволен своим выбором и настоятельно рекомендую этот хостинг всем, кто ищет качество без высокой цены! - Рекомедую хостинг от компании [url=https://hidehost.net/]Hidehost.net[/url].Успешно рабоает с 2012 года - Виртуальные сервера от 5.2$/месяц ([url=https://billing.hidehost.net/pl.php?832]https://billing.hidehost.net/pl.php?832[/url])

Actions

Also available in: Atom PDF