Bug 746702

Summary: trim whitespaces in /etc/aeolus-configure/nodes configs
Product: [Retired] CloudForms Cloud Engine Reporter: Dave Johnson <dajohnso>
Component: aeolus-allAssignee: Richard Su <rwsu>
Status: CLOSED CURRENTRELEASE QA Contact: Dave Johnson <dajohnso>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.0.0CC: akarol, dajohnso, deltacloud-maint, dgao, slinaber, ssachdev, whayutin
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-30 17:14:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Dave Johnson 2011-10-17 14:59:48 UTC
Description of problem:
==========================
Using the below config values in the rhevm configuration file causes this error.  Its not immediately clear what the issue is which is an extra whitespace in front of the kvp.  We should be trimming whitespaces.


[root@hp-z600-01 nodes]# aeolus-configure -p rhevm
Launching aeolus configuration recipe...
Could not run: Could not load external node results for hp-z600-01.rhts.eng.bos.redhat.com: syntax error on line 7, col 3: `   rhevm_nfs_server: 10.16.120.18'


# Values below are examples.  (suppose to be 2 whitespaces in front, not three)
   rhevm_nfs_server: 10.16.120.18
   rhevm_nfs_export: /home/dajo/rhevh-export
   rhevm_nfs_mount_point: /mnt/rhevm-nfs
   rhevm_deltacloud_username: admin@internal
   rhevm_deltacloud_password: redhat
   rhevm_deltacloud_provider: https://intel-s3e3342-01.rhts.eng.bos.redhat.com:8443/api

Comment 2 Richard Su 2011-10-19 16:12:27 UTC
Is it possible something else is adding the third space?

By default, there are two spaces between the '#' and parameter name:

#  rhevm_nfs_server: nfs.server.com
#  rhevm_nfs_export: /export/export_domain
#  rhevm_nfs_mount_point: /mnt/rhevm-nfs
#  rhevm_deltacloud_username: username@fqdn
#  rhevm_deltacloud_password: password
#  rhevm_deltacloud_provider: https://rhevm.server.com:8443/api

Comment 3 Dave Johnson 2011-10-20 17:51:09 UTC
I cut and paste from a wiki so sure, it is very possible.

Just trying to eliminate a potential issue to customers who do make mistakes which results in an error that isn't obvious what the resolution is.

Now that I think about, another variant to the one described in the original description is when the <space> after the key_name: is removed during editing, fairly sure that results in another error which isn't obvious to the user as well.

Comment 4 Dave Johnson 2011-12-19 15:36:10 UTC
Just helped someone on the mailing list that ran into this issue.  Its a pretty bad user experience as there is no clear indication as what the issue is.  

Can we revisit this?

Comment 5 Richard Su 2011-12-21 23:21:58 UTC
Added a pre-check step to aeolus-configure and aeolus-cleanup to verify the config files are parseable YAML. 

This change is in configure as commit d3ed726c642f6532c1ea076b951e577eba57eced

Comment 6 Richard Su 2011-12-23 01:26:17 UTC
Available in aeolus-configure-2.5.0-0.20111222093431gitd3ed726

Comment 7 wes hayutin 2012-01-03 17:41:58 UTC
adding ce-sprint-next bugs to ce-sprint

Comment 8 Dave Johnson 2012-01-10 22:13:52 UTC
whitespaces still seem to be a issue


[root@qeblade28 ~]# aeolus-configure -p rhevm
Launching aeolus configuration recipe...
Missing required parameter rhevm_nfs_server in /etc/aeolus-configure/nodes/rhevm_configure at /usr/share/aeolus-configure/modules/aeolus/manifests/profiles/rhevm.pp:25 on node qeblade28.rhq.lab.eng.bos.redhat.com


[root@qeblade28 ~]# rpm -qa aeolus-configure
aeolus-configure-2.5.0-2.el6.noarch


[root@qeblade28 ~]# cat /etc/aeolus-configure/nodes/rhevm_configure
---
parameters:
  enable_https: true
  enable_security: false
  package_provider: rpm
# Uncomment and provide values to match your RHEV environment.
# Values below are examples.
rhevm_nfs_server: nfs.server.com
rhevm_nfs_export: /home/rhevm_export
rhevm_nfs_mount_point: /mnt/rhevm-nfs
rhevm_deltacloud_username: admin@internal
rhevm_deltacloud_password: password
rhevm_deltacloud_provider: https://red.hat.com:8443/api;4c96c74b-f8b6-4c8f-aa84-a55770839b85
classes:
- aeolus::conductor
- aeolus::image-factory
- aeolus::iwhd
- aeolus::deltacloud::core
- aeolus::profiles::rhevm
[root@qeblade28 ~]#

Comment 9 Dave Johnson 2012-01-10 22:17:14 UTC
So with three spaces I did get this which is cool, but no spaces (comment 8) does not get this pretty error message

[root@qeblade28 ~]# aeolus-configure -p rhevm
Launching aeolus configuration recipe...
Error found in /etc/aeolus-configure/nodes/rhevm_configure
Incorrect format found on or before line 8
parameters must be in the form [space][space][parameter name][colon][space][parameter value]
classes must be in the form [dash][space][class name]

Comment 10 Richard Su 2012-01-12 22:46:17 UTC
Patch posted, https://fedorahosted.org/pipermail/aeolus-devel/2012-January/008056.html

Fixed in aeolus-configure commit 8507b704fa3707bcbb787c34c1b60c018ebfa0c8

Available in aeolus-configure-2.6.0-0.20120112133633git8701011.fc15.noarch.rpm

Comment 11 Steve Linabery 2012-01-18 21:07:33 UTC
aeolus-configure-2.5.0-5.el6.src.rpm
be20e0c6eab1a1f75a2b390252a0dcfc0db098ff

Comment 12 Shveta 2012-01-23 13:42:15 UTC
is it not pushed to 
aeolus-configure-2.5.0-6.el6.noarch ??

I can still see the issue there

Comment 13 Richard Su 2012-01-23 23:23:30 UTC
I see it in aeolus-configure-2.5.0-6.el6.noarch. 

You should be seeing something like this when there are parameter lines that are missing two spaces before the parameter name:

Launching aeolus configuration recipe...
Error found in /etc/aeolus-configure/nodes/rhevm_configure
Please check formatting in line containing rhevm_deltacloud_data_center a9c75c76-10be-4116-94c8-ac0eebc52eb0
Please check formatting in line containing rhevm_deltacloud_port 3002
parameters must be in the form [space][space][parameter name][colon][space][parameter value]
classes must be in the form [dash][space][class name]

To check if you have the right piece of code, in /usr/share/aeolus-configure/modules/aeolus/aeolus-node-check, you should see this block starting at line 39:

  # file should only have parameters and classes as top nodes                                                              
  if errors.size == 0

Comment 15 Dave Johnson 2012-02-02 16:00:15 UTC
This needs to be revisited after the change for multi provider support.

This error does not accurately explain the issue
parameters must be in the form [space][space][parameter name][colon][space][parameter value]

and now it would need to be this, which seems a little crazy
parameters must be in the form [space][space][space][space][space][space][space][space][parameter name][colon][space][parameter value]

Comment 16 Richard Su 2012-02-03 02:27:16 UTC
Updated error message to:

The config files are in YAML. Please use the following conventions: 
* Spaces and not tabs should be used to indent.
* A node must be indented further away from its parent node. We use 2 spaces.
* All sibling nodes must be indented with the same number of spaces. 
* The parameter name and value is separated by a colon and a space.

Comment 17 Richard Su 2012-02-03 21:27:39 UTC
aeolus-configure commit 3ac179ba5db7da0a5c7cf8a9e79d89b6cfbede3e

Comment 18 Richard Su 2012-02-07 17:08:26 UTC
Fix is in aeolus-configure-2.5.0-12

Comment 19 Dave Johnson 2012-02-07 17:25:17 UTC
good 2 go in aeolus-configure-2.5.0-12