prometheus-splash 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -4
- data/README.md +400 -178
- data/config/splash.yml +1 -1
- data/lib/splash/backends.rb +7 -1
- data/lib/splash/backends/file.rb +1 -1
- data/lib/splash/cli/commands.rb +22 -58
- data/lib/splash/cli/config.rb +12 -1
- data/lib/splash/cli/logs.rb +34 -2
- data/lib/splash/cli/process.rb +33 -0
- data/lib/splash/config.rb +11 -8
- data/lib/splash/config/flush.rb +2 -2
- data/lib/splash/constants.rb +1 -1
- data/lib/splash/logs.rb +5 -1
- data/lib/splash/processes.rb +4 -0
- data/lib/splash/webadmin/api/routes/config.rb +50 -8
- data/lib/splash/webadmin/api/routes/process.rb +21 -9
- data/lib/splash/webadmin/main.rb +2 -0
- data/lib/splash/webadmin/portal/controllers/logs.rb +15 -2
- data/lib/splash/webadmin/portal/controllers/processes.rb +60 -4
- data/lib/splash/webadmin/portal/views/{logs_form.slim → log_form.slim} +0 -0
- data/lib/splash/webadmin/portal/views/log_history.slim +24 -0
- data/lib/splash/webadmin/portal/views/logs.slim +26 -1
- data/lib/splash/webadmin/portal/views/process_form.slim +21 -0
- data/lib/splash/webadmin/portal/views/process_history.slim +24 -0
- data/lib/splash/webadmin/portal/views/processes.slim +72 -2
- data/prometheus-splash.gemspec +1 -1
- metadata +12 -9
data/config/splash.yml
CHANGED
data/lib/splash/backends.rb
CHANGED
@@ -11,7 +11,7 @@ module Splash
|
|
11
11
|
|
12
12
|
# factory for backend
|
13
13
|
# @param [Symbol] store the name of the store actually in [:execution_trace]
|
14
|
-
# @return [Splash::Backends::<Type>|Hash] with type in [:redis,:file] or Exiter case :configuration_error
|
14
|
+
# @return [Splash::Backends::<Type>|Hash] with type in [:redis,:file] or Exiter case :configuration_error
|
15
15
|
def get_backend(store)
|
16
16
|
splash_exit case: :configuration_error, more: "backend definition failure" if get_config[:backends][:stores][store].nil?
|
17
17
|
backend = get_config[:backends][:stores][store][:type].to_s
|
@@ -23,5 +23,11 @@ module Splash
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
# return list of configured backand
|
27
|
+
# @return [Hash] the backends hash list/structure
|
28
|
+
def list_backends
|
29
|
+
return get_config[:backends][:stores]
|
30
|
+
end
|
31
|
+
|
26
32
|
end
|
27
33
|
end
|
data/lib/splash/backends/file.rb
CHANGED
@@ -54,7 +54,7 @@ module Splash
|
|
54
54
|
# @option options [Symbol] :key the name of the record
|
55
55
|
# @return [Boolean] status of the operation
|
56
56
|
def del(options)
|
57
|
-
::File.unlink("#{@path}/#{suffix_trace(options[:key])}") if File.exist?("#{@path}/#{suffix_trace(options[:key])}")
|
57
|
+
::File.unlink("#{@path}/#{suffix_trace(options[:key])}") if ::File.exist?("#{@path}/#{suffix_trace(options[:key])}")
|
58
58
|
end
|
59
59
|
|
60
60
|
# verifiy a specific record existance
|
data/lib/splash/cli/commands.rb
CHANGED
@@ -15,7 +15,7 @@ module CLISplash
|
|
15
15
|
|
16
16
|
|
17
17
|
# Thor method : execution of command
|
18
|
-
desc "execute
|
18
|
+
desc "execute COMMAND", "run for command/sequence or ack result"
|
19
19
|
long_desc <<-LONGDESC
|
20
20
|
execute command or sequence or ack result\n
|
21
21
|
with --no-trace prevent storing execution trace in configured backend (see config file)\n
|
@@ -79,7 +79,7 @@ module CLISplash
|
|
79
79
|
|
80
80
|
|
81
81
|
# Thor method : scheduling commands
|
82
|
-
desc "schedule
|
82
|
+
desc "schedule COMMAND", "Schedule excution of command on Splash daemon"
|
83
83
|
long_desc <<-LONGDESC
|
84
84
|
Schedule excution of command on Splash daemon\n
|
85
85
|
with --hostname, Schedule on an other Splash daemon via transport\n
|
@@ -125,7 +125,7 @@ module CLISplash
|
|
125
125
|
end
|
126
126
|
|
127
127
|
# Thor method : getting a treeview of sequence of commands
|
128
|
-
desc "treeview", "Show commands sequence tree"
|
128
|
+
desc "treeview COMMAND", "Show commands sequence tree"
|
129
129
|
long_desc <<-LONGDESC
|
130
130
|
Show commands sequence tree\n
|
131
131
|
with --hostname, ask other Splash daemon via transport\n
|
@@ -284,11 +284,11 @@ module CLISplash
|
|
284
284
|
show commands executions history for LABEL\n
|
285
285
|
LONGDESC
|
286
286
|
option :table, :type => :boolean, :aliases => "-t"
|
287
|
-
desc "history
|
287
|
+
desc "history COMMAND", "show commands executions history"
|
288
288
|
def history(command)
|
289
289
|
if is_root? then
|
290
290
|
log = get_logger
|
291
|
-
log.info "
|
291
|
+
log.info "Command : #{command}"
|
292
292
|
config = get_config
|
293
293
|
if options[:table] then
|
294
294
|
table = TTY::Table.new do |t|
|
@@ -328,52 +328,8 @@ module CLISplash
|
|
328
328
|
end
|
329
329
|
end
|
330
330
|
|
331
|
-
# Thor method : getting information on the last execution of a command
|
332
|
-
desc "lastrun COMMAND", "Show last running result for specific configured command COMMAND"
|
333
|
-
long_desc <<-LONGDESC
|
334
|
-
Show last running result for specific configured command COMMAND\n
|
335
|
-
with --hostname <HOSTNAME>, an other Splash monitored server (only with Redis backend configured)
|
336
|
-
LONGDESC
|
337
|
-
option :hostname, :type => :string, :aliases => "-H"
|
338
|
-
def lastrun(command)
|
339
|
-
unless is_root? then
|
340
|
-
splash_exit case: :not_root, :more => "Command last execution report"
|
341
|
-
end
|
342
|
-
log = get_logger
|
343
|
-
backend = get_backend :execution_trace
|
344
|
-
redis = (backend.class == Splash::Backends::Redis)? true : false
|
345
|
-
if not redis and options[:hostname] then
|
346
|
-
splash_exit case: :specific_config_required, :more => "Redis backend is requiered for Remote execution report request"
|
347
|
-
end
|
348
|
-
splash_exit case: :not_root if not is_root? and not redis
|
349
|
-
list = get_config.commands.keys
|
350
|
-
if options[:hostname] then
|
351
|
-
options[:hostname] = Socket.gethostname if options[:hostname] == 'hostname'
|
352
|
-
list = backend.list("*", options[:hostname]).map(&:to_sym)
|
353
|
-
end
|
354
|
-
if list.include? command.to_sym then
|
355
|
-
log.info "Splash command #{command} previous execution report:\n"
|
356
|
-
req = { :key => command}
|
357
|
-
req[:hostname] = options[:hostname] if options[:hostname]
|
358
|
-
if backend.exist? req then
|
359
|
-
res = backend.get req
|
360
|
-
tp = Template::new(
|
361
|
-
list_token: get_config.execution_template_tokens,
|
362
|
-
template_file: get_config.execution_template_path)
|
363
|
-
tp.map YAML::load(res).last.values.first
|
364
|
-
log.flat tp.output
|
365
|
-
else
|
366
|
-
log.ko "Command not already runned."
|
367
|
-
end
|
368
|
-
splash_exit case: :quiet_exit
|
369
|
-
else
|
370
|
-
splash_exit case: :not_found, :more => "Command report never runned remotly" if options[:hostname]
|
371
|
-
end
|
372
|
-
end
|
373
|
-
|
374
|
-
|
375
331
|
# Thor method : getting information on one specific execution of a command
|
376
|
-
desc "
|
332
|
+
desc "get_result COMMAND", "Show running result for specific configured command COMMAND"
|
377
333
|
long_desc <<-LONGDESC
|
378
334
|
Show specific running result for specific configured command COMMAND\n
|
379
335
|
with --hostname <HOSTNAME>, an other Splash monitored server (only with Redis backend configured)
|
@@ -381,8 +337,8 @@ module CLISplash
|
|
381
337
|
|
382
338
|
LONGDESC
|
383
339
|
option :hostname, :type => :string, :aliases => "-H"
|
384
|
-
option :date, :type => :string, :aliases => "-D"
|
385
|
-
def
|
340
|
+
option :date, :type => :string, :aliases => "-D"
|
341
|
+
def get_result(command)
|
386
342
|
unless is_root? then
|
387
343
|
splash_exit case: :not_root, :more => "Command specific execution report"
|
388
344
|
end
|
@@ -407,11 +363,15 @@ module CLISplash
|
|
407
363
|
tp = Template::new(
|
408
364
|
list_token: get_config.execution_template_tokens,
|
409
365
|
template_file: get_config.execution_template_path)
|
410
|
-
|
411
|
-
|
366
|
+
if options[:date] then
|
367
|
+
prov = YAML::load(res).select{|key,value| key.keys.first == options[:date]}.first
|
368
|
+
else
|
369
|
+
prov = YAML::load(res).last
|
370
|
+
end
|
371
|
+
if prov.nil? then
|
412
372
|
log.ko "Command not runned one this date or date misformatted."
|
413
373
|
else
|
414
|
-
tp.map prov.
|
374
|
+
tp.map prov.values.first
|
415
375
|
log.flat tp.output
|
416
376
|
end
|
417
377
|
else
|
@@ -419,12 +379,16 @@ module CLISplash
|
|
419
379
|
end
|
420
380
|
splash_exit case: :quiet_exit
|
421
381
|
else
|
422
|
-
|
382
|
+
if options[:hostname]
|
383
|
+
splash_exit case: :not_found, :more => "Command never runned remotly"
|
384
|
+
else
|
385
|
+
splash_exit case: :not_found, :more => "Command never runned"
|
386
|
+
end
|
423
387
|
end
|
424
388
|
end
|
425
389
|
|
426
390
|
# Thor method : getting the list of avaibles executions reports
|
427
|
-
desc "
|
391
|
+
desc "reportlist", "list all executions report results "
|
428
392
|
long_desc <<-LONGDESC
|
429
393
|
list all executions report results\n
|
430
394
|
with --pattern <SEARCH>, search type string, wilcard * (group) ? (char)\n
|
@@ -437,7 +401,7 @@ module CLISplash
|
|
437
401
|
option :hostname, :type => :string, :aliases => "-H"
|
438
402
|
option :all, :type => :boolean, :negate => false, :aliases => "-A"
|
439
403
|
option :detail, :type => :boolean, :aliases => "-D"
|
440
|
-
def
|
404
|
+
def reportlist
|
441
405
|
unless is_root? then
|
442
406
|
splash_exit case: :not_root, :more => "Command execution report list"
|
443
407
|
end
|
data/lib/splash/cli/config.rb
CHANGED
@@ -9,6 +9,7 @@ module CLISplash
|
|
9
9
|
include Splash::Helpers
|
10
10
|
include Splash::Exiter
|
11
11
|
include Splash::Loggers
|
12
|
+
include Splash::Backends
|
12
13
|
|
13
14
|
# Thor method : running of Splash setup
|
14
15
|
desc "setup", "Setup installation fo Splash"
|
@@ -49,8 +50,18 @@ module CLISplash
|
|
49
50
|
|
50
51
|
# Thor method : flushing configured backend
|
51
52
|
desc "flushbackend", "Flush configured backend"
|
53
|
+
option :name, :type => :string, :aliases => "-N"
|
52
54
|
def flushbackend
|
53
|
-
|
55
|
+
if options[:name] then
|
56
|
+
acase = run_as_root :flush_backend, options
|
57
|
+
else
|
58
|
+
return_cases = {}
|
59
|
+
list_backends.each do |key,value|
|
60
|
+
return_cases[key] = run_as_root :flush_backend, { :name => key }
|
61
|
+
end
|
62
|
+
errors = return_cases.select {|key,value| value[:case] != :quiet_exit}.keys
|
63
|
+
acase = (errors.empty?)? {:case => :quiet_exit, :more => "All backends flushed successfully"}: {:case => :configuration_error, :more => "Backends #{errors.join(',')} flushing failed"}
|
64
|
+
end
|
54
65
|
splash_exit acase
|
55
66
|
end
|
56
67
|
|
data/lib/splash/cli/logs.rb
CHANGED
@@ -63,10 +63,10 @@ module CLISplash
|
|
63
63
|
end
|
64
64
|
|
65
65
|
|
66
|
-
|
66
|
+
|
67
67
|
|
68
68
|
# Thor method : display a specific Splash configured log monitor
|
69
|
-
desc "show
|
69
|
+
desc "show LABEL", "show Splash configured log monitoring for LOG"
|
70
70
|
def show(logrecord)
|
71
71
|
if is_root? then
|
72
72
|
log = get_logger
|
@@ -110,6 +110,38 @@ module CLISplash
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
# Thor method : display the full list of Splash configured log monitors
|
114
|
+
desc "get_result LABEL", "Get last or specific log monitoring report"
|
115
|
+
long_desc <<-LONGDESC
|
116
|
+
Get last or specific log monitoring report\n
|
117
|
+
with --date <DATE>, a date format string (same as in history ouput)
|
118
|
+
LONGDESC
|
119
|
+
option :date, :type => :string, :aliases => "-D"
|
120
|
+
def get_result(label)
|
121
|
+
if is_root? then
|
122
|
+
log = get_logger
|
123
|
+
log.info "Log : #{label}"
|
124
|
+
config = get_config
|
125
|
+
records = LogsRecords::new(label).get_all_records
|
126
|
+
if options[:date] then
|
127
|
+
wanted = records.select{|key,value| key.keys.first == options[:date]}.first
|
128
|
+
else
|
129
|
+
wanted = records.last
|
130
|
+
end
|
131
|
+
if wanted.nil? then
|
132
|
+
splash_exit case: :not_found, more: "Log never monitored"
|
133
|
+
else
|
134
|
+
record =wanted.keys.first
|
135
|
+
value=wanted[record]
|
136
|
+
log.item record
|
137
|
+
log.arrow "Status : #{value[:status].to_s}"
|
138
|
+
log.arrow "nb files : #{value[:errors]}"
|
139
|
+
log.arrow "nb lines : #{value[:lines]}"
|
140
|
+
end
|
141
|
+
else
|
142
|
+
splash_exit case: :not_root, :more => "Log get result"
|
143
|
+
end
|
144
|
+
end
|
113
145
|
|
114
146
|
# Thor method : show logs monitoring history
|
115
147
|
long_desc <<-LONGDESC
|
data/lib/splash/cli/process.rb
CHANGED
@@ -114,6 +114,39 @@ module CLISplash
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
# Thor method : display the full list of Splash configured process monitors
|
118
|
+
desc "get_result PROCESS", "Get last or specific process monitoring report"
|
119
|
+
long_desc <<-LONGDESC
|
120
|
+
Get last or specific process monitoring report\n
|
121
|
+
with --date <DATE>, a date format string (same as in history ouput)
|
122
|
+
LONGDESC
|
123
|
+
option :date, :type => :string, :aliases => "-D"
|
124
|
+
def get_result(process)
|
125
|
+
if is_root? then
|
126
|
+
log = get_logger
|
127
|
+
log.info "Process : #{process}"
|
128
|
+
config = get_config
|
129
|
+
records = ProcessRecords::new(process).get_all_records
|
130
|
+
if options[:date] then
|
131
|
+
wanted = records.select{|key,value| key.keys.first == options[:date]}.first
|
132
|
+
else
|
133
|
+
wanted = records.last
|
134
|
+
end
|
135
|
+
if wanted.nil? then
|
136
|
+
splash_exit case: :not_found, more: "Process never monitored"
|
137
|
+
else
|
138
|
+
record =wanted.keys.first
|
139
|
+
value=wanted[record]
|
140
|
+
log.item record
|
141
|
+
log.arrow "Status : #{value[:status].to_s}"
|
142
|
+
log.arrow "CPU Percent : #{value[:cpu_percent]}"
|
143
|
+
log.arrow "MEM Percent : #{value[:mem_percent]}"
|
144
|
+
end
|
145
|
+
else
|
146
|
+
splash_exit case: :not_root, :more => "Process get result"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
117
150
|
|
118
151
|
# Thor method : show logs monitoring history
|
119
152
|
long_desc <<-LONGDESC
|
data/lib/splash/config.rb
CHANGED
@@ -13,8 +13,10 @@ module Splash
|
|
13
13
|
|
14
14
|
class ConfigLinter
|
15
15
|
def initialize
|
16
|
-
@lints_present = {:logs => [:label, :log, :pattern ]
|
17
|
-
|
16
|
+
@lints_present = {:logs => [:label, :log, :pattern ],
|
17
|
+
:processes => [:process, :patterns ]}
|
18
|
+
@lints_types = {:logs => {:label => Symbol, :log => String, :pattern => String, :retention => Hash},
|
19
|
+
:processes => {:process => Symbol, :patterns => Array, :retention => Hash}}
|
18
20
|
end
|
19
21
|
|
20
22
|
def verify(options ={})
|
@@ -97,15 +99,16 @@ module Splash
|
|
97
99
|
end
|
98
100
|
|
99
101
|
|
100
|
-
def
|
102
|
+
def add_record(options = {})
|
101
103
|
@config_from_file = readconf @config_file
|
104
|
+
key = options[:key]
|
102
105
|
res = ConfigLinter::new.verify(options)
|
103
106
|
if res[:status] == :success then
|
104
|
-
if @config_from_file[:
|
107
|
+
if @config_from_file[options[:type]].select{|item| item[options[:key]] == options[:record][options[:key]]}.count > 0 then
|
105
108
|
return {:status => :already_exist}
|
106
109
|
else
|
107
110
|
res[:useless].each {|item| options[:record].delete item} if options[:clean]
|
108
|
-
@config_from_file[:
|
111
|
+
@config_from_file[options[:type]].push options[:record]
|
109
112
|
writeconf
|
110
113
|
hash_config_to_default
|
111
114
|
return {:status => :success}
|
@@ -116,12 +119,12 @@ module Splash
|
|
116
119
|
end
|
117
120
|
|
118
121
|
|
119
|
-
def
|
122
|
+
def delete_record(options = {})
|
120
123
|
@config_from_file = readconf @config_file
|
121
|
-
unless @config_from_file[:
|
124
|
+
unless @config_from_file[options[:type]].select{|item| item[options[:key]] == options[options[:key]]}.count > 0 then
|
122
125
|
return {:status => :not_found}
|
123
126
|
else
|
124
|
-
@config_from_file[:
|
127
|
+
@config_from_file[options[:type]].delete_if {|value| options[options[:key]] == value[options[:key]] }
|
125
128
|
writeconf
|
126
129
|
hash_config_to_default
|
127
130
|
return {:status => :success}
|
data/lib/splash/config/flush.rb
CHANGED
@@ -16,8 +16,8 @@ module Splash
|
|
16
16
|
self.extend Splash::Backends
|
17
17
|
self.extend Splash::Loggers
|
18
18
|
log = get_logger
|
19
|
-
|
20
|
-
|
19
|
+
name = (options[:name])? options[:name].to_sym : :execution_trace
|
20
|
+
log.info "Splash backend #{name.to_s} flushing"
|
21
21
|
backend = get_backend name
|
22
22
|
if backend.flush then
|
23
23
|
return { :case => :quiet_exit, :more => "Splash backend #{name.to_s} flushed" }
|
data/lib/splash/constants.rb
CHANGED
data/lib/splash/logs.rb
CHANGED
@@ -48,6 +48,10 @@ module Splash
|
|
48
48
|
@backend = get_backend :logs_trace
|
49
49
|
end
|
50
50
|
|
51
|
+
def clear
|
52
|
+
@backend.del({:key => @name}) if @backend.exist?({key: @name})
|
53
|
+
end
|
54
|
+
|
51
55
|
def purge(retention)
|
52
56
|
retention = {} if retention.nil?
|
53
57
|
if retention.include? :hours then
|
@@ -132,7 +136,7 @@ module Splash
|
|
132
136
|
logsrec = LogsRecords::new item[:label]
|
133
137
|
errors = (item[:count])? item[:count] : 0
|
134
138
|
lines = (item[:lines])? item[:lines] : 0
|
135
|
-
missing = (item[:status]
|
139
|
+
missing = (item[:status] == :missing)? 1 : 0
|
136
140
|
file = item[:log]
|
137
141
|
logsrec.purge(item[:retention])
|
138
142
|
logsrec.add_record :status => item[:status],
|
data/lib/splash/processes.rb
CHANGED
@@ -27,35 +27,77 @@ WebAdminApp.post '/api/config/addlog.?:format?' do
|
|
27
27
|
addlog = {}
|
28
28
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
29
29
|
log.call "API : config, verb : POST, route : addlog, format : #{format}"
|
30
|
-
res = get_config.
|
30
|
+
res = get_config.add_record :record => YAML::load(request.body.read), :key => :label, :type => :logs, :clean => true
|
31
31
|
case res[:status]
|
32
32
|
when :success
|
33
|
-
addlog = splash_return case: :quiet_exit, :more => "add
|
33
|
+
addlog = splash_return case: :quiet_exit, :more => "add log done"
|
34
34
|
when :already_exist
|
35
|
-
addlog = splash_return case: :already_exist, :more => "add
|
35
|
+
addlog = splash_return case: :already_exist, :more => "add log twice nto allowed"
|
36
36
|
when :failure
|
37
|
-
addlog = splash_return case: :configuration_error, :more => "add
|
37
|
+
addlog = splash_return case: :configuration_error, :more => "add log failed"
|
38
38
|
addlog[:data] = res
|
39
39
|
end
|
40
40
|
content_type format
|
41
41
|
format_response(addlog, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
42
42
|
end
|
43
43
|
|
44
|
+
WebAdminApp.post '/api/config/addprocess.?:format?' do
|
45
|
+
log = get_logger
|
46
|
+
addprocess = {}
|
47
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
48
|
+
log.call "API : config, verb : POST, route : addprocess, format : #{format}"
|
49
|
+
res = get_config.add_record :record => YAML::load(request.body.read), :type => :processes, :key => :process, :clean => true
|
50
|
+
case res[:status]
|
51
|
+
when :success
|
52
|
+
addprocess = splash_return case: :quiet_exit, :more => "add process done"
|
53
|
+
when :already_exist
|
54
|
+
addprocess = splash_return case: :already_exist, :more => "add process twice not allowed"
|
55
|
+
when :failure
|
56
|
+
addprocess = splash_return case: :configuration_error, :more => "add process failed"
|
57
|
+
addprocess[:data] = res
|
58
|
+
end
|
59
|
+
content_type format
|
60
|
+
format_response(addprocess, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
61
|
+
end
|
62
|
+
|
63
|
+
|
44
64
|
|
45
65
|
WebAdminApp.delete '/api/config/deletelog/:label.?:format?' do
|
46
66
|
log = get_logger
|
47
67
|
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
48
68
|
log.call "API : config, verb : DELETE, route : deletelog, format : #{format}"
|
49
|
-
res = get_config.delete_log label: params[:label].to_sym
|
50
69
|
deletelog = {}
|
70
|
+
logsrec = Splash::Logs::LogsRecords::new params[:label].to_sym
|
71
|
+
logsrec.clear
|
72
|
+
res = get_config.delete_record :type => :logs, key: :label, label: params[:label].to_sym
|
51
73
|
case res[:status]
|
52
74
|
when :success
|
53
|
-
deletelog = splash_return case: :quiet_exit, :more => "delete
|
75
|
+
deletelog = splash_return case: :quiet_exit, :more => "delete log done"
|
54
76
|
when :not_found
|
55
|
-
deletelog = splash_return case: :not_found, :more => "
|
77
|
+
deletelog = splash_return case: :not_found, :more => "nothing done for logs"
|
56
78
|
else
|
57
|
-
deletelog = splash_return case: :configuration_error, :more => "delete
|
79
|
+
deletelog = splash_return case: :configuration_error, :more => "delete log failed"
|
58
80
|
end
|
59
81
|
content_type format
|
60
82
|
format_response(deletelog, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
61
83
|
end
|
84
|
+
|
85
|
+
WebAdminApp.delete '/api/config/deleteprocess/:process.?:format?' do
|
86
|
+
log = get_logger
|
87
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
88
|
+
log.call "API : config, verb : DELETE, route : deleteprocess, format : #{format}"
|
89
|
+
deleteprocess = {}
|
90
|
+
procrec = Splash::Processes::ProcessRecords::new params[:process].to_sym
|
91
|
+
procrec.clear
|
92
|
+
res = get_config.delete_record :type => :processes, :key => :process, process: params[:process].to_sym
|
93
|
+
case res[:status]
|
94
|
+
when :success
|
95
|
+
deleteprocess = splash_return case: :quiet_exit, :more => "delete process done"
|
96
|
+
when :not_found
|
97
|
+
deleteprocess = splash_return case: :not_found, :more => "nothing done for processes"
|
98
|
+
else
|
99
|
+
deleteprocess = splash_return case: :configuration_error, :more => "delete process failed"
|
100
|
+
end
|
101
|
+
content_type format
|
102
|
+
format_response(deleteprocess, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
103
|
+
end
|