prometheus-splash 0.5.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/README.md +58 -60
  4. data/bin/splash +3 -0
  5. data/config/splash.yml +77 -7
  6. data/lib/splash/backends.rb +6 -0
  7. data/lib/splash/backends/file.rb +40 -0
  8. data/lib/splash/backends/redis.rb +47 -4
  9. data/lib/splash/cli.rb +18 -5
  10. data/lib/splash/cli/commands.rb +26 -18
  11. data/lib/splash/cli/config.rb +16 -2
  12. data/lib/splash/cli/daemon.rb +10 -3
  13. data/lib/splash/cli/documentation.rb +5 -2
  14. data/lib/splash/cli/logs.rb +25 -16
  15. data/lib/splash/cli/process.rb +103 -0
  16. data/lib/splash/cli/sequences.rb +114 -0
  17. data/lib/splash/cli/webadmin.rb +46 -0
  18. data/lib/splash/commands.rb +146 -122
  19. data/lib/splash/config.rb +166 -14
  20. data/lib/splash/config/flush.rb +30 -0
  21. data/lib/splash/config/sanitycheck.rb +7 -2
  22. data/lib/splash/config/service.rb +8 -1
  23. data/lib/splash/config/setup.rb +8 -3
  24. data/lib/splash/constants.rb +37 -8
  25. data/lib/splash/daemon.rb +6 -0
  26. data/lib/splash/{controller.rb → daemon/controller.rb} +34 -14
  27. data/lib/splash/daemon/metrics.rb +103 -0
  28. data/lib/splash/daemon/orchestrator.rb +182 -0
  29. data/lib/splash/daemon/orchestrator/grammar.rb +76 -0
  30. data/lib/splash/daemon/orchestrator/hooks.rb +28 -0
  31. data/lib/splash/dependencies.rb +16 -2
  32. data/lib/splash/exiter.rb +14 -0
  33. data/lib/splash/helpers.rb +84 -48
  34. data/lib/splash/loggers.rb +40 -13
  35. data/lib/splash/loggers/cli.rb +18 -3
  36. data/lib/splash/loggers/daemon.rb +14 -3
  37. data/lib/splash/loggers/dual.rb +35 -2
  38. data/lib/splash/loggers/web.rb +51 -0
  39. data/lib/splash/logs.rb +67 -54
  40. data/lib/splash/processes.rb +83 -0
  41. data/lib/splash/sequences.rb +105 -0
  42. data/lib/splash/templates.rb +10 -0
  43. data/lib/splash/transports.rb +9 -0
  44. data/lib/splash/transports/rabbitmq.rb +33 -4
  45. data/lib/splash/webadmin.rb +122 -0
  46. data/lib/splash/webadmin/api/routes/commands.rb +28 -0
  47. data/lib/splash/webadmin/api/routes/config.rb +10 -0
  48. data/lib/splash/webadmin/api/routes/init.rb +2 -0
  49. data/lib/splash/webadmin/api/routes/logs.rb +59 -0
  50. data/lib/splash/webadmin/api/routes/process.rb +60 -0
  51. data/lib/splash/webadmin/api/routes/sequences.rb +28 -0
  52. data/lib/splash/webadmin/main.rb +26 -0
  53. data/lib/splash/webadmin/portal/controllers/commands.rb +7 -0
  54. data/lib/splash/webadmin/portal/controllers/documentation.rb +6 -0
  55. data/lib/splash/webadmin/portal/controllers/home.rb +12 -0
  56. data/lib/splash/webadmin/portal/controllers/logs.rb +14 -0
  57. data/lib/splash/webadmin/portal/controllers/notfound.rb +5 -0
  58. data/lib/splash/webadmin/portal/controllers/processes.rb +14 -0
  59. data/lib/splash/webadmin/portal/controllers/proxy.rb +28 -0
  60. data/lib/splash/webadmin/portal/controllers/restclient.rb +19 -0
  61. data/lib/splash/webadmin/portal/controllers/sequences.rb +7 -0
  62. data/lib/splash/webadmin/portal/init.rb +11 -0
  63. data/lib/splash/webadmin/portal/public/css/ultragreen.css +8544 -0
  64. data/lib/splash/webadmin/portal/public/fonts/FontAwesome.otf +0 -0
  65. data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.ttf +0 -0
  66. data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.woff +0 -0
  67. data/lib/splash/webadmin/portal/public/fonts/fontawesome-webfont.woff2 +0 -0
  68. data/lib/splash/webadmin/portal/public/images/logo_splash.png +0 -0
  69. data/lib/splash/webadmin/portal/public/images/logo_splash_reduce.png +0 -0
  70. data/lib/splash/webadmin/portal/public/images/logo_splash_tiny.png +0 -0
  71. data/lib/splash/webadmin/portal/views/commands.slim +49 -0
  72. data/lib/splash/webadmin/portal/views/documentation.slim +3 -0
  73. data/lib/splash/webadmin/portal/views/home.slim +78 -0
  74. data/lib/splash/webadmin/portal/views/layout.slim +43 -0
  75. data/lib/splash/webadmin/portal/views/logs.slim +32 -0
  76. data/lib/splash/webadmin/portal/views/nav.slim +17 -0
  77. data/lib/splash/webadmin/portal/views/not_found.slim +3 -0
  78. data/lib/splash/webadmin/portal/views/processes.slim +29 -0
  79. data/lib/splash/webadmin/portal/views/proxy.slim +13 -0
  80. data/lib/splash/webadmin/portal/views/restclient.slim +41 -0
  81. data/lib/splash/webadmin/portal/views/restclient_result.slim +29 -0
  82. data/lib/splash/webadmin/portal/views/sequences.slim +50 -0
  83. data/prometheus-splash.gemspec +7 -1
  84. data/spec/helpers_spec.rb +119 -0
  85. data/templates/ansible-splash/roles/splash/handlers/main.yml +4 -0
  86. data/templates/ansible-splash/roles/splash/tasks/main.yml +24 -1
  87. data/templates/ansible-splash/roles/splash/templates/logrotate.splash.j2 +11 -0
  88. data/templates/ansible-splash/roles/splash/templates/splash.yml.j2 +1 -1
  89. metadata +145 -10
  90. data/lib/splash/orchestrator.rb +0 -100
  91. data/lib/splash/orchestrator/grammar.rb +0 -54
  92. data/lib/splash/orchestrator/hooks.rb +0 -16
@@ -1,12 +1,19 @@
1
1
  # coding: utf-8
2
+
3
+ # base Splash Module
2
4
  module Splash
5
+
6
+ # Templates namespace
3
7
  module Templates
4
8
 
5
9
  # KISS template Engine
6
10
  class Template
7
11
 
12
+ # getter of the list of token
8
13
  attr_reader :list_token
14
+ # getter of the template file
9
15
  attr_reader :template_file
16
+ # getter of the flat content of the template
10
17
  attr_reader :content
11
18
 
12
19
  # constructor : generate the pseudo accessor for template Class from token list
@@ -72,8 +79,11 @@ module Splash
72
79
 
73
80
  end
74
81
 
82
+ # Exception for an invalid Token list
75
83
  class InvalidTokenList < Exception; end
84
+ # Exception for an malformed token
76
85
  class NotAToken < Exception; end
86
+ # Exception for an invalid template file
77
87
  class NoTemplateFile < Exception; end
78
88
 
79
89
  end
@@ -1,9 +1,16 @@
1
1
  # coding: utf-8
2
2
 
3
+ # base Splash module
3
4
  module Splash
5
+
6
+ # Splash Transports namespace
4
7
  module Transports
5
8
  include Splash::Config
6
9
 
10
+
11
+ # factory for Splash::Transports::Rabbitmq::Subscriber
12
+ # @param [Hash] options
13
+ # @return [Splash::Transports::Rabbitmq::Subscriber|Hash] Subscriber or Exiter case :configuration_error
7
14
  def get_default_subscriber(options)
8
15
  config = get_config.transports
9
16
  transport = config[:active]
@@ -20,6 +27,8 @@ module Splash
20
27
  end
21
28
  end
22
29
 
30
+ # factory for Splash::Transports::Rabbitmq::Client
31
+ # @return [Splash::Transports::Rabbitmq::Client|Hash] Client or Exiter case :configuration_error
23
32
  def get_default_client
24
33
  config = get_config.transports
25
34
  transport = config[:active]
@@ -1,14 +1,24 @@
1
1
  # coding: utf-8
2
+
3
+ # base Splash module
2
4
  module Splash
5
+
6
+ # Splash Transports namespace
3
7
  module Transports
8
+
9
+ # RabbitMQ Transport
4
10
  module Rabbitmq
5
11
 
12
+ # Subscriber Mode RabbitMQ Client
6
13
  class Subscriber
7
14
  include Splash::Config
8
15
  extend Forwardable
9
16
 
10
17
  def_delegators :@queue, :subscribe
11
18
 
19
+ # Constructor Forward subscribe method and initialize a Bunny Client atribute @queue
20
+ # @param [Hash] options
21
+ # @option options [String] :queue the name of the subscribed queue
12
22
  def initialize(options = {})
13
23
  @config = get_config.transports
14
24
 
@@ -32,12 +42,13 @@ module Splash
32
42
 
33
43
  end
34
44
 
35
-
45
+ # publish / get Mode RabbitMQ Client
36
46
  class Client
37
47
  include Splash::Config
38
48
  include Splash::Transports
39
49
  include Splash::Loggers
40
50
 
51
+ # Constructor initialize a Bunny Client
41
52
  def initialize
42
53
  @config = get_config.transports
43
54
  host = @config[:rabbitmq][:host]
@@ -48,7 +59,7 @@ module Splash
48
59
  conf = { :host => host, :vhost => vhost, :user => user, :password => passwd, :port => port.to_i}
49
60
 
50
61
  begin
51
- @connection = Bunny.new conf
62
+ @connection = Bunny.new conf
52
63
  @connection.start
53
64
  @channel = @connection.create_channel
54
65
  rescue Bunny::Exception
@@ -56,19 +67,32 @@ module Splash
56
67
  end
57
68
  end
58
69
 
59
-
70
+ # purge a queue
71
+ # @param [Hash] options
72
+ # @option options [String] :queue the name of the queue to purge
60
73
  def purge(options)
61
74
  @channel.queue(options[:queue]).purge
62
75
  end
63
76
 
77
+ # publish to a queue
78
+ # @param [Hash] options
79
+ # @option options [String] :queue the name of the queue to purge
80
+ # @option options [String] :message the message to send
64
81
  def publish(options ={})
65
82
  return @channel.default_exchange.publish(options[:message], :routing_key => options[:queue])
66
83
  end
67
84
 
85
+ # ack a specific message for manual ack with a delivery tag to a queue
86
+ # @param [String] ack
87
+ # @return [Boolean]
68
88
  def ack(ack)
69
89
  return @channel.acknowledge(ack, false)
70
90
  end
71
91
 
92
+
93
+ # send an execution order message (verb+payload) via RabbitMQ to an slash input queue
94
+ # @param [Hash] order
95
+ # @return [Void] unserialized Void object from YAML
72
96
  def execute(order)
73
97
  queue = order[:return_to]
74
98
  lock = Mutex.new
@@ -76,7 +100,6 @@ module Splash
76
100
  condition = ConditionVariable.new
77
101
  get_default_subscriber(queue: queue).subscribe do |delivery_info, properties, payload|
78
102
  res = YAML::load(payload)
79
-
80
103
  lock.synchronize { condition.signal }
81
104
  end
82
105
  get_logger.send "Verb : #{order[:verb].to_s} to queue : #{order[:queue]}."
@@ -85,6 +108,11 @@ module Splash
85
108
  return res
86
109
  end
87
110
 
111
+ # Get a message from a RabbitMQ queue
112
+ # @param [Hash] options
113
+ # @option options [String] :queue the name of the queue to query
114
+ # @option options [String] :manual_ack flag to inhibit ack
115
+ # @return [Hash] Payload + ack tag if :manual_ack
88
116
  def get(options ={})
89
117
  queue = @channel.queue(options[:queue])
90
118
  opt = {}; opt[:manual_ack] = (options[:manual_ack])? true : false
@@ -94,6 +122,7 @@ module Splash
94
122
  return res
95
123
  end
96
124
 
125
+ # close the RabbitMQ connection
97
126
  def close
98
127
  @connection.close
99
128
  end
@@ -0,0 +1,122 @@
1
+ # coding: utf-8
2
+
3
+
4
+
5
+ # base Splash module
6
+ module Splash
7
+
8
+ # global daemon module
9
+ module WebAdmin
10
+
11
+ # Daemon Controller Module
12
+ module Controller
13
+ include Splash::Constants
14
+ include Splash::Helpers
15
+ include Splash::Config
16
+ include Splash::Exiter
17
+ include Splash::Loggers
18
+
19
+
20
+ # Start the Splash Daemon
21
+ # @param [Hash] options
22
+ # @option options [Symbol] :quiet activate quiet mode for log (limit to :fatal)
23
+ # @return [Hash] Exiter Case (:quiet_exit, :already_exist, :unknown_error or other)
24
+ def startdaemon(options = {})
25
+ require 'splash/webadmin/main'
26
+ config = get_config
27
+ log = get_logger
28
+ log.level = :fatal if options[:quiet]
29
+ realpid = get_processes pattern: get_config.webadmin_process_name
30
+
31
+
32
+ unless File::exist? config.webadmin_full_pid_path then
33
+ unless realpid.empty? then
34
+ return {:case => :already_exist, :more => "Splash WebAdmin Process already launched "}
35
+ end
36
+
37
+ daemon_config = {:description => config.webadmin_process_name,
38
+ :pid_file => config.webadmin_full_pid_path,
39
+ :stdout_trace => config.webadmin_full_stdout_trace_path,
40
+ :stderr_trace => config.webadmin_full_stderr_trace_path
41
+ }
42
+
43
+ ["int","term","hup"].each do |type| daemon_config["sig#{type}_handler".to_sym] = Proc::new { WebAdminApp.quit! } end
44
+ res = daemonize daemon_config do
45
+ log = get_logger logger: :web, force: true
46
+ log.info "Starting Splash WebAdmin"
47
+ WebAdminApp.run!
48
+ end
49
+ sleep 1
50
+ if res == 0 then
51
+ pid = `cat #{config.webadmin_full_pid_path}`.to_i
52
+ log.ok "Splash WebAdmin Started, with PID : #{pid}"
53
+ return {:case => :quiet_exit, :more => "Splash WebAdmin successfully loaded."}
54
+ else
55
+ return {:case => :unknown_error, :more => "Splash WebAdmin loading error, see logs for more details."}
56
+ end
57
+
58
+ else
59
+ return {:case => :already_exist, :more => "Pid File, please verify if Splash WebAdmin is running."}
60
+ end
61
+ end
62
+
63
+ # Stop the Splash WebAdmin
64
+ # @param [Hash] options
65
+ # @option options [Symbol] :quiet activate quiet mode for log (limit to :fatal)
66
+ # @return [Hash] Exiter Case (:quiet_exit, :not_found, other)
67
+ def stopdaemon(options = {})
68
+ config = get_config
69
+ log = get_logger
70
+ log.level = :fatal if options[:quiet]
71
+ if File.exist?(config.webadmin_full_pid_path) then
72
+ begin
73
+ pid = `cat #{config.webadmin_full_pid_path}`.to_i
74
+ Process.kill("TERM", pid)
75
+ acase = {:case => :quiet_exit, :more => 'Splash WebAdmin stopped succesfully'}
76
+ rescue Errno::ESRCH
77
+ acase = {:case => :not_found, :more => "Process of PID : #{pid} not found"}
78
+ end
79
+ FileUtils::rm config.webadmin_full_pid_path if File::exist? config.webadmin_full_pid_path
80
+ else
81
+ acase = {:case => :not_found, :more => "Splash WebAdmin is not running"}
82
+ end
83
+ return acase
84
+ end
85
+
86
+ # Status of the Splash WebAdmin, display status
87
+ # @param [Hash] options ignored
88
+ # @return [Hash] Exiter Case (:status_ko, :status_ok)
89
+ def statusdaemon(options = {})
90
+ log = get_logger
91
+ config = get_config
92
+ pid = realpid = ''
93
+ pid = `cat #{config.webadmin_full_pid_path}`.to_s if File.exist?(config.webadmin_full_pid_path)
94
+ listpid = get_processes({ :pattern => get_config.webadmin_process_name})
95
+ pid.chomp!
96
+ if listpid.empty? then
97
+ realpid = ''
98
+ else
99
+ realpid = listpid.first
100
+ end
101
+ unless realpid.empty? then
102
+ log.item "Splash WebAdmin Process is running with PID #{realpid} "
103
+ else
104
+ log.item 'Splash WebAdminProcess not found '
105
+ end
106
+ unless pid.empty? then
107
+ log.item "and PID file exist with PID #{pid}"
108
+ else
109
+ log.item "and PID file don't exist"
110
+ end
111
+ if pid == realpid then
112
+ return {:case => :status_ok }
113
+ elsif pid.empty? then
114
+ return {:case => :status_ko, :more => "PID File error, you have to kill process manualy, with : '(sudo )kill -TERM #{realpid}'"}
115
+ elsif realpid.empty? then
116
+ return {:case => :status_ko, :more => "Process Splash WebAdmin missing, run 'splash webadmin stop' before reload properly"}
117
+ end
118
+ end
119
+
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,28 @@
1
+
2
+
3
+
4
+
5
+ WebAdminApp.get '/api/commands/list.?:format?' do
6
+ log = get_logger
7
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
8
+ log.call "api : commands, verb : GET, route : list, format : #{format}"
9
+ obj = splash_return case: :quiet_exit, :more => "Commands list"
10
+ obj[:data] = get_config.commands
11
+ content_type format
12
+ format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
13
+ end
14
+
15
+ WebAdminApp.get '/api/commands/show/:name.?:format?' do
16
+ log = get_logger
17
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
18
+ log.call "api : commands, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
19
+ commands_recordset = get_config.commands[params[:name].to_sym]
20
+ unless commands_recordset.nil? then
21
+ obj = splash_return case: :quiet_exit
22
+ obj[:data] = commands_recordset
23
+ else
24
+ obj = splash_return case: :not_found, :more => "Command not configured"
25
+ end
26
+ content_type format
27
+ format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
28
+ end
@@ -0,0 +1,10 @@
1
+ WebAdminApp.get '/api/config/full.?:format?' do
2
+ log = get_logger
3
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
4
+ log.call "api : config, verb : GET, route : show, format : #{format}"
5
+ config = get_config.full
6
+ obj = splash_return case: :quiet_exit, :more => "logses list"
7
+ obj[:data] = config
8
+ content_type format
9
+ format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
10
+ end
@@ -0,0 +1,2 @@
1
+ # encoding: UTF-8
2
+ Dir[File.dirname(__FILE__) + '/*.rb'].each {|file| require file unless File.basename(file) == 'init.rb'}
@@ -0,0 +1,59 @@
1
+
2
+
3
+
4
+
5
+ WebAdminApp.get '/api/logs/list.?:format?' do
6
+ log = get_logger
7
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
8
+ log.call "api : logs, verb : GET, route : list, format : #{format}"
9
+ logs_recordset = get_config.logs
10
+ obj = splash_return case: :quiet_exit, :more => "logses list"
11
+ obj[:data] = logs_recordset
12
+ content_type format
13
+ format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
14
+ end
15
+
16
+ WebAdminApp.get '/api/logs/show/:name.?:format?' do
17
+ log = get_logger
18
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
19
+ log.call "api : logs, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
20
+ logs_recordset = get_config.logs.select{|item| item[:label] == params[:name].to_sym }
21
+ unless logs_recordset.empty? then
22
+ record = logs_recordset.first
23
+ obj = splash_return case: :quiet_exit
24
+ obj[:data] = record
25
+ else
26
+ obj = splash_return case: :not_found, :more => "logs not configured"
27
+ end
28
+ format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
29
+ end
30
+
31
+ WebAdminApp.post '/api/logs/analyse.?:format?' do
32
+ log = get_logger
33
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
34
+ log.call "api : logs, verb : POST, route : analyse, format : #{format}"
35
+ results = Splash::Logs::LogScanner::new
36
+ results.analyse
37
+ res = results.output
38
+ obj = splash_return case: :quiet_exit, :more => "logs analyse report"
39
+ obj[:data] = res
40
+ status 201
41
+ content_type format
42
+ format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
43
+ end
44
+
45
+ WebAdminApp.post '/api/logs/monitor.?:format?' do
46
+ log = get_logger
47
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
48
+ log.call "api : logs, verb : POST, route : monitor, format : #{format}"
49
+ results = Splash::Logs::LogScanner::new
50
+ results.analyse
51
+ res = splash_return results.notify
52
+ if res[:status] == :failure then
53
+ status 503
54
+ else
55
+ status 201
56
+ end
57
+ content_type format
58
+ format_response(res, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
59
+ end
@@ -0,0 +1,60 @@
1
+
2
+
3
+
4
+
5
+ WebAdminApp.get '/api/process/list.?:format?' do
6
+ log = get_logger
7
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
8
+ log.call "api : process, verb : GET, route : list, format : #{format}"
9
+ process_recordset = get_config.processes
10
+ obj = splash_return case: :quiet_exit, :more => "Processes list"
11
+ obj[:data] = process_recordset
12
+ content_type format
13
+ format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
14
+ end
15
+
16
+ WebAdminApp.get '/api/process/show/:name.?:format?' do
17
+ log = get_logger
18
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
19
+ log.call "api : process, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
20
+ process_recordset = get_config.processes.select{|item| item[:process] == params[:name] }
21
+ unless process_recordset.empty? then
22
+ record = process_recordset.first
23
+ obj = splash_return case: :quiet_exit
24
+ obj[:data] = record
25
+ else
26
+ obj = splash_return case: :not_found, :more => "Process not configured"
27
+ end
28
+ content_type format
29
+ format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
30
+ end
31
+
32
+ WebAdminApp.post '/api/process/analyse.?:format?' do
33
+ log = get_logger
34
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
35
+ log.call "api : process, verb : POST, route : analyse, format : #{format}"
36
+ results = Splash::Processes::ProcessScanner::new
37
+ results.analyse
38
+ res = results.output
39
+ obj = splash_return case: :quiet_exit, :more => "Process analyse report"
40
+ obj[:data] = res
41
+ status 201
42
+ content_type format
43
+ format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
44
+ end
45
+
46
+ WebAdminApp.post '/api/process/monitor.?:format?' do
47
+ log = get_logger
48
+ format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
49
+ log.call "api : process, verb : POST, route : monitor, format : #{format}"
50
+ results = Splash::Processes::ProcessScanner::new
51
+ results.analyse
52
+ res = splash_return results.notify
53
+ if res[:status] == :failure then
54
+ status 503
55
+ else
56
+ status 201
57
+ end
58
+ content_type format
59
+ format_response(res, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
60
+ end