Bug 799108 - wrong error when pushing without --account value
wrong error when pushing without --account value
Product: CloudForms Cloud Engine
Classification: Red Hat
Component: rubygem-aeolus-cli (Show other bugs)
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Martyn Taylor
wes hayutin
Depends On:
  Show dependency treegraph
Reported: 2012-03-01 14:33 EST by Dave Johnson
Modified: 2012-08-30 13:18 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dave Johnson 2012-03-01 14:33:14 EST
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):
Comment 1 Dave Johnson 2012-03-01 14:36:28 EST
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 11:05:24 EST
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 14:02:16 EST
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 01:15:50 EST
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

Note You need to log in before you can comment on or make changes to this bug.