lib/wire/resource/resource.rb
# given a +resource_symname+ as a symbol (i.e. :ovsbridge)
# this creates a resource with given name (i.e. "testbridge")
# and hands on arguments (+resource_nameargs+, may be 1..n)
# returns
# - a new Resource object, depending on type
given a +resource_symname+ as a symbol
this creates a resource with given name
and hands on arguments (+resource_nameargs+, may be 1..n)
returns
a new Resource object, depending on type
given a + resource_symname + as a symbol this creates a resource with given name and hands on arguments ( + resource_nameargs + may be 1 .. n ) returns a new Resource object depending on type
def create(resource_symname, *resource_nameargs)
        clazz_map = {
          :ovsbridge  => OVSBridge,
          :bridgeip   => IPAddressOnIntf,
          :dhcpconfig => DHCPRangeConfiguration,
          :figadapter => FigAdapter,
          :networkinjection => NetworkInjection
        }
        clazz = clazz_map[resource_symname]
        fail(ArgumentError, "Unknown resource type #{resource_symname}") unless clazz
        clazz.new(*resource_nameargs)
      end
def create ( resource_symname , * resource_nameargs ) clazz_map = { :ovsbridge => OVSBridge , :bridgeip => IPAddressOnIntf , :dhcpconfig => DHCPRangeConfiguration , :figadapter => FigAdapter , :networkinjection => NetworkInjection } clazz = clazz_map [ resource_symname ] fail ( ArgumentError , "Unknown resource type #{resource_symname}" ) unless clazz clazz . new ( * resource_nameargs ) end
given a +resource_symname+ as a symbol (i.e.
given a + resource_symname + as a symbol ( i . e .
resource_symname
<not_specific>
resource_nameargs
<not_specific>