Sha256: 66f1af9ea11b67a3b38ff70bba3fece1cf17859a9bbd3ce878277dd7282e458f

Contents?: true

Size: 1.9 KB

Versions: 28

Compression:

Stored size: 1.9 KB

Contents

module MCollective
  module DDL
    # A DDL file for the data query plugins.
    #
    # Query plugins can today take only one input by convention in the DDL that
    # is called :query, otherwise the input is identical to the standard input.
    #
    # metadata    :name        => "Agent",
    #             :description => "Meta data about installed MColletive Agents",
    #             :author      => "R.I.Pienaar <rip@devco.net>",
    #             :license     => "ASL 2.0",
    #             :version     => "1.0",
    #             :url         => "https://docs.puppetlabs.com/mcollective/",
    #             :timeout     => 1
    #
    # dataquery :description => "Agent Meta Data" do
    #     input :query,
    #           :prompt => "Agent Name",
    #           :description => "Valid agent name",
    #           :type => :string,
    #           :validation => /^[\w\_]+$/,
    #           :maxlength => 20
    #
    #     [:license, :timeout, :description, :url, :version, :author].each do |item|
    #       output item,
    #              :description => "Agent #{item}",
    #              :display_as => item.to_s.capitalize
    #     end
    # end
    class DataDDL<Base
      def dataquery(input, &block)
        raise "Data queries need a :description" unless input.include?(:description)
        raise "Data queries can only have one definition" if @entities[:data]

        @entities[:data]  = {:description => input[:description],
                             :input => {},
                             :output => {}}

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

      def input(argument, properties)
        raise "The only valid input name for a data query is 'query'" if argument != :query

        super
      end

      # Returns the interface for the data query
      def dataquery_interface
        @entities[:data] || {}
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
mcollective-client-2.12.5 lib/mcollective/ddl/dataddl.rb
choria-mcorpc-support-2.20.6 lib/mcollective/ddl/dataddl.rb
choria-mcorpc-support-2.20.5 lib/mcollective/ddl/dataddl.rb
choria-mcorpc-support-2.20.4 lib/mcollective/ddl/dataddl.rb
choria-mcorpc-support-2.20.3 lib/mcollective/ddl/dataddl.rb
choria-mcorpc-support-2.20.2 lib/mcollective/ddl/dataddl.rb
choria-mcorpc-support-2.20.0 lib/mcollective/ddl/dataddl.rb
choria-mcorpc-support-0.0.1 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.12.4 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.12.3 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.12.1 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.12.0 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.10.6 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.11.4 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.11.3 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.11.2 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.11.1 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.11.0 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.10.4 lib/mcollective/ddl/dataddl.rb
mcollective-client-2.10.3 lib/mcollective/ddl/dataddl.rb