From 6753d1d64166b510da3946637a0f490ccb1e20ec Mon Sep 17 00:00:00 2001 From: siddheshwar-more Date: Wed, 4 Sep 2013 17:42:48 +0530 Subject: [PATCH] Added Location column in image list display --- lib/azure/image.rb | 3 ++- lib/azure/rest.rb | 2 +- lib/chef/knife/azure_image_list.rb | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/azure/image.rb b/lib/azure/image.rb index 12903cd..ebda279 100755 --- a/lib/azure/image.rb +++ b/lib/azure/image.rb @@ -51,12 +51,13 @@ end class Azure class Image attr_accessor :category, :label - attr_accessor :name, :os, :eula, :description + attr_accessor :name, :os, :eula, :description, :location def initialize(image) @category = image.at_css('Category').content @label = image.at_css('Label').content @name = image.at_css('Name').content @os = image.at_css('OS').content + @location = image.at_css('Location').content.gsub(";", ", ") @eula = image.at_css('Eula').content if image.at_css('Eula') @description = image.at_css('Description').content if image.at_css('Description') end diff --git a/lib/azure/rest.rb b/lib/azure/rest.rb index b48e03f..386d8ce 100755 --- a/lib/azure/rest.rb +++ b/lib/azure/rest.rb @@ -72,7 +72,7 @@ module AzureAPI elsif verb == 'delete' request = Net::HTTP::Delete.new(uri.request_uri) end - request["x-ms-version"] = "2012-03-01" + request["x-ms-version"] = "2013-03-01" request["content-type"] = "application/xml" request["accept"] = "application/xml" request["accept-charset"] = "utf-8" diff --git a/lib/chef/knife/azure_image_list.rb b/lib/chef/knife/azure_image_list.rb index c93681a..1131705 100755 --- a/lib/chef/knife/azure_image_list.rb +++ b/lib/chef/knife/azure_image_list.rb @@ -44,7 +44,7 @@ class Chef validate! - image_labels = !locate_config_value(:show_all_fields) ? ['Name', 'OS'] : ['Name', 'Category', 'Label', 'OS'] + image_labels = !locate_config_value(:show_all_fields) ? ['Name', 'OS', 'Location'] : ['Name', 'Category', 'Label', 'OS', 'Location'] image_list = image_labels.map {|label| ui.color(label, :bold)} items = connection.images.all @@ -54,7 +54,7 @@ class Chef end puts "\n" - puts h.list(image_list, :uneven_columns_across, !locate_config_value(:show_all_fields) ? 2 : 4) + puts h.list(image_list, :uneven_columns_across, !locate_config_value(:show_all_fields) ? 3 : 5) end end