# File lib/mcollective/message.rb, line 76 def type=(type) raise "Unknown message type #{type}" unless VALIDTYPES.include?(type) if type == :direct_request raise "Direct requests is not enabled using the direct_addressing config option" unless Config.instance.direct_addressing unless @discovered_hosts && !@discovered_hosts.empty? raise "Can only set type to :direct_request if discovered_hosts have been set" end # clear out the filter, custom discovery sources might interpret the filters # different than the remote mcollectived and in directed mode really the only # filter that matters is the agent filter @filter = Util.empty_filter @filter["agent"] << @agent end @type = type end