You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2013/03/05 17:47:41 UTC

git commit: CIMI: Restore create Network with config/forwarding_group by reference

Updated Branches:
  refs/heads/master 49b2a93ad -> 955789adf


CIMI: Restore create Network with config/forwarding_group by reference


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

Branch: refs/heads/master
Commit: 955789adf729f0a0a5a76c2aa6c3b27b0bff5723
Parents: 49b2a93
Author: marios <ma...@redhat.com>
Authored: Tue Mar 5 11:33:04 2013 +0200
Committer: marios <ma...@redhat.com>
Committed: Tue Mar 5 18:47:22 2013 +0200

----------------------------------------------------------------------
 server/lib/cimi/models/network_create.rb |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/955789ad/server/lib/cimi/models/network_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/network_create.rb b/server/lib/cimi/models/network_create.rb
index 006a064..2496269 100644
--- a/server/lib/cimi/models/network_create.rb
+++ b/server/lib/cimi/models/network_create.rb
@@ -13,25 +13,27 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::Network < CIMI::Model::Base
+class CIMI::Model::NetworkCreate < CIMI::Model::Base
 
   ref :network_template, :required => true
 
   def create(context)
     validate!
-
     if network_template.href?
       template = network_template.find(context)
+      network_config = template.network_config.find(context)
+      forwarding_group = template.forwarding_group.find(context)
+    else
+      network_config = CIMI::Model::NetworkConfiguration.find(context.href_id(network_template.network_config.href, :network_configurations), context)
+      forwarding_group = CIMI::Model::ForwardingGroup.find(context.href_id(network_template.forwarding_group.href, :forwarding_groups), context)
     end
-
     params = {
-      :network_config => template.network_config.find(context),
-      :forwarding_group => template.forwarding_group.find(context),
+      :network_config => network_config,
+      :forwarding_group => forwarding_group,
       :name => name,
       :description => description,
       :env => context # FIXME: We should not pass the context to the driver (!)
     }
-
     network = context.driver.create_network(context.credentials, params)
     network.property = property if property
     network.save