X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=lib%2Fmcollective%2Fmessage.rb;h=2b31717357d239e0c437e32f3d961d793d9c0f04;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=f9b5e56a99e4d86f705b74f1bfd4fc6b935b7968;hpb=b87d2f4e68281062df1913440ca5753ae63314a9;p=packages%2Fprecise%2Fmcollective.git diff --git a/lib/mcollective/message.rb b/lib/mcollective/message.rb index f9b5e56..2b31717 100644 --- a/lib/mcollective/message.rb +++ b/lib/mcollective/message.rb @@ -139,7 +139,7 @@ module MCollective @requestid = request.payload[:requestid] @payload = PluginManager["security_plugin"].encodereply(agent, payload, requestid, request.payload[:callerid]) when :request, :direct_request - validate_compount_filter(@filter["compound"]) unless @filter["compound"].empty? + validate_compound_filter(@filter["compound"]) unless @filter["compound"].empty? @requestid = create_reqid unless @requestid @payload = PluginManager["security_plugin"].encoderequest(Config.instance.identity, payload, requestid, filter, agent, collective, ttl) @@ -148,7 +148,7 @@ module MCollective end end - def validate_compount_filter(compound_filter) + def validate_compound_filter(compound_filter) compound_filter.each do |filter| filter.each do |statement| if statement["fstatement"] @@ -156,11 +156,7 @@ module MCollective pluginname = Data.pluginname(functionname) value = statement["fstatement"]["value"] - begin - ddl = DDL.new(pluginname, :data) - rescue - raise DDLValidationError, "Could not find DDL for data plugin #{pluginname}, cannot use #{functionname}() in discovery" - end + ddl = DDL.new(pluginname, :data) # parses numbers and booleans entered as strings into proper # types of data so that DDL validation will pass @@ -169,7 +165,7 @@ module MCollective Data.ddl_validate(ddl, statement["fstatement"]["params"]) unless value && Data.ddl_has_output?(ddl, value) - raise DDLValidationError, "#{functionname}() does not return a #{value} value" + DDL.validation_fail!(:PLMC41, "Data plugin '%{functionname}()' does not return a '%{value}' value", :error, {:functionname => functionname, :value => value}) end end end @@ -215,21 +211,16 @@ module MCollective # publish a reply message by creating a target name and sending it def publish - Timeout.timeout(2) do - # If we've been specificaly told about hosts that were discovered - # use that information to do P2P calls if appropriate else just - # send it as is. - if @discovered_hosts && Config.instance.direct_addressing - if @discovered_hosts.size <= Config.instance.direct_addressing_threshold - self.type = :direct_request - Log.debug("Handling #{requestid} as a direct request") - end - - PluginManager["connector_plugin"].publish(self) - else - PluginManager["connector_plugin"].publish(self) - end + # If we've been specificaly told about hosts that were discovered + # use that information to do P2P calls if appropriate else just + # send it as is. + config = Config.instance + if @discovered_hosts && config.direct_addressing && (@discovered_hosts.size <= config.direct_addressing_threshold) + self.type = :direct_request + Log.debug("Handling #{requestid} as a direct request") end + + PluginManager['connector_plugin'].publish(self) end def create_reqid