Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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

Summary: can't use --image option to create a new host in VMware
Product: Red Hat Satellite Reporter: matt jia <mjia>
Component: HammerAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3.1CC: akarsale, apatel, dhlavacd, kgaikwad, mhulan, rabajaj, tstrachota
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-24 05:48:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.