Permalink
Browse files

Added storagelink and networkinterface to bin/occi

  • Loading branch information...
arax committed Feb 22, 2013
1 parent fa549ec commit 2985523f00572a75108deb5d6bdb2cebc7a03c88
Showing with 28 additions and 8 deletions.
  1. +28 −8 lib/occi/bin/helpers.rb
View
@@ -83,16 +83,36 @@ def helper_create(options, output = nil)
res = resource options.resource
Occi::Log.debug "Creating #{options.resource}:\n#{res.inspect}"
- Occi::Log.debug "with mixins:#{options.mixins}"
- options.mixins.keys.each do |type|
- Occi::Log.debug "Adding mixins of type #{type} to #{options.resource}"
- options.mixins[type].each do |name|
- mxn = mixin name, type
+ if options.links
+ Occi::Log.debug "with links: #{options.links}"
+
+ options.links.each do |link|
+ if link.include? "/storage/"
+ Occi::Log.debug "Adding storagelink to #{options.resource}"
+ res.storagelink link
+ elsif link.include? "/network/"
+ Occi::Log.debug "Adding networkinterface to #{options.resource}"
+ res.networkinterface link
+ else
+ raise "Unknown link type #{link}, stopping here!"
+ end
+ end
+ end
+
+ if options.mixins
+ Occi::Log.debug "with mixins: #{options.mixins}"
+
+ options.mixins.keys.each do |type|
+ Occi::Log.debug "Adding mixins of type #{type} to #{options.resource}"
+
+ options.mixins[type].each do |name|
+ mxn = mixin name, type
- raise "Unknown mixin #{type}##{name}, stopping here!" if mxn.nil?
- Occi::Log.debug "Adding mixin #{mxn} to #{options.resource}"
- res.mixins << mxn
+ raise "Unknown mixin #{type}##{name}, stopping here!" if mxn.nil?
+ Occi::Log.debug "Adding mixin #{mxn} to #{options.resource}"
+ res.mixins << mxn
+ end
end
end

0 comments on commit 2985523

Please sign in to comment.