Sha256: 862d22d40abcb88c8b25e9c9e93fa998fa4713b4f2941efacb53dad1712f88c1

Contents?: true

Size: 1.67 KB

Versions: 25

Compression:

Stored size: 1.67 KB

Contents

module MCollective
  module DDL
    # 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
    class DiscoveryDDL < Base
      def discovery_interface
        @entities[:discovery]
      end

      # records valid capabilities for discovery plugins
      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

      # Creates the definition for new discovery plugins
      #
      #    discovery do
      #       capabilities [:classes, :facts, :identity, :agents, :compound]
      #    end
      def discovery(&block)
        raise "Discovery plugins can only have one definition" if @entities[:discovery]

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

        @current_entity = :discovery
        yield if block_given?
        @current_entity = nil
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
choria-mcorpc-support-2.26.4 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.26.3 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.26.2 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.26.1 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.26.0 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.25.3 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.25.2 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.25.1 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.25.0 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.24.4 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.24.3 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.24.2 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.24.1 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.24.0 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.23.3 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.23.2 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.23.1 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.23.0 lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.23.0.pre lib/mcollective/ddl/discoveryddl.rb
choria-mcorpc-support-2.22.1 lib/mcollective/ddl/discoveryddl.rb