Module | MCollective::Data |
In: |
lib/mcollective/data/base.rb
lib/mcollective/data/result.rb lib/mcollective/data.rb |
# File lib/mcollective/data.rb, line 26 26: def self.[](plugin) 27: PluginManager[pluginname(plugin)] 28: end
# File lib/mcollective/data.rb, line 54 54: def self.ddl_has_output?(ddl, output) 55: ddl.entities[:data][:output].include?(output.to_sym) rescue false 56: 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
# File lib/mcollective/data.rb, line 66 66: def self.ddl_transform_input(ddl, input) 67: begin 68: type = ddl.entities[:data][:input][:query][:type] 69: 70: case type 71: when :boolean 72: return DDL.string_to_boolean(input) 73: when :number, :integer, :float 74: return DDL.string_to_number(input) 75: end 76: rescue 77: end 78: 79: return input 80: end
# File lib/mcollective/data.rb, line 37 37: def self.ddl_validate(ddl, argument) 38: name = ddl.meta[:name] 39: query = ddl.entities[:data] 40: 41: raise DDLValidationError, "No dataquery has been defined in the DDL for data plugin #{name}" unless query 42: 43: input = query[:input] 44: output = query[:output] 45: 46: raise DDLValidationError, "No :query input has been defined in the DDL for data plugin #{name}" unless input[:query] 47: raise DDLValidationError, "No output has been defined in the DDL for data plugin #{name}" if output.keys.empty? 48: 49: return true if argument.nil? && input[:query][:optional] 50: 51: ddl.validate_input_argument(input, :query, argument) 52: end
# 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
# 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