# class MCollective::DDL::DiscoveryDDL

DDL for discovery plugins, a full example can be seen below

metadata :name => “mc”,

    :description => "MCollective Broadcast based discovery",
    :author      => "R.I.Pienaar <rip@devco.net>",
    :license     => "ASL 2.0",
    :version     => "0.1",
    :url         => "http://marionette-collective.org/",
    :timeout     => 2

discovery do

    capabilities [:classes, :facts, :identity, :agents, :compound]

end

### Public Instance Methods

capabilities(*caps) click to toggle source

records valid capabilities for discovery plugins

    # File lib/mcollective/ddl/discoveryddl.rb, line 22
    def capabilities(*caps)
      caps = [caps].flatten

      raise "Discovery plugin capabilities can't be empty" if caps.empty?

      caps.each do |cap|
        if [:classes, :facts, :identity, :agents, :compound].include?(cap)
          @entities[:discovery][:capabilities] << cap
        else
          raise "%s is not a valid capability, valid capabilities are :classes, :facts, :identity, :agents and :compound" % cap
        end
      end
    end

discovery(&block) click to toggle source

Creates the definition for new discovery plugins

    discovery do
       capabilities [:classes, :facts, :identity, :agents, :compound]
    end

    # File lib/mcollective/ddl/discoveryddl.rb, line 41
    def discovery(&block)
      raise "Discovery plugins can only have one definition" if @entities[:discovery]

      @entities[:discovery] = {:capabilities => []}

      @current_entity = :discovery
      block.call if block_given?
      @current_entity = nil
    end

discovery_interface() click to toggle source

    # File lib/mcollective/ddl/discoveryddl.rb, line 17
    def discovery_interface
      @entities[:discovery]
    end