add macOS mac_service update. - #47256
Conversation
…ad of the legacy versions, and support for user space LaunchAgents
gtmanfred
left a comment
There was a problem hiding this comment.
Just one change I would like to see, but it can be merged without it.
| # check if a LaunchAgent as we should treat these differently. | ||
| if 'LaunchAgents' in path: | ||
| # Get the console user so we can service in the correct session | ||
| uid = salt.utils.mac_utils.console_user() |
There was a problem hiding this comment.
can you switch these to using __utils__['mac_utils.console_user']() instead of using the import salt.utils.mac_utils?
It allows for people that use the dropin dynamic modules to actually replace the modules that use newer salt utils.
Thanks,
Daniel
There was a problem hiding this comment.
@gtmanfred would like me to convert the other mac_util calls as well?
There was a problem hiding this comment.
Eventually we should go through and change them all to using __utils__ i was just think about these ones since you are adding new ones.
There was a problem hiding this comment.
Sounds good, I changed all my additions to using __utils__
There was a problem hiding this comment.
I'm still seeing salt.utils.mac_utils.console_user(). Need change it to __utils__['mac_utils.console_user']
…th PIDs as the service state does not pass in the runas parameter
|
after testing the requested changes by Daniel, I noticed that the service state doesn't pass in the |
|
@rallytime I'd like to update the documentation with some notes and version added information for these changes. Would this PR make it into the Fluorine release? |
|
@weswhet Yeah, definitely. We're not branching for the Fluorine release for a while. |
|
Hi @weswhet - It looks like this change is causing the following related tests to fail:
https://jenkins.saltstack.com/job/PR/job/salt-pr-linode-ubuntu14-n/22418/ Can you take a look? |
|
@rallytime, for future reference what state are the test Macs in? I’m assuming headless With no users and sitting at the login window? Just curious for any future code changes. |
What does this PR do?
This PR adds support for using the latest macOS
launchctlsubcommands as well as the ability to manage user specific services.Previous Behavior
Previously salt would use the legacy subcommands like
/bin/launchctl load/unloadto start and stop services. It was also not capable of modifying any user specific services located in/Users/foo/Library/LaunchAgents/New Behavior
Salt now leverages the latest subcommands
/bin/launchctl bootstrap/bootoutto start and stop services. Using these subcommands allows us to properly load and unload LauchAgents from root without having to run commands as the user as this is handled properly bylaunchctlwhen specifying to appropriate domain/system targets likegui/501/orgui/501/com.apple.example.Salt also now looks for user specific services located in
/Users/foo/Library/LaunchAgents/and is now capable of modifying them.Tests written?
No
Commits signed with GPG?
Yes