From: Martyn Taylor <mtaylor(a)redhat.com>
---
lib/list_command.rb | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/lib/list_command.rb b/lib/list_command.rb
index 52f112b..ac0bc17 100644
--- a/lib/list_command.rb
+++ b/lib/list_command.rb
@@ -6,6 +6,7 @@ module Aeolus
end
def images
+ check_bucket_exists("images")
images = [["IMAGE ID", "LASTEST PUSHED BUILD",
"NAME", "TARGET", "OS", "OS VERSION",
"ARCH", "DESCRIPTION"]]
doc = Nokogiri::XML iwhd['/target_images'].get
# Check for any invalid data in iwhd
@@ -34,6 +35,7 @@ module Aeolus
end
def builds
+ check_bucket_exists("builds")
doc = Nokogiri::XML iwhd['/builds'].get
doc.xpath("/objects/object/key").each do |build|
if iwhd['/builds/' + build.text + "/image"].get ==
@options[:id]
@@ -44,6 +46,7 @@ module Aeolus
end
def targetimages
+ check_bucket_exists("target-images")
doc = Nokogiri::XML iwhd['/target_images'].get
doc.xpath("/objects/object/key").each do |target_image|
begin
@@ -136,6 +139,14 @@ module Aeolus
""
end
end
+
+ def check_bucket_exists(bucket)
+ begin
+ iwhd["/" + bucket].get
+ rescue
+ quit(0)
+ end
+ end
end
end
end
--
1.7.4
Show replies by date