File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
tests/pytests/integration/cli Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 11import salt .utils .parsers
2+ from salt .exceptions import SaltInvocationError
23from salt .utils .verify import check_user
34
45
@@ -14,6 +15,11 @@ def run(self):
1415 import salt .key
1516
1617 self .parse_args ()
18+ if self .options .__dict__ ["delete_all" ]:
19+ if self .args :
20+ raise SaltInvocationError (
21+ "Delete all takes no arguments. Use -d to delete specified keys"
22+ )
1723
1824 key = salt .key .KeyCLI (self .config )
1925 if check_user (self .config ["user" ]):
Original file line number Diff line number Diff line change @@ -75,6 +75,15 @@ def test_remove_key(salt_master, salt_key_cli):
7575 os .unlink (key )
7676
7777
78+ def test_remove_all_keys_with_arg (salt_key_cli ):
79+ """
80+ test salt-key -D usage with args
81+ """
82+ # Remove Key
83+ ret = salt_key_cli .run ("-D" , 'minion_id' )
84+ assert "Delete all takes no arguments" in ret .stderr
85+
86+
7887@pytest .mark .skip_if_not_root
7988@pytest .mark .destructive_test
8089@pytest .mark .skip_on_windows (reason = "PAM is not supported on Windows" )
You can’t perform that action at this time.
0 commit comments