X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=doc%2Fclasses%2FMCollective%2FData.html;fp=doc%2Fclasses%2FMCollective%2FData.html;h=aa7eae97cf67afa8e72709154be1903f391b143f;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=0000000000000000000000000000000000000000;hpb=8a3fe7daeecccf43dd71c59371c5005400d35101;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/classes/MCollective/Data.html b/doc/classes/MCollective/Data.html new file mode 100644 index 0000000..aa7eae9 --- /dev/null +++ b/doc/classes/MCollective/Data.html @@ -0,0 +1,381 @@ + + + + + + Module: MCollective::Data + + + + + + + + + + +
+ + + + + + + + + + +
ModuleMCollective::Data
In: + + lib/mcollective/data/base.rb + +
+ + lib/mcollective/data/result.rb + +
+ + lib/mcollective/data.rb + +
+
+
+ + +
+ + + +
+ + + +
+ +
+

Methods

+ + +
+ +
+ + + + +
+ +
+

Classes and Modules

+ + Class MCollective::Data::Base
+Class MCollective::Data::Result
+ +
+ + + + + + + + +
+

Public Class methods

+ +
+ + + + +
+

[Source]

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

[Source]

+
+
+    # File lib/mcollective/data.rb, line 37
+37:     def self.ddl(plugin)
+38:       DDL.new(pluginname(plugin), :data)
+39:     end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+    # 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
+
+
+
+
+ +
+ + + + +
+

+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 +

+

[Source]

+
+
+    # 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
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+    # 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
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+    # 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
+
+
+
+
+ +
+ + + + +
+

+Data.package("httpd").architecture +

+

[Source]

+
+
+    # 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
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+    # 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
+
+
+
+
+ + +
+ + +
+ + +
+

[Validate]

+
+ + + \ No newline at end of file