[BUG] apple silicon/sonoma: mac_service causes `NameError: name '__utils__' is not defined`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
mac_service causes unexpected NameError exception when trying to use with apple silicon (Mac mini M1)
Setup
salt installed using homebrew. Running in launchctl service.
Please be as specific as possible and give set-up details.
- on-prem machine
Steps to Reproduce the behavior
# salt 'mac01' service.get_all
mac05:
The minion function caused an exception: Traceback (most recent call last):
File "/opt/salt/lib/python3.10/site-packages/salt/minion.py", line 1982, in _thread_return
return_data = minion_instance._execute_job_function(
File "/opt/salt/lib/python3.10/site-packages/salt/minion.py", line 1941, in _execute_job_function
return_data = self.executors[fname](opts, data, func, args, kwargs)
File "/opt/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "/opt/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/opt/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
return _func_or_method(*args, **kwargs)
File "/opt/salt/lib/python3.10/site-packages/salt/executors/direct_call.py", line 10, in execute
return func(*args, **kwargs)
File "/opt/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "/opt/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/opt/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
return _func_or_method(*args, **kwargs)
File "/opt/salt/lib/python3.10/site-packages/salt/modules/mac_service.py", line 664, in get_all
enabled = get_enabled(runas=runas)
File "/opt/salt/lib/python3.10/site-packages/salt/modules/mac_service.py", line 690, in get_enabled
stdout = list_(runas=runas)
File "/opt/salt/lib/python3.10/site-packages/salt/modules/mac_service.py", line 354, in list_
return launchctl("list", return_stdout=True, runas=runas)
File "/opt/salt/lib/python3.10/site-packages/salt/modules/mac_service.py", line 318, in launchctl
return __utils__["mac_utils.launchctl"](sub_cmd, *args, **kwargs)
NameError: name '__utils__' is not defined
ERROR: Minions returned with non-zero exit code
Expected behavior
get successfully list of service
Versions Report
salt --versions-report
Salt Version:
Salt: 3006.5
Python Version:
Python: 3.10.13 (main, Nov 15 2023, 04:31:50) [Clang 14.0.3 (clang-1403.0.22.14.1)]
Dependency Versions:
cffi: 1.14.6
cherrypy: unknown
dateutil: 2.8.0
docker-py: Not Installed
gitdb: 4.0.7
gitpython: 3.1.37
Jinja2: 3.1.2
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 22.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.9.8
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.14.2
smmap: 4.0.0
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: darwin 23.2.0
locale: utf-8
machine: arm64
release: 23.2.0
system: Darwin
version: 14.2.1 arm64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in salt/modules/mac_service.py at get_all(), get_enabled(), list_(), and launchctl(), using the traceback and the Apple Silicon launchctl service setup as the reproduction path. The fix is done when service.get_all successfully lists services without the utils NameError on macOS arm64.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100