Bug 799108

Summary: wrong error when pushing without --account value
Product: [Retired] CloudForms Cloud Engine Reporter: Dave Johnson <dajohnso>
Component: rubygem-aeolus-cliAssignee: Martyn Taylor <mtaylor>
Status: CLOSED CURRENTRELEASE QA Contact: wes hayutin <whayutin>
Severity: low Docs Contact:
Priority: low    
Version: 1.0.0CC: ssachdev
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: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dave Johnson 2012-03-01 19:33:14 UTC
Description of problem:
=================================

Would think it should say something about no account value found or something to that effect.

[root@hp-nehalem-02 ~]# aeolus-image push --account --image <uuid>
Error: You must specify either an image, build or target image to push

Version-Release number of selected component (if applicable):
================================================================
aeolus-configure-2.5.0-15.el6.noarch

Comment 1 Dave Johnson 2012-03-01 19:36:28 UTC
I should have gave this example...

[root@hp-nehalem-02 ~]# aeolus-image push --image <uuid>
Error: You must specifcy an account to push to

in case you notice, 'specify' misspelling tracked in bug 799107

Comment 2 Martyn Taylor 2012-03-05 16:05:24 UTC
What is happening here is that when specifying aeolus-image push --account --image <uuid>

the account option, is getting set to --image.  i.e. --account => --image.  aeolus-image then sees that there has been an account set but no image has been defined.

A fix is needed when parsing the options using opt parse, to determine the start of an option i.e. - or --.

Comment 3 Martyn Taylor 2012-03-06 19:02:16 UTC
After some investigation, I' this we should leave the behaviour as it is.  --image could really be a valid value for an option to take.

aeolus-image push --account --image is setting --account => --image.  This is acceptable.  For example, you may have file names on linux system that start with "-" so a file could have name "--image".  We would need to support this when passing a file into CLI, for example when doing a build on --template

There may be a case for checking for valid UUIDs when specifying --images etc...  but that is a separate issues.  

We could also check that all other params (other than --template) do not start with "-".  This will still leave us with a similar situation: 

aeolus-image build --template --target ec2 --environment default.


In addition to this and a strong motivator for my decision is that there is no easy way to solve this in OptionParser in Ruby.  We could hack it with regular expressions and override standard classes or even monkey patch it.  But I think for what we are gaining it's not really worth it.  Especially since you could argue that existing behaviour is acceptable.

Comment 4 Shveta 2012-03-07 06:15:50 UTC
aeolus-image push --image 8ec28d36-6818-11e1-89b1-00215e20311c
Error: You must specify an account to push to

aeolus-image push --account --image
Error: You must specify either an image, build or target image to push

Verified as mentioned in comment 3

rpm -qa|grep aeolus
aeolus-conductor-doc-0.8.0-41.el6.noarch
aeolus-conductor-daemons-0.8.0-41.el6.noarch
rubygem-aeolus-cli-0.3.0-13.el6.noarch
aeolus-all-0.8.0-41.el6.noarch
aeolus-conductor-0.8.0-41.el6.noarch
rubygem-aeolus-image-0.3.0-12.el6.noarch
aeolus-configure-2.5.0-18.el6.noarch