Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1188435 - Editing host or computer profile associated with VmWare resource fails with undefined method
Editing host or computer profile associated with VmWare resource fails with u...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Provisioning (Show other bugs)
6.0.7
All Linux
high Severity high (vote)
: Unspecified
: Unused
Assigned To: Shlomi Zadok
Tazim Kolhar
http://projects.theforeman.org/issues...
: Triaged
: 1196357 (view as bug list)
Depends On:
Blocks: 1212577
  Show dependency treegraph
 
Reported: 2015-02-02 16:50 EST by Chris Roberts
Modified: 2017-02-23 15:35 EST (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1212577 (view as bug list)
Environment:
Last Closed: 2015-08-12 09:58:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
compute resource (47.74 KB, image/png)
2015-04-30 05:32 EDT, Tazim Kolhar
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1361043 None None None Never

  None (edit)
Description Chris Roberts 2015-02-02 16:50:10 EST
Description of problem:
Creating a Compute Resource works and control of existing VM's is working, when trying to add a compute profile we get an error.

Version-Release number of selected component (if applicable):
Installed Packages

    candlepin-0.9.23.1-1.el6.noarch
    candlepin-common-1.0.1-1.el6_5.noarch
    candlepin-scl-1-5.el6_4.noarch
    candlepin-scl-quartz-2.1.5-5.el6_4.noarch
    candlepin-scl-rhino-1.7R3-1.el6_4.noarch
    candlepin-scl-runtime-1-5.el6_4.noarch
    candlepin-selinux-0.9.23.1-1.el6.noarch
    candlepin-tomcat6-0.9.23.1-1.el6.noarch
    elasticsearch-0.90.10-6.el6sat.noarch
    katello-1.5.0-30.el6sat.noarch
    katello-certs-tools-1.5.6-1.el6sat.noarch
    katello-default-ca-1.0-1.noarch
    katello-installer-0.0.67-1.el6sat.noarch
    katello-server-ca-1.0-1.noarch
    katello.croberts.org-apache-1.0-1.noarch
    katello.croberts.org-foreman-client-1.0-1.noarch
    katello.croberts.org-foreman-proxy-1.0-1.noarch
    katello.croberts.org-parent-cert-1.0-1.noarch
    katello.croberts.org-puppet-client-1.0-1.noarch
    katello.croberts.org-qpid-broker-1.0-1.noarch
    katello.croberts.org-qpid-client-cert-1.0-1.noarch
    mod_wsgi-3.4-1.pulp.el6sat.x86_64
    pulp-katello-0.3-4.el6sat.noarch
    pulp-nodes-common-2.4.4-1.el6sat.noarch
    pulp-nodes-parent-2.4.4-1.el6sat.noarch
    pulp-puppet-plugins-2.4.4-1.el6sat.noarch
    pulp-puppet-tools-2.4.4-1.el6sat.noarch
    pulp-rpm-plugins-2.4.4-1.1.el6sat.noarch
    pulp-selinux-2.4.4-1.el6sat.noarch
    pulp-server-2.4.4-1.el6sat.noarch
    python-gofer-qpid-1.3.0-1.el6sat.noarch
    python-isodate-0.5.0-1.pulp.el6sat.noarch
    python-kombu-3.0.15-12.pulp.el6sat.noarch
    python-pulp-bindings-2.4.4-1.el6sat.noarch
    python-pulp-common-2.4.4-1.el6sat.noarch
    python-pulp-puppet-common-2.4.4-1.el6sat.noarch
    python-pulp-rpm-common-2.4.4-1.1.el6sat.noarch
    python-qpid-0.22-14.el6sat.noarch
    python-qpid-qmf-0.22-37.el6.x86_64
    qpid-cpp-client-0.22-42.el6.x86_64
    qpid-cpp-server-0.22-42.el6.x86_64
    qpid-cpp-server-linearstore-0.22-42.el6.x86_64
    qpid-java-client-0.22-6.el6.noarch
    qpid-java-common-0.22-6.el6.noarch
    qpid-proton-c-0.7-1.el6.x86_64
    qpid-qmf-0.22-37.el6.x86_64
    qpid-tools-0.22-12.el6.noarch
    ruby193-rubygem-katello-1.5.0-93.el6sat.noarch
    rubygem-hammer_cli_katello-0.0.4-14.el6sat.noarch
    rubygem-smart_proxy_pulp-1.0.1-1.1.el6sat.noarch

How reproducible:

Steps to reproduce: 
*Infrastructure > compute profiles
*Create a new compute profile
*Select the compute resource
*Get an undefinded method error:

Actual results:


NoMethodError
undefined method `[]' for nil:NilClass
app/helpers/layout_helper.rb:119:in `block in selectable_f'
app/helpers/layout_helper.rb:160:in `block (3 levels) in field'
app/helpers/layout_helper.rb:159:in `block (2 levels) in field'
app/helpers/layout_helper.rb:150:in `block in field'
app/helpers/layout_helper.rb:149:in `field'
app/helpers/layout_helper.rb:117:in `selectable_f'
app/views/compute_resources_vms/form/_vmware.html.erb:6:in `_app_views_compute_resources_vms_form__vmware_html_erb__1234955438304079943_85954960'
app/views/compute_attributes/_form.html.erb:10:in `block (2 levels) in _app_views_compute_attributes__form_html_erb__2956532270157352589_118689300'
app/views/compute_attributes/_form.html.erb:8:in `block in _app_views_compute_attributes__form_html_erb__2956532270157352589_118689300'
app/helpers/layout_helper.rb:251:in `form_for'
app/views/compute_attributes/_form.html.erb:2:in `_app_views_compute_attributes__form_html_erb__2956532270157352589_118689300'
app/views/compute_attributes/new.html.erb:3:in `_app_views_compute_attributes_new_html_erb__4379414151464736042_111683820'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

Expected results:
To be able to provision vm's or add compute resources. I tested this internally with VMWare 5.1 and it worked fine for our Pune Lab. I checked on Mojo and I do not see anything higher than 5.1

Additional info:

VM Ware 5.5
Comment 1 RHEL Product and Program Management 2015-02-02 17:03:16 EST
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.
Comment 5 Andrew Schofield 2015-03-02 13:51:53 EST
Specifically : VMware ESXi, 5.5.0, 1892794

Works with our 4.x environment : ESXi, 4.1.0, 1363503
Comment 6 Bryan Kearney 2015-03-03 08:51:31 EST
Created redmine issue http://projects.theforeman.org/issues/9617 from this bug
Comment 9 Lukas Zapletal 2015-03-17 13:05:49 EDT
Related bug: https://bugzilla.redhat.com/show_bug.cgi?id=1196357
Comment 10 Bryan Kearney 2015-03-17 14:04:33 EDT
Upstream bug assigned to szadok@redhat.com
Comment 11 Bryan Kearney 2015-03-18 06:04:48 EDT
Upstream bug assigned to lzap@redhat.com
Comment 12 Lukas Zapletal 2015-03-18 12:37:24 EDT
Quick update - I am reproducing this BZ.
Comment 14 Lukas Zapletal 2015-03-20 11:17:40 EDT
Associating case from https://bugzilla.redhat.com/show_bug.cgi?id=1196357
Comment 15 Lukas Zapletal 2015-03-20 11:19:46 EDT
*** Bug 1196357 has been marked as a duplicate of this bug. ***
Comment 18 Lukas Zapletal 2015-03-20 11:53:00 EDT
I am currently facing different issue in our 6.0.z composes which blocks me from fixing this one. Working on a local workaround: https://bugzilla.redhat.com/show_bug.cgi?id=1170276
Comment 19 Lukas Zapletal 2015-03-20 12:03:12 EDT
Hello,

it looks like VmWare resource is returning nil when we query for list of datacenters. Due to bug in our code, we fail instead of rendering an empty field in the form.

Here is a hotfix you can provide. It is for this file:

/usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb 

diff --git a/app/models/compute_resources/foreman/model/vmware.rb b/app/models/compute_resources/foreman/model/vmware.rb
index ad3c268..365929d 100644
--- a/app/models/compute_resources/foreman/model/vmware.rb
+++ b/app/models/compute_resources/foreman/model/vmware.rb
@@ -44,7 +44,7 @@ module Foreman::Model
     end

     def clusters
-      dc.clusters
+      dc.clusters rescue []
     end

After this change, Satellite 6 UI must be restarted:

# service httpd restart

But this is just a cosmetic fix that will prevent Satellite 6 from failing. If you see this bug, then the vmware/fog does not see any datacenters. Please work with customers in identifing why the list of datacenters is empty (permission issue?)

Assigning back to Shlomi as he worked on this area already. Shlomi, there is a different issue (https://bugzilla.redhat.com/show_bug.cgi?id=1170276#c10) with this particular line. Also, you need to find why fog is returning nil instead of empty array. Maybe we can impelemt similar workaround above in our codebase (but  logging the exception rather than throwing it out). But it would be better to find real cause and fix it either in fog or foreman.
Comment 20 Bryan Kearney 2015-03-20 12:04:34 EDT
Upstream bug assigned to szadok@redhat.com
Comment 26 Tazim Kolhar 2015-04-30 05:31:58 EDT
VERIFIED:

# rpm -qa | grep foreman
ruby193-rubygem-foreman_docker-1.2.0.10-1.el6_6sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el6_6sat.noarch
foreman-debug-1.7.2.18-1.el6_6sat.noarch
foreman-vmware-1.7.2.18-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.6-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.8-1.el6_6sat.noarch
puppet-foreman_scap_client-0.3.3-8.el6_6sat.noarch
foreman-1.7.2.18-1.el6_6sat.noarch
foreman-libvirt-1.7.2.18-1.el6_6sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el6_6sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.12-1.el6_6sat.noarch
rubygem-hammer_cli_foreman-0.1.4.10-1.el6_6sat.noarch
foreman-postgresql-1.7.2.18-1.el6_6sat.noarch
foreman-selinux-1.7.2.13-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-1.0-2.noarch
foreman-compute-1.7.2.18-1.el6_6sat.noarch
foreman-gce-1.7.2.18-1.el6_6sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.12-1.el6_6sat.noarch
foreman-proxy-1.7.2.4-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-client-1.0-1.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-client-1.0-1.noarch
foreman-ovirt-1.7.2.18-1.el6_6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.1.0-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.4-1.el6_6sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.4-1.el6_6sat.noarch

steps:
*Infrastructure > compute profiles
*Create a new compute profile
*Select the compute resource
*Able to select the compute resource

screen shot attached
Comment 27 Tazim Kolhar 2015-04-30 05:32:53 EDT
Created attachment 1020481 [details]
compute resource
Comment 28 Johan Swensson 2015-05-11 09:46:56 EDT
(In reply to Tazim Kolhar from comment #27)
> Created attachment 1020481 [details]
> compute resource

That seems to be a libvirt compute resource, this needs to be tested on a vmware compute resource as this is mainly a vmware issue unless I'm missing something.
Comment 30 Bryan Kearney 2015-08-11 09:33:09 EDT
This bug is slated to be released with Satellite 6.1.
Comment 31 Bryan Kearney 2015-08-12 09:58:37 EDT
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.

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