deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/4] git commit: DigitalOcean: Define default :realm_id and :hwp_id for create_instance
Date Tue, 12 Mar 2013 17:31:20 GMT
DigitalOcean: Define default :realm_id and :hwp_id for create_instance


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/16cdb087
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/16cdb087
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/16cdb087

Branch: refs/heads/master
Commit: 16cdb08776186e1a137c4d2be9d72d46ed158961
Parents: d399b0a
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Mar 7 14:59:35 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue Mar 12 11:25:35 2013 +0100

----------------------------------------------------------------------
 .../drivers/digitalocean/digitalocean_driver.rb    |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/16cdb087/server/lib/deltacloud/drivers/digitalocean/digitalocean_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/digitalocean/digitalocean_driver.rb b/server/lib/deltacloud/drivers/digitalocean/digitalocean_driver.rb
index 2a202cc..64f7ec8 100644
--- a/server/lib/deltacloud/drivers/digitalocean/digitalocean_driver.rb
+++ b/server/lib/deltacloud/drivers/digitalocean/digitalocean_driver.rb
@@ -134,9 +134,15 @@ module Deltacloud
           safely do
             client = new_client(credentials)
             args = { :image_id => image_id }
-            args.merge!(:region_id => opts[:realm_id]) if opts[:realm_id]
-            args.merge!(:size_id => opts[:hwp_id]) if opts[:hwp_id]
-            args.merge!(:name => opts[:name] || "inst#{Time.now.to_i}")
+            # Defaults to first realm if realm_id not set
+            opts[:realm_id] ||= '1'
+            args.merge!(:region_id => opts[:realm_id])
+            # Defaults to first size if hwp_id not set
+            opts[:hwp_id] ||= '66'
+            args.merge!(:size_id => opts[:hwp_id])
+            # Default to 'inst-timestamp if name is not set'
+            opts[:name] ||= "inst-#{Time.now.to_i}"
+            args.merge!(:name => opts[:name])
             args.merge!(:ssh_key_ids => opts[:keyname]) if opts[:keyname]
             convert_instance(
               credentials.user,


Mime
View raw message