MCPcopy Create free account
hub / github.com/saltstack/salt / _call_apt

Function _call_apt

salt/modules/aptpkg.py:136–163  ·  view source on GitHub ↗

Call apt* utilities.

(args, scope=True, **kwargs)

Source from the content-addressed store, hash-verified

134
135
136def _call_apt(args, scope=True, **kwargs):
137 """
138 Call apt* utilities.
139 """
140 cmd = []
141 if (
142 scope
143 and salt.utils.systemd.has_scope(__context__)
144 and __salt__["config.get"]("systemd.scope", True)
145 ):
146 cmd.extend(["systemd-run", "--scope", "--description", f'"{__name__}"'])
147 cmd.extend(args)
148
149 params = {
150 "output_loglevel": "trace",
151 "python_shell": False,
152 "env": salt.utils.environment.get_module_environment(globals()),
153 }
154 params.update(kwargs)
155
156 cmd_ret = __salt__["cmd.run_all"](cmd, **params)
157 count = 0
158 while "Could not get lock" in cmd_ret.get("stderr", "") and count < 10:
159 count += 1
160 log.warning("Waiting for dpkg lock release: retrying... %s/100", count)
161 time.sleep(2**count)
162 cmd_ret = __salt__["cmd.run_all"](cmd, **params)
163 return cmd_ret
164
165
166def normalize_name(name):

Callers 15

latest_versionFunction · 0.85
refresh_dbFunction · 0.85
installFunction · 0.85
_uninstallFunction · 0.85
autoremoveFunction · 0.85
upgradeFunction · 0.85
_get_upgradableFunction · 0.85
list_repo_pkgsFunction · 0.85
get_repo_keysFunction · 0.85
add_repo_keyFunction · 0.85
del_repo_keyFunction · 0.85
mod_repoFunction · 0.85

Calls 5

warningMethod · 0.80
extendMethod · 0.45
updateMethod · 0.45
getMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected