You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/02/02 14:52:32 UTC
[PATCH core 2/2] Fixed plain_formatter and base_object in client
From: Michal Fojtik <mf...@redhat.com>
---
client/lib/base_object.rb | 1 -
client/lib/plain_formatter.rb | 7 +++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/client/lib/base_object.rb b/client/lib/base_object.rb
index 8b0f394..06db703 100644
--- a/client/lib/base_object.rb
+++ b/client/lib/base_object.rb
@@ -108,7 +108,6 @@ module DeltaCloud
# First of all search throught array for method name
m = search_for_method(method_name)
if m.nil?
- warn "[WARNING] Method unsupported by API: '#{self.class}.#{method_name}(#{args.inspect})'"
return nil
else
# Call appropriate handler for method
diff --git a/client/lib/plain_formatter.rb b/client/lib/plain_formatter.rb
index e17a5e6..baa0f9c 100644
--- a/client/lib/plain_formatter.rb
+++ b/client/lib/plain_formatter.rb
@@ -33,8 +33,11 @@ module DeltaCloud
class HardwareProfile < Base
def format
+ architecture = @obj.architecture ? @obj.architecture.value[0,6] : 'opaque'
+ memory = @obj.memory ? @obj.memory.value.to_s[0,10] : 'opaque'
+ storage = @obj.storage ? @obj.storage.value.to_s[0,10] : 'opaque'
sprintf("%-15s | %-6s | %10s | %10s ", @obj.id[0, 15],
- @obj.architecture.value[0,6], @obj.memory.value.to_s[0,10], @obj.storage.value.to_s[0,10])
+ architecture , memory, storage)
end
end
@@ -77,7 +80,7 @@ module DeltaCloud
end
def format(obj)
- object_name = obj.class.name.classify.gsub(/^DeltaCloud::API::/, '')
+ object_name = obj.class.name.classify.gsub(/^DeltaCloud::API::(\w+)::/, '')
format_class = DeltaCloud::PlainFormatter::FormatObject.const_get(object_name)
format_class.new(obj).format
end
--
1.7.3.4