https://bugzilla.redhat.com/show_bug.cgi?id=768509
If we rename aeolus-cli > aeolus, then it doesn't make much
sense to have the subcommands be of the form 'aeolus-cli-{command}'.
This patch sets up the first convenience executable to allow power
users to invoke the image manement tooling directly. This pattern
can then be repeated as other parts of aeolus get their own cli
interface (aeolus-deployable, for example).
---
Rakefile | 3 +-
bin/{aeolus-cli => aeolus} | 0
bin/aeolus-image | 20 ++++++++++++
lib/aeolus_cli/command/config_parser.rb | 52 +++++++++++++++---------------
rubygem-aeolus-cli.spec | 9 ++---
5 files changed, 52 insertions(+), 32 deletions(-)
rename bin/{aeolus-cli => aeolus} (100%)
create mode 100755 bin/aeolus-image
diff --git a/Rakefile b/Rakefile
index b2367d8..f37a160 100644
--- a/Rakefile
+++ b/Rakefile
@@ -33,7 +33,8 @@ spec = Gem::Specification.new do |s|
s.email = 'jguiditt(a)redhat.com, mtaylor(a)redhat.com'
s.license = 'ASL 2.0'
s.homepage = 'http://aeolusproject.org'
- s.executables << 'aeolus-cli'
+ s.executables << 'aeolus' << 'aeolus-image'
+ s.default_executable = 'aeolus'
s.files = %w(Rakefile) + Dir.glob("{bin,lib,spec,examples,man}/**/*") +
%w(COPYING)
s.require_path = "lib"
s.bindir = "bin"
diff --git a/bin/aeolus-cli b/bin/aeolus
similarity index 100%
rename from bin/aeolus-cli
rename to bin/aeolus
diff --git a/bin/aeolus-image b/bin/aeolus-image
new file mode 100755
index 0000000..53a85c3
--- /dev/null
+++ b/bin/aeolus-image
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+
+# Copyright 2011 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#
http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
+require 'aeolus_cli'
+parser = Aeolus::CLI::ConfigParser.new(ARGV)
+parser.process
diff --git a/lib/aeolus_cli/command/config_parser.rb
b/lib/aeolus_cli/command/config_parser.rb
index 438bb70..6f66fba 100644
--- a/lib/aeolus_cli/command/config_parser.rb
+++ b/lib/aeolus_cli/command/config_parser.rb
@@ -48,7 +48,7 @@ module Aeolus
subcommand = subcommand.to_sym if subcommand
@optparse ||= OptionParser.new do|opts|
- opts.banner = "Usage: aeolus-cli image [#{COMMANDS.join('|')}]
[general options] [command options]"
+ opts.banner = "Usage: aeolus-image [#{COMMANDS.join('|')}]
[general options] [command options]"
opts.separator ""
opts.separator "General options:"
@@ -168,22 +168,22 @@ module Aeolus
if !subcommand || subcommand == :list
opts.separator ""
opts.separator "List Examples:"
- opts.separator "aeolus-cli list --images # list
available images"
- opts.separator "aeolus-cli list --builds $image_id # list the
builds of an image"
- opts.separator "aeolus-cli list --targetimages $build_id # list the
target images from a build"
- opts.separator "aeolus-cli list --providerimages $target_id # list the
provider images from a target image"
- opts.separator "aeolus-cli list --targets # list the
values available for the --target parameter"
- opts.separator "aeolus-cli list --providers # list the
values available for the --provider parameter"
- opts.separator "aeolus-cli list --accounts # list the
values available for the --account parameter"
+ opts.separator "aeolus-image list --images # list
available images"
+ opts.separator "aeolus-image list --builds $image_id # list the
builds of an image"
+ opts.separator "aeolus-image list --targetimages $build_id # list the
target images from a build"
+ opts.separator "aeolus-image list --providerimages $target_id # list the
provider images from a target image"
+ opts.separator "aeolus-image list --targets # list the
values available for the --target parameter"
+ opts.separator "aeolus-image list --providers # list the
values available for the --provider parameter"
+ opts.separator "aeolus-image list --accounts # list the
values available for the --account parameter"
end
if !subcommand || subcommand == :build
opts.separator ""
opts.separator "Build examples:"
- opts.separator "aeolus-cli build --target ec2 --template my.tmpl
# build a new image for ec2 from based on the given template"
- opts.separator "aeolus-cli build --target ec2,rhevm --template my.tmpl
# build a new image for ec2 and for rhevm based on the given template"
- #opts.separator "aeolus-cli build --image $image_id #
(NOT IMPLEMENTED) rebuild the image template and targets from latest build"
- #opts.separator %q{aeolus-cli build --target ec2,rackspace \ #
rebuild the image with a new template and set of targets
+ opts.separator "aeolus-image build --target ec2 --template my.tmpl
# build a new image for ec2 from based on the given template"
+ opts.separator "aeolus-image build --target ec2,rhevm --template my.tmpl
# build a new image for ec2 and for rhevm based on the given template"
+ #opts.separator "aeolus-image build --image $image_id #
(NOT IMPLEMENTED) rebuild the image template and targets from latest build"
+ #opts.separator %q{aeolus-image build --target ec2,rackspace \ #
rebuild the image with a new template and set of targets
# --image $image_i \
# --template my.tmpl}
end
@@ -191,32 +191,32 @@ module Aeolus
if !subcommand || subcommand == :push
opts.separator ""
opts.separator "Push examples:"
- opts.separator "aeolus-cli push --account ec2-account,ec2-account2
--targetimage $target_image_id # Push target images to each of the specified
account"
- opts.separator "aeolus-cli push --account ec2-account,rhevm-account
--build $build_id # Push target images attached to a particular build to
each of the specified accounts"
- opts.separator "aeolus-cli push --account ec2-account,rhevm-account
--image $image_id # Push target images attached to a particular image to
each of the specified accounts"
+ opts.separator "aeolus-image push --account ec2-account,ec2-account2
--targetimage $target_image_id # Push target images to each of the specified
account"
+ opts.separator "aeolus-image push --account ec2-account,rhevm-account
--build $build_id # Push target images attached to a particular build to
each of the specified accounts"
+ opts.separator "aeolus-image push --account ec2-account,rhevm-account
--image $image_id # Push target images attached to a particular image to
each of the specified accounts"
end
if !subcommand || subcommand == :import
opts.separator ""
opts.separator "Import examples:"
- opts.separator "aeolus-cli import --provider_account my-ec2 --id $ami_id
# import an AMI from the specified provider"
- opts.separator "aeolus-cli import --provider_account my-ec2 --id $ami_id
--description '<image><name>My Image</name></image>' #
import an AMI from the specified provider"
- opts.separator "aeolus-cli import --provider_account my-ec2 --id $ami_id
--description <path_to_xml_file> # import an AMI from the specified provider"
+ opts.separator "aeolus-image import --provider_account my-ec2 --id
$ami_id # import an AMI from the specified provider"
+ opts.separator "aeolus-image import --provider_account my-ec2 --id
$ami_id --description '<image><name>My
Image</name></image>' # import an AMI from the specified provider"
+ opts.separator "aeolus-image import --provider_account my-ec2 --id
$ami_id --description <path_to_xml_file> # import an AMI from the specified
provider"
end
if !subcommand || subcommand == :status
opts.separator "Status examples:"
- opts.separator "aeolus-cli status --targetimage $target_image #
status of target image build"
- opts.separator "aeolus-cli status --providerimage $provider_image #
status of provider image push"
+ opts.separator "aeolus-image status --targetimage $target_image #
status of target image build"
+ opts.separator "aeolus-image status --providerimage $provider_image #
status of provider image push"
end
if !subcommand || subcommand == :delete
opts.separator ""
opts.separator "Delete examples: (DELETE CURRENTLY NOT IMPLEMENTED)
"
- opts.separator "aeolus-cli delete --image $image_id #
deletes a image and all associated builds"
- opts.separator "aeolus-cli delete --build $build_id #
deletes a build and all associated targetimages"
- opts.separator "aeolus-cli delete --targetimage $target_image #
deletes a target image and all associated provider images"
- opts.separator "aeolus-cli delete --providerimage $provider_image #
deletes a provider image"
+ opts.separator "aeolus-image delete --image $image_id #
deletes a image and all associated builds"
+ opts.separator "aeolus-image delete --build $build_id #
deletes a build and all associated targetimages"
+ opts.separator "aeolus-image delete --targetimage $target_image #
deletes a target image and all associated provider images"
+ opts.separator "aeolus-image delete --providerimage $provider_image #
deletes a provider image"
end
end
@@ -242,7 +242,7 @@ module Aeolus
# self.send(@options[:subcommand])
if @options[:subcommand].nil?
# TODO: Pull out Print Usage into seporate method, and print
- puts "Could not find subcommand for list, run `./aeolus-cli --help` for
usage instructions"
+ puts "Could not find subcommand for list, run `./aeolus-image --help` for
usage instructions"
exit(1)
else
list_command = ListCommand.new(@options)
@@ -268,7 +268,7 @@ module Aeolus
def delete
if @options[:subcommand].nil?
# TODO: Pull out Print Usage into seporate method, and print
- puts "Could not find subcommand for delete, run `./aeolus-cli --help` for
usage instructions"
+ puts "Could not find subcommand for delete, run `./aeolus-image --help`
for usage instructions"
exit(1)
else
delete_command = DeleteCommand.new(@options)
diff --git a/rubygem-aeolus-cli.spec b/rubygem-aeolus-cli.spec
index 73075db..bf46aa5 100644
--- a/rubygem-aeolus-cli.spec
+++ b/rubygem-aeolus-cli.spec
@@ -14,11 +14,9 @@ URL:
http://aeolusproject.org
# The source for this packages was pulled from the upstream's git repo.
# Use the following commands to generate the gem
-# git clone
git://git.fedorahosted.org/aeolus/conductor.git
-# git checkout next
-# cd services/image_factory/aeolus-image
+# git clone
git://github.com/aeolusproject/aeolus-cli.git
+# cd aeolus-cli
# rake gem
-# grab image_factory_console-0.0.1.gem from the pkg subdir
Source0: %{gemname}-%{version}.gem
Requires: ruby(abi) = %{rubyabi}
@@ -62,7 +60,8 @@ mv %{buildroot}%{geminstdir}/man/* %{buildroot}%{mandir}
%files
%doc %{geminstdir}/COPYING
-%{_bindir}/aeolus-cli
+%{_bindir}/aeolus
+%{_bindir}/aeolus-image
%dir %{geminstdir}
%{geminstdir}/Rakefile
%{geminstdir}/bin
--
1.7.7.4