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 1571040 - can't use --image option to create a new host in VMware
Summary: can't use --image option to create a new host in VMware
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.3.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-24 02:05 UTC by matt jia
Modified: 2018-04-24 05:48 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-24 05:48:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description matt jia 2018-04-24 02:05:07 UTC
Description of problem:

To create a new host in VMware with a hammer command like this

hammer -d  host create \
  --name "lonlxt90014" \
  --organization "XXX" \
  --location "rnd" \
  --hostgroup-id 22 \
  --content-source-id 1 \
  --compute-resource-id 3 \
  --provision-method image \
  --image "RHEL7.4-16042018" \
  --ip xx.xx.xx.xx \
  --subnet-id 1 \
  --managed true \
  --interface="compute_type=VirtualVmxnet3, \
               compute_network=network-44"  \
  --compute-attributes="cpus=1, \
                        corespersocket=2, \
                        memory_mb=2048,
                        cluster='Woking RND', \
                        path='/Datacenters/Woking RND/vm/Discovered virtual machine',guest_id=rhel6_64Guest,hardware_version=vmx-08" \
  --volume="size_gb=60, \
            datastore=ESX_DataStore_ISO, \
            name='Hard disk 1', \
            thin=true, eager_zero=false,mode=persistent"

failed with the below error


2018-04-20 07:26:04 f633416b [app] [W] Failed to create a compute example.localhost.nom (VMware) instance example.localhost.com: undefined method `include?' for nil:NilClass
 |
 | NoMethodError: undefined method `include?' for nil:NilClass
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-1.7.0/lib/fog/vsphere/requests/compute/get_virtual_machine.rb:40:in `get_vm_by_name'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-1.7.0/lib/fog/vsphere/requests/compute/get_virtual_machine.rb:23:in `get_vm_ref'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-1.7.0/lib/fog/vsphere/requests/compute/get_virtual_machine.rb:7:in `get_virtual_machine'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-1.7.0/lib/fog/vsphere/requests/compute/vm_clone.rb:22:in `vm_clone_check_options'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-vsphere-1.7.0/lib/fog/vsphere/requests/compute/vm_clone.rb:96:in `vm_clone'
 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:476:in `clone_vm'
 | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:410:in `create_vm'
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:77:in `setCompute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:216:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:144:in `block in process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:136:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:136:in `process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:44:in `around_save_orchestration'



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

6.3


How reproducible:

Easy


Steps to Reproduce:

use the command above to create a new host in VMware

Actual results:

Failed to create a compute example.localhost.nom (VMware) instance example.localhost.com: undefined method `include?' for nil:NilClass


Expected results:

should be able to use --image to create a new host


Additional info:

I'm aware that using --image_id can solve this problem. Maybe this is the way that we are encouraging people to use, but I don't see any reason why we shouldn't support using --image.
If there is a reasonable reason, at least we should give a clear error message instead of 'undefined method `include?' for nil:NilClass'.

Comment 2 matt jia 2018-04-24 05:41:31 UTC
It turns out that I've misread the code. I'll file a new bug against this issue.


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