On Tue, 2011-05-24 at 15:52 +0100, Mark McLoughlin wrote:
Hey,
<snip>
The tool needs to interact with IWHD for listing, image factory for
building and conductor for provider/account details.
As I was beginning to work on the setup of this script, something
occurred to me. This list of interactions boils down to 5 actual
commands:
* list
* build
* push
* import
* delete
I propose we simplify the below list to simply use these commands, and
either:
A) take some of the existing commands as parameters, or
B) build the above into the command-names, which gets us bash
completion.
I have put the both versions of proposed changes, if any, below the
existing version. One other minor change I would like to propose a short
and long version of all options, also included below for feedback.
It might look like:
$> aeolus-image images # list available
images
A)
$> aeolus-image list --images
$> aeolus-image list -i
B)
$> aeolus-image-list --images
$> aeolus-image-list -i
$> aeolus-image builds $image_id #
list the builds of an image
A)
$> aeolus-image list --builds $image_id
$> aeolus-image list -b $image_id
B)
$> aeolus-image-list --builds $image_id
$> aeolus-image-list -b $image_id
$> aeolus-image target-images $build_id #
list the target images from a build
A)
$> aeolus-image list --targetimages $build_id
$> aeolus-image list -t $build_id
B)
$> aeolus-image-list targetimages $build_id
$> aeolus-image-list t $build_id
$> aeolus-image provider-images $target_image_id #
list the provider images from a target image
A)
$> aeolus-image list --providerimages $target_image_id
$> aeolus-image list -p $target_image_id
B)
$> aeolus-image-list --providerimages $target_image_id
$> aeolus-image list -p $target_image_id
$> aeolus-image build --target ec2 --template my.tmpl #
build a new image for ec2 from the template
A)
$> aeolus-image build -t ec2 -e my.tmpl
B)
$> aeolus-image-build --target ec2 --template my.tmpl
$> aeolus-image-build -t ec2 -e my.tmpl
$> aeolus-image build --image $image_id #
rebuild the image template and targets from latest build
A)
$> aeolus-image build -i $image_id
B)
$> aeolus-image build --image $image_id
$> aeolus-image build -i $image_id
$> aeolus-image build --target ec2 --target rackspace \
#
--image $image_id \ # rebuild the image with
a new template and set of targets
--template my.tmpl #
A)
$> aeolus-image build --target ec2,rackspace \
--image $image_i \
--template my.tmpl
$> aeolus-image build -t ec2,rackspace -i $image_i -a my.tmpl
B)
$> aeolus-image-build --target ec2,rackspace \
--image $image_i \
--template my.tmpl
$> aeolus-image-build -t ec2,rackspace -i $image_i -a my.tmpl
$> aeolus-image push --provider ec2-us-east-1 $target_image_id #
push the target image to the specified provider
A)
$> aeolus-image push --provider ec2-us-east-1 --id $target_image_id
$> aeolus-image push -p ec2-us-east-1 -i $target_image_id
B)
$> aeolus-image-push --provider ec2-us-east-1 --id $target_image_id
$> aeolus-image-push -p ec2-us-east-1 -i $target_image_id
$> aeolus-image push $build_id #
push all target images for a build, to same providers as previously
B)
$> aeolus-image-push $build_id
$> aeolus-image push --account $provider_account $build_id #
ditto, using a specific provider account
A)
$> aeolus-image push --account $provider_account --id $build_id
$> aeolus-image push -a $provider_account -i $build_id
B)
$> aeolus-image-push --account $provider_account --id $build_id
$> aeolus-image-push -a $provider_account -i $build_id
$> aeolus-image push $image_id #
push all the target images for the latest build
B)
$> aeolus-image-push $image_id
$> aeolus-image import --provider ec2-us-east-1 $ami_id #
import an AMI from the specified provider
A)
$> aeolus-image import --provider ec2-us-east-1 --id $ami_id
$> aeolus-image import -p ec2-us-east-1 -i $ami_id
B)
$> aeolus-image-import --provider ec2-us-east-1 $ami_id
$> aeolus-image-import -p ec2-us-east-1 -i $ami_id
$> aeolus-image delete --image $image_id #
deletes all builds, target images and provider images
A)
$> aeolus-image delete -i $image_id
B)
$> aeolus-image-delete --image $image_id
$> aeolus-image-delete -i $image_id
$> aeolus-image delete --build $build_id #
deletes a build, updating latest/parent references as appropriate
A)
$> aeolus-image delete -b $build_id
B)
$> aeolus-image-delete --build $build_id
$> aeolus-image-delete -b $build_id
$> aeolus-image delete --target-image $target_image #
deletes a target image and its provider images
A)
$> aeolus-image delete --targetimage $target_image
$> aeolus-image delete -t $target_image
B)
$> aeolus-image-delete --targetimage $target_image
$> aeolus-image-delete -t $target_image
$> aeolus-image delete --provider-image $provider_image #
deletes a provider image
A)
$> aeolus-image delete --providerimage $provider_image
$> aeolus-image delete -p $provider_image
B)
$> aeolus-image-delete --providerimage $provider_image
$> aeolus-image-delete -p $provider_image
$> aeolus-image targets #
list the values available for the --target parameter
A)
$> aeolus-image list --targets
$> aeolus-image list -g
B)
$> aeolus-image-list --targets
$> aeolus-image-list -g
$> aeolus-image providers #
list the values available for the --provider parameter
A)
$> aeolus-image list --providers
$> aeolus-image list -r
B)
$> aeolus-image-list --providers
$> aeolus-image-list -r
$> aeolus-image accounts
#
list the values available for the --account parameter
A)
$> aeolus-image list --accounts
$> aeolus-image list -a
B)
$> aeolus-image-list --accounts
$> aeolus-image-list -a
I have to say, as I ran through this exercise, I began to favor the
separate command approach, especially for the list command. It feels
like less typing for the user, though I could be persuaded either way.
One last thought (and I didn't think it worthwhile to enumerate all the
options to show this one, though I can if requested) - in the 'one
executable per command' scenario, it could make simpler interaction to
have some commands take a sub-command rather than a parameter all the
time (as I did above). I mainly did not do this in the interest of
consistency between commands, but it may be worth considering.
-j