Use Fluentd::Setting::Config#delete_element

Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
Kenji Okimoto 2018-09-14 12:40:48 +09:00
parent 9b1b48e47b
commit a13c488d0e
No known key found for this signature in database
GPG Key ID: F9E3E329A5C5E4A1

View File

@ -25,13 +25,19 @@ class Api::SettingsController < ApplicationController
end
def destroy
unless @config.elements.index(@section)
render_404
return
if params[:label] == "ROOT"
name = params[:pluginType]
arg = params[:arg]
else
name = "label"
arg = params[:label]
end
if @config.delete_element(name, arg, @target_element)
@config.write_to_file
head :no_content # 204
else
render_404
end
@config.elements.delete @section
@config.write_to_file
head :no_content # 204
end
private