forked from saltstack/salt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve master credentials on spawning platforms
Prevent spawning platform minions from having to re-authenticate on every job when using multiprocessing=True
- Loading branch information
Showing
5 changed files
with
74 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Preserve credentials on spawning platforms, minions no longer re-authenticate | ||
with every job when using `multiprocessing=True`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import time | ||
|
||
|
||
def test_reauth(salt_master_factory, event_listener): | ||
""" | ||
Validate non of our platform need to re-authenticate when runing a job with | ||
multiprocessing=True. | ||
""" | ||
sls_name = "issue-64941" | ||
sls_contents = """ | ||
custom_test_state: | ||
test.configurable_test_state: | ||
- name: example | ||
- changes: True | ||
- result: True | ||
- comment: "Nothing has acutally been changed" | ||
""" | ||
events = [] | ||
|
||
def handler(data): | ||
events.append(data) | ||
|
||
event_listener.register_auth_event_handler("test_reauth-master", handler) | ||
master = salt_master_factory.salt_master_daemon( | ||
"test_reauth-master", | ||
overrides={"log_level": "info"}, | ||
) | ||
sls_tempfile = master.state_tree.base.temp_file( | ||
"{}.sls".format(sls_name), sls_contents | ||
) | ||
minion = master.salt_minion_daemon( | ||
"test_reauth-minion", | ||
overrides={"log_level": "info"}, | ||
) | ||
cli = master.salt_cli() | ||
start_time = time.time() | ||
with master.started(), minion.started(): | ||
events = event_listener.get_events( | ||
[(master.id, "salt/auth")], | ||
after_time=start_time, | ||
) | ||
num_auth = len(events) | ||
proc = cli.run("state.sls", sls_name, minion_tgt="*") | ||
assert proc.returncode == 1 | ||
events = event_listener.get_events( | ||
[(master.id, "salt/auth")], | ||
after_time=start_time, | ||
) | ||
assert num_auth == len(events) |