Class Index [+]

Quicksearch

MCollective::Data

Public Class Methods

[](plugin) click to toggle source

(Not documented)

    # File lib/mcollective/data.rb, line 26
26:     def self.[](plugin)
27:       PluginManager[pluginname(plugin)]
28:     end
ddl(plugin) click to toggle source

(Not documented)

    # File lib/mcollective/data.rb, line 37
37:     def self.ddl(plugin)
38:       DDL.new(pluginname(plugin), :data)
39:     end
ddl_has_output?(ddl, output) click to toggle source

(Not documented)

    # File lib/mcollective/data.rb, line 62
62:     def self.ddl_has_output?(ddl, output)
63:       ddl.entities[:data][:output].include?(output.to_sym) rescue false
64:     end
ddl_transform_input(ddl, input) click to toggle source

For an input where the DDL requests a boolean or some number this will convert the input to the right type where possible else just returns the origin input unedited

if anything here goes wrong just return the input value this is not really the end of the world or anything since all that will happen is that DDL validation will fail and the user will get an error, no need to be too defensive here

    # File lib/mcollective/data.rb, line 74
74:     def self.ddl_transform_input(ddl, input)
75:       begin
76:         type = ddl.entities[:data][:input][:query][:type]
77: 
78:         case type
79:           when :boolean
80:             return DDL.string_to_boolean(input)
81: 
82:           when :number, :integer, :float
83:             return DDL.string_to_number(input)
84:         end
85:       rescue
86:       end
87: 
88:       return input
89:     end
ddl_validate(ddl, argument) click to toggle source

(Not documented)

    # File lib/mcollective/data.rb, line 41
41:     def self.ddl_validate(ddl, argument)
42:       name = ddl.meta[:name]
43:       query = ddl.entities[:data]
44: 
45:       DDL.validation_fail!(:PLMC31, "No dataquery has been defined in the DDL for data plugin '%{plugin}'", :error, :plugin => name)  unless query
46: 
47:       input = query.fetch(:input, {})
48:       output = query.fetch(:output, {})
49: 
50:       DDL.validation_fail!(:PLMC32, "No output has been defined in the DDL for data plugin %{plugin}", :error, :plugin => name) if output.keys.empty?
51: 
52:       if input[:query]
53:         return true if argument.nil? && input[:query][:optional]
54: 
55:         ddl.validate_input_argument(input, :query, argument)
56:       else
57:         DDL.validation_fail!(:PLMC33, "No data plugin argument was declared in the '%{plugin}' DDL but an input was supplied", :error, :plugin => name) if argument
58:         return true
59:       end
60:     end
load_data_sources() click to toggle source

(Not documented)

    # File lib/mcollective/data.rb, line 6
 6:     def self.load_data_sources
 7:       PluginManager.find_and_load("data")
 8: 
 9:       PluginManager.grep(/_data$/).each do |plugin|
10:         begin
11:           unless PluginManager[plugin].class.activate?
12:             Log.debug("Disabling data plugin %s due to plugin activation policy" % plugin)
13:             PluginManager.delete(plugin)
14:           end
15:         rescue Exception => e
16:           Log.debug("Disabling data plugin %s due to exception #{e.class}: #{e}" % plugin)
17:           PluginManager.delete(plugin)
18:         end
19:       end
20:     end
method_missing(method, *args) click to toggle source

Data.package(“httpd”).architecture

    # File lib/mcollective/data.rb, line 31
31:     def self.method_missing(method, *args)
32:       super unless PluginManager.include?(pluginname(method))
33: 
34:       PluginManager[pluginname(method)].lookup(args.first)
35:     end
pluginname(plugin) click to toggle source

(Not documented)

    # File lib/mcollective/data.rb, line 22
22:     def self.pluginname(plugin)
23:       plugin.to_s =~ /_data$/i ? plugin.to_s.downcase : "%s_data" % plugin.to_s.downcase
24:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.