Bug 1483249

Summary: CLI/API for creating hosts should provide better message when medium is missing
Product: Red Hat Satellite Reporter: Kedar Bidarkar <kbidarka>
Component: Hosts - ContentAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3.0CC: bbuckingham, dhlavacd, inecas, jcallaha, kbidarka, lhellebr, tbrisker, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged, UserExperience
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-09-04 17:47:00 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:
Attachments:
Description Flags
more information related to hostgroup info none

Description Kedar Bidarkar 2017-08-19 16:00:57 UTC
Description of problem:

2017-08-19 11:42:25 1b02167a [app] [I]   Parameters: {"host"=>{"name"=>"rhel-6-libvirt3", "location_id"=>2, "organization_id"=>1, "operatingsystem_id"=>3, "pxe_loader"=>"PXELinux BIOS", "compute_resource_id"=>1, "hostgroup_id"=>1, "build"=>true, "enabled"=>true, "managed"=>true, "compute_attributes"=>{"cpus"=>"1", "memory"=>"1073741824", "start"=>"1", "volumes_attributes"=>{"0"=>{"capacity"=>"10G", "format_type"=>"qcow2"}}}, "content_facet_attributes"=>{}, "subscription_facet_attributes"=>{}, "overwrite"=>true, "host_parameters_attributes"=>[], "interfaces_attributes"=>[{"primary"=>"true", "compute_attributes"=>{"type"=>"bridge", "bridge"=>"katello_latest", "model"=>"virtio"}}], "root_pass"=>"[FILTERED]"}, "apiv"=>"v2"}
2017-08-19 11:42:25 1b02167a [app] [I] Current user: foreman_admin (administrator)
2017-08-19 11:42:25 1b02167a [app] [I] Current user: foreman_admin (administrator)
2017-08-19 11:42:25 1b02167a [app] [I] Current user: admin (administrator)
2017-08-19 11:42:25 1b02167a [app] [I] Authorized user admin(Admin User)
2017-08-19 11:42:25 1b02167a [app] [I] Current user: admin (administrator)
2017-08-19 11:42:28 1b02167a [app] [E] Unprocessable entity Host::Managed (id: new):
 |   Medium can't be blank
 | 
2017-08-19 11:42:28 1b02167a [app] [I]   Rendered api/v2/errors/unprocessable_entity.json.rabl within api/v2/layouts/error_layout (1.4ms)
2017-08-19 11:42:28 1b02167a [app] [I] Completed 422 Unprocessable Entity in 2298ms (Views: 2.4ms | ActiveRecord: 23.8ms)

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

Satellite 6.3.0-snap11.0


How reproducible:


Steps to Reproduce:
1. create hostgroup via hammer cli only ( do not edit hostgroup or create hostgroup via UI , if done not reproducible ever with the host-group)

satellite hostgroup create --name='RHEL 7 Server 64-bit HG' --content-view='RHEL 7 CV' --environment-id="${PUPPET_ENV}" --lifecycle-environment='DEV' --content-source-id="${CAPSULE_ID}" --puppet-proxy="$(hostname)" --puppet-ca-proxy="$(hostname)" --query-organization-id="${ORG}" --puppet-classes='access_insights_client,foreman_scap_client' --domain-id="${DOMAIN_ID}" --subnet="${SUBNET_NAME}" --architecture='x86_64' --operatingsystem-id="${RHEL7_OS_ID}" --partition-table='Kickstart default' --location-ids="${LOC}"

satellite hostgroup set-parameter --hostgroup='RHEL 7 Server 64-bit HG' --name='kt_activation_keys' --value='ak-rhel-7


2. create host via hammer cli

hammer -u admin -p changeme  host create --name='rhel-6-libvirt3' --root-password='changeme' --organization-id="1" --location-id="2" --hostgroup="RHEL 6 Server 64-bit HG" --compute-resource="libvirt" --compute-attributes="cpus=1, memory=1073741824, start=1" --interface="primary=true, compute_type=bridge, compute_bridge=katello_latest, compute_model=virtio" --volume="capacity=10G,format_type=qcow2" --operatingsystem-id 3 --pxe-loader 'PXELinux BIOS' 


Actual results:

Unable to create host,

hammer -u admin -p changeme  host create --name='rhel-7-libvirt1' --root-password='changeme' --organization-id="1" --location-id="2" --hostgroup="RHEL 7 Server 64-bit HG" --compute-resource="libvirt" --compute-attributes="cpus=1, memory=1073741824, start=1" --interface="primary=true, compute_type=bridge, compute_bridge=foreman, compute_model=virtio" --volume="capacity=10G,format_type=qcow2" --operatingsystem-id 3 --pxe-loader 'PXELinux BIOS'
Could not create the host:
  Medium can't be blank

Expected results:

We should be able to create host successfully.


Additional info:

Comment 1 Kedar Bidarkar 2017-08-19 16:01:56 UTC
Created attachment 1315773 [details]
more information related to hostgroup info

Comment 2 Kedar Bidarkar 2017-08-19 16:03:14 UTC
A host-group created via UI would allow the creation of host.

Do not edit hostgroup or create hostgroup via UI , this bug is not reproducible.

Comment 4 Tomas Strachota 2017-08-21 10:39:25 UTC
Kedar,
could you please provide full output of the hammer commands in debug mode for:
1. hostgroup create
2. hostgroup info
3. host create

Also, what exactly is the "satellite" command, please?

Comment 5 Tomas Strachota 2017-08-21 10:58:09 UTC
Btw the hostgroup create is missing --kickstart-repository-id (which is probably autocompleted in the UI when a CV is selected) and therefore satellite tries to use "All Media" which is not assigned either.

Comment 6 Kedar Bidarkar 2017-08-22 16:31:53 UTC
satellite is a function, sorry my bad. 

satellite == 'hammer -u admin -p changeme'

Comment 8 Kedar Bidarkar 2017-08-22 16:40:27 UTC
Host creation worked, if I 

1) first added --kickstart-repository-id to hostgroup using the "hostgroup update"
2) Then creating a host using the updated host-group.


I feel, then this bug should be tracking about letting the end user know , what is missing while creating the Host, as

1) "hostgroup create" does not make providing "--kickstart-repository-id " compulsory.
2) "host create" mentions "medium can't be blank".

So, the end user has no way of knowing what exactly is missing while creating a Host with Host-Group.

Comment 10 Tomas Strachota 2017-08-23 08:00:42 UTC
I agree. I updated the BZ title accordingly.

In the cli I would expect a message like:
"Medium can't be blank. Please provide either --kickstart-repository or --medium."

Comment 11 Lukáš Hellebrandt 2018-05-31 11:51:10 UTC
"Medium can't be blank" error message is also shown when --kickstart-repository is set but there is not set some other required parameter, like --content-source-id. This misleads the user to think they have to specify both --kickstart-repository and --medium.

Comment 12 Bryan Kearney 2018-09-04 17:47:00 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.