incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r962207 - in /incubator/deltacloud/trunk/client/lib/dcloud: flavor.rb image.rb instance.rb realm.rb storage_snapshot.rb storage_volume.rb
Date Thu, 08 Jul 2010 23:36:42 GMT
Author: lutter
Date: Thu Jul  8 23:36:41 2010
New Revision: 962207

URL: http://svn.apache.org/viewvc?rev=962207&view=rev
Log:
Added to_plain method

Modified:
    incubator/deltacloud/trunk/client/lib/dcloud/flavor.rb
    incubator/deltacloud/trunk/client/lib/dcloud/image.rb
    incubator/deltacloud/trunk/client/lib/dcloud/instance.rb
    incubator/deltacloud/trunk/client/lib/dcloud/realm.rb
    incubator/deltacloud/trunk/client/lib/dcloud/storage_snapshot.rb
    incubator/deltacloud/trunk/client/lib/dcloud/storage_volume.rb

Modified: incubator/deltacloud/trunk/client/lib/dcloud/flavor.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/dcloud/flavor.rb?rev=962207&r1=962206&r2=962207&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/dcloud/flavor.rb (original)
+++ incubator/deltacloud/trunk/client/lib/dcloud/flavor.rb Thu Jul  8 23:36:41 2010
@@ -39,5 +39,11 @@ module DCloud
           @architecture = xml.text( 'architecture' )
         end
       end
+
+      def to_plain
+        sprintf("%-15s | %-6s | %10s GB | %10s GB", self.id[0, 15], self.architecture[0,6],
+          self.memory.to_s[0,10], self.storage.to_s[0,10])
+      end
+
     end
 end

Modified: incubator/deltacloud/trunk/client/lib/dcloud/image.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/dcloud/image.rb?rev=962207&r1=962206&r2=962207&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/dcloud/image.rb (original)
+++ incubator/deltacloud/trunk/client/lib/dcloud/image.rb Thu Jul  8 23:36:41 2010
@@ -42,5 +42,15 @@ module DCloud
         end
       end
 
+      def to_plain
+        sprintf("%-10s | %-20s | %-6s | %-20s | %15s",
+          self.id[0,10],
+          self.name ? self.name[0, 20]: 'unknown',
+          self.architecture[0,6],
+          self.description[0,20],
+          self.owner_id[0,15]
+        )
+      end
+
     end
 end

Modified: incubator/deltacloud/trunk/client/lib/dcloud/instance.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/dcloud/instance.rb?rev=962207&r1=962206&r2=962207&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/dcloud/instance.rb (original)
+++ incubator/deltacloud/trunk/client/lib/dcloud/instance.rb Thu Jul  8 23:36:41 2010
@@ -39,6 +39,17 @@ module DCloud
         super( client, uri, xml )
       end
 
+      def to_plain
+        sprintf("%-15s | %-15s | %-15s | %10s | %32s | %32s", 
+          self.id ? self.id[0,15] : '-',
+          self.name ? self.name[0,15] : 'unknown',
+          self.image.name ? self.image.name[0,15] : 'unknown',
+          self.state ? self.state.to_s[0,10] : 'unknown',
+          self.public_addresses.join(',')[0,32],
+          self.private_addresses.join(',')[0,32]
+          )
+      end
+
       def start!()
         url = action_urls['start']
         throw Exception.new( "Unable to start" ) unless url

Modified: incubator/deltacloud/trunk/client/lib/dcloud/realm.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/dcloud/realm.rb?rev=962207&r1=962206&r2=962207&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/dcloud/realm.rb (original)
+++ incubator/deltacloud/trunk/client/lib/dcloud/realm.rb Thu Jul  8 23:36:41 2010
@@ -43,5 +43,15 @@ module DCloud
           end
         end
       end
+
+      def to_plain
+        sprintf("%-10s | %-15s | %-5s | %10s GB", 
+          self.id[0, 10], 
+          self.name[0, 15], 
+          self.state[0,5], 
+          self.limit.to_s[0,10]
+        )
+      end
+
     end
 end

Modified: incubator/deltacloud/trunk/client/lib/dcloud/storage_snapshot.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/dcloud/storage_snapshot.rb?rev=962207&r1=962206&r2=962207&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/dcloud/storage_snapshot.rb (original)
+++ incubator/deltacloud/trunk/client/lib/dcloud/storage_snapshot.rb Thu Jul  8 23:36:41 2010
@@ -27,6 +27,15 @@ module DCloud
       attribute :state
       attribute :storage_volume
 
+      def to_plain
+        sprintf("%-10s | %-15s | %-6s | %15s",
+          self.id[0,10],
+          self.storage_volume.name ? self.storage_volume.name[0, 15] : 'unknown',
+          self.state ? self.state[0,6] : 'unknown',
+          self.created ? self.created[0,15] : 'unknown'
+        )
+      end
+
       def initialize(client, uri, xml=nil)
         super( client, uri, xml )
       end

Modified: incubator/deltacloud/trunk/client/lib/dcloud/storage_volume.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/dcloud/storage_volume.rb?rev=962207&r1=962206&r2=962207&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/dcloud/storage_volume.rb (original)
+++ incubator/deltacloud/trunk/client/lib/dcloud/storage_volume.rb Thu Jul  8 23:36:41 2010
@@ -32,6 +32,16 @@ module DCloud
         super( client, uri, xml )
       end
 
+      def to_plain
+        sprintf("%-10s | %15s GB | %-10s | %-10s | %-15s",
+          self.id[0,10],
+          self.capacity ? self.capacity.to_s[0,15] : 'unknown',
+          self.device ? self.device[0,10] : 'unknown',
+          self.state ? self.state[0,10] : 'unknown',
+          self.instance ? self.instance.name[0,15] : 'unknown'
+        )
+      end
+
       def load_payload(xml=nil)
         super(xml)
         unless xml.nil?



Mime
View raw message