class MCollective::DDL::DiscoveryDDL - mcollective version 2.12.5

# 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         => "https://docs.puppetlabs.com/mcollective/",
    :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
    22 def capabilities(*caps)
    23   caps = [caps].flatten
    24
    25   raise "Discovery plugin capabilities can't be empty" if caps.empty?
    26
    27   caps.each do |cap|
    28     if [:classes, :facts, :identity, :agents, :compound].include?(cap)
    29       @entities[:discovery][:capabilities] << cap
    30     else
    31       raise "%s is not a valid capability, valid capabilities are :classes, :facts, :identity, :agents and :compound" % cap
    32     end
    33   end
    34 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
    41 def discovery(&block)
    42   raise "Discovery plugins can only have one definition" if @entities[:discovery]
    43
    44   @entities[:discovery] = {:capabilities => []}
    45
    46   @current_entity = :discovery
    47   block.call if block_given?
    48   @current_entity = nil
    49 end

discovery_interface() click to toggle source

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