From 787123d44f9f3ad0a30ea27116efd04a9a0b5dd2 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Tue, 17 Nov 2020 11:17:13 +0900 Subject: [PATCH] command: Remove redundant -cap suffixes from options Signed-off-by: Hiroshi Hatake --- lib/fluent/command/cap_ctl.rb | 6 +++--- test/command/test_cap_ctl.rb | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/fluent/command/cap_ctl.rb b/lib/fluent/command/cap_ctl.rb index ce7b564bdd..4a3af21933 100644 --- a/lib/fluent/command/cap_ctl.rb +++ b/lib/fluent/command/cap_ctl.rb @@ -28,15 +28,15 @@ def prepare_option_parser @opts[:clear_capabilities] = true } - @op.on('--add-cap', '--add-capabilities [CAPABILITITY1, CAPABILITY2, ...]', "Add capabilities into Fluentd Ruby") {|s| + @op.on('--add [CAPABILITITY1,CAPABILITY2, ...]', "Add capabilities into Fluentd Ruby") {|s| @opts[:add_capabilities] = s } - @op.on('--drop-cap', '--drop-capabilities [CAPABILITITY1, CAPABILITY2, ...]', "Drop capabilities into Fluentd Ruby") {|s| + @op.on('--drop [CAPABILITITY1,CAPABILITY2, ...]', "Drop capabilities into Fluentd Ruby") {|s| @opts[:drop_capabilities] = s } - @op.on('--get-cap', '--get-capabilities', "Get capabilities for Fluentd") {|s| + @op.on('--get', "Get capabilities for Fluentd Ruby") {|s| @opts[:get_capabilities] = true } diff --git a/test/command/test_cap_ctl.rb b/test/command/test_cap_ctl.rb index 53c58271cd..262b8bcc05 100644 --- a/test/command/test_cap_ctl.rb +++ b/test/command/test_cap_ctl.rb @@ -19,7 +19,7 @@ class TestFluentCapCtl < Test::Unit::TestCase test "add capability" do logs = capture_stdout do - Fluent::CapCtl.new(["--add-cap", "dac_override"]).call + Fluent::CapCtl.new(["--add", "dac_override"]).call end expression = /\AUpdating .* done.\nAdding .*\n/m assert_match expression, logs @@ -27,7 +27,7 @@ class TestFluentCapCtl < Test::Unit::TestCase test "drop capability" do logs = capture_stdout do - Fluent::CapCtl.new(["--drop-cap", "chown"]).call + Fluent::CapCtl.new(["--drop", "chown"]).call end expression = /\AUpdating .* done.\nDropping .*\n/m assert_match expression, logs @@ -35,7 +35,7 @@ class TestFluentCapCtl < Test::Unit::TestCase test "get capability" do logs = capture_stdout do - Fluent::CapCtl.new(["--get-cap"]).call + Fluent::CapCtl.new(["--get"]).call end expression = /\ACapabilities in .*,\nEffective: .*\nInheritable: .*\nPermitted: .*/m assert_match expression, logs @@ -56,7 +56,7 @@ class TestFluentCapCtl < Test::Unit::TestCase test "add capability" do logs = capture_stdout do Tempfile.create("fluent-cap-") do |tempfile| - Fluent::CapCtl.new(["--add-cap", "dac_override", "-f", tempfile.path]).call + Fluent::CapCtl.new(["--add", "dac_override", "-f", tempfile.path]).call end end expression = /\AUpdating .* done.\nAdding .*\n/m @@ -66,7 +66,7 @@ class TestFluentCapCtl < Test::Unit::TestCase test "drop capability" do logs = capture_stdout do Tempfile.create("fluent-cap-") do |tempfile| - Fluent::CapCtl.new(["--drop-cap", "chown", "-f", tempfile.path]).call + Fluent::CapCtl.new(["--drop", "chown", "-f", tempfile.path]).call end end expression = /\AUpdating .* done.\nDropping .*\n/m @@ -76,7 +76,7 @@ class TestFluentCapCtl < Test::Unit::TestCase test "get capability" do logs = capture_stdout do Tempfile.create("fluent-cap-") do |tempfile| - Fluent::CapCtl.new(["--get-cap", "-f", tempfile.path]).call + Fluent::CapCtl.new(["--get", "-f", tempfile.path]).call end end expression = /\ACapabilities in .*,\nEffective: .*\nInheritable: .*\nPermitted: .*/m @@ -87,13 +87,13 @@ class TestFluentCapCtl < Test::Unit::TestCase sub_test_case "invalid" do test "add capability" do assert_raise(ArgumentError) do - Fluent::CapCtl.new(["--add-cap", "nonexitent"]).call + Fluent::CapCtl.new(["--add", "nonexitent"]).call end end test "drop capability" do assert_raise(ArgumentError) do - Fluent::CapCtl.new(["--drop-cap", "invalid"]).call + Fluent::CapCtl.new(["--drop", "invalid"]).call end end end