Class: Shell

Inherits:
QuartzPlugin show all
Defined in:
lib/plugins/shell.rb

Constant Summary collapse

@@version_major =
0
@@version_minor =
0
@@version_revision =
1

Instance Method Summary collapse

Methods inherited from QuartzPlugin

#get_version, #initialize, #payload, #run_result, #run_shell

Constructor Details

This class inherits a constructor from QuartzPlugin

Instance Method Details

#infoObject



9
10
11
# File 'lib/plugins/shell.rb', line 9

def info
	{ :uid => "20e07c656e2f477d969e9561e13229fb", :name => "Shell", :version => get_version }
end

#run(message) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/plugins/shell.rb', line 13

def run(message)
	@log.debug "Running with #{message}"
	payload = payload(message)
	command = payload['command']
	@log.info "Shell command '#{command}"

	begin
		result = run_shell("#{command}")
		run_result(result[:ok], result[:message])
	rescue => ex
		run_result(false, "Failed to run shell command due to #{ex}")
	end
end