Bug 1261653

Summary: Deployment with a space in the name fails during RHEV deployment
Product: Red Hat Quickstart Cloud Installer Reporter: Matt Reid <mreid>
Component: Installation - RHEVAssignee: Erik Nelson <ernelson>
Status: CLOSED CURRENTRELEASE QA Contact: Dave Johnson <dajohnso>
Severity: unspecified Docs Contact: Dan Macpherson <dmacpher>
Priority: unspecified    
Version: 1.0CC: apagac, arubin, bthurber, ernelson, jesusr, jmatthew, jmontleo, nperic
Target Milestone: TP2Keywords: Triaged
Target Release: 1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-03 18:59:45 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:
Bug Depends On:    
Bug Blocks: 1278053, 1291836    

Description Matt Reid 2015-09-09 21:01:13 UTC
Description of problem:
If you name a deployment something that includes a space (not sure if this also applies to special characters as well, it could), when it comes time during RHEV deployment and configuration, the template import will fail, since it names the template after the deployment, but doesn't replace the spaces, and doesn't wrap the name in quotes.

Error Unable to import template: Status: 1. Output: ["'NoneType' object has no attribute 'import_template'\n", "Error importing template 'another' to export domain 'my_export'\n"]

[E] Error running command: /usr/share/fusor_ovirt/bin/ovirt_import_template.py --api_user [redacted] --api_pass [redacted] --api_host [redacted] --cluster_name Default --data_center_name Default --export_domain_name my_export --storage_domain_name my_storage --vm_template_name another space name-cfme-template

Seems like need to be creating the equivalent of a deployment label behind the scenes, similar to how we sanitize organization and environment path names that contain spaces and special characters, and replace them with underscores. That way we don't end up trying to feed a cli command an input with spaces that will break. Not sure if we could get away with wrapping the --vm_template_name input in quotes.

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

Actual results:
UI accepts a deployment name with a space, which later breaks the deployment process

Expected results:
User should be able to name the deployment what they want, and have it format the name however it needs to on the backend for it to work properly

Additional info:

Comment 1 John Matthews 2015-09-10 14:23:36 UTC
Plan is to update fusor_server so when it calls out to external scripts it quotes the parameters correctly to handle spaces

Comment 2 Matt Reid 2015-09-16 17:42:23 UTC
An exclamation point in the name was fine, but a single quote forced a failed deployment as well.

Comment 3 Antonin Pagac 2015-11-11 19:12:05 UTC
I saw a similar error due to a '+' in the deployment name. My one was:

ovirtsdk.infrastructure.errors.RequestError:
status: 400
reason: Bad Request
detail: Can not add VM. The given name contains special characters. Only lower-case and upper-case letters, numbers, '_', '-', '.' are allowed.

[E] Error running command: /usr/share/fusor_ovirt/bin/ovirt_create_vm_from_template.py --api_host <retracted> --api_pass <retracted> --vm_template_name apagac-rhevm+cfme4-cfme-template --cluster_name Default --vm_name apagac-rhevm+cfme4-cfme

I named the deployment: apagac-rhevm+cfme4

Comment 4 Jason Montleon 2015-12-02 16:38:51 UTC
I'd suggest, since special characters seem to be causing problems in numerous areas that we limit deployment names to a-z A-Z 0-9 _ -

Is there a downside to limiting the deployment name to these characters?

Comment 5 Matt Reid 2015-12-07 16:38:02 UTC
I would prefer to see us accept spaces in deployment names, and swap them out for underscores on the backend (or however we can handle it). As far as I know, that's what Satellite does for most of its underlying parts. If I create an org in Satellite, I can use a name of "My Org" and it will assign it a label of "My_Org". It's a lot more natural to use a space for a name. 

Special characters would be nice, if they want to use + or & or something (like the above comment), but probably not as critical.

Comment 7 Erik Nelson 2016-01-13 18:29:53 UTC
Temporarily patching to disallow spaces.

Comment 8 Erik Nelson 2016-01-13 21:46:25 UTC
PR621: https://github.com/fusor/fusor/pull/621

Comment 9 Antonin Pagac 2016-01-26 09:43:51 UTC
I can't create deployment with space in the name. Other characters to consider are beyond the scope of this bug, so marking as verified.

RHCI-6.0-RHEL-7-20160122.t.1-RHCI-x86_64-dvd1.iso