Permalink
Browse files

Make the :subject parameter optional as per the DDL

  • Loading branch information...
1 parent 7b5a3f5 commit 4bd93af7d3719593a1e14f2b19bb7544b1a808ea @ripienaar ripienaar committed Sep 20, 2010
Showing with 7 additions and 2 deletions.
  1. +7 −2 agent/naggernotify/naggernotify.rb
View
9 agent/naggernotify/naggernotify.rb
@@ -25,11 +25,16 @@ def startup_hook
action "sendmsg" do
validate :recipient, :shellsafe
validate :message, :shellsafe
- validate :subject, :shellsafe
+ validate :subject, :shellsafe if request.include?(:subject)
begin
nagger = Nagger::Config.new(@configfile, false)
- msg = Nagger::Message.new(request[:recipient], request[:message], request[:subject], "")
+
+ if request.include?(:subject)
+ msg = Nagger::Message.new(request[:recipient], request[:message], request[:subject], "")
+ else
+ msg = Nagger::Message.new(request[:recipient], request[:message], "", "")
+ end
unless nagger.plugins.include?(msg.recipient.protocol.capitalize)
reply.fail! "Don't know how to handle protocol #{msg.recipient.protocol.capitalize}"

0 comments on commit 4bd93af

Please sign in to comment.