lib/puppet_x/coi/jboss/provider/confignode.rb
# Method that checks if config node is present in the system
Method that checks if config node is present in the system
Method that checks if config node is present in the system
def exists?
    trace 'exists?'
    if @clean
      return (not @data.nil?)
    end
    @resource[:path] = @resource[:name] if @resource[:path].nil?
    @resource[:properties] = {} if @resource[:properties].nil?
    @resource[:properties].each do |key, value|
      if value == "undef" or value == :undef
        @resource[:properties][key] = nil
      end
    end
    Puppet.debug 'Excute and get in config node'
    res = execute_and_get "#{compiledpath}:read-resource(include-runtime=true, include-defaults=false)"
    if res[:result]
      @data = {}
      res[:data].each do |key, value|
        props = @resource[:properties]
        @data[key] = value
        if not @property_hash.key? :properties
          @property_hash[:properties] = {}
        end
        if props.key? key
          @property_hash[:properties][key] = value
        end
      end
      @clean = true
      traceout 'status()', true
      return true
    end
    @clean = true
    @data = nil
    traceout 'status()', false
    return false
  end
def exists? trace 'exists?' if @clean return ( not @data . nil? ) end @resource [ :path ] = @resource [ :name ] if @resource [ :path ] . nil? @resource [ :properties ] = { } if @resource [ :properties ] . nil? @resource [ :properties ] . each do | key , value | if value == "undef" or value == :undef @resource [ :properties ] [ key ] = nil end end Puppet . debug 'Excute and get in config node' res = execute_and_get "#{compiledpath}:read-resource(include-runtime=true, include-defaults=false)" if res [ :result ] @data = { } res [ :data ] . each do | key , value | props = @resource [ :properties ] @data [ key ] = value if not @property_hash . key? :properties @property_hash [ :properties ] = { } end if props . key? key @property_hash [ :properties ] [ key ] = value end end @clean = true traceout 'status()' , true return true end @clean = true @data = nil traceout 'status()' , false return false end
Method that checks if config node is present in the system
Method that checks if config node is present in the system
# TODO: This line is probably useless, resource path cannot be nil (at lesat when creating type with Puppet::Type.type(:jboss_confignode).new(raw) )