MCPcopy Index your code
hub / github.com/saltstack/salt / clean_locks

Function clean_locks

salt/modules/zypperpkg.py:2282–2308  ·  view source on GitHub ↗

Remove unused locks that do not currently (with regard to repositories used) lock any package. root Operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.clean_locks

(root=None)

Source from the content-addressed store, hash-verified

2280
2281
2282def clean_locks(root=None):
2283 """
2284 Remove unused locks that do not currently (with regard to repositories
2285 used) lock any package.
2286
2287 root
2288 Operate on a different root directory.
2289
2290 CLI Example:
2291
2292 .. code-block:: bash
2293
2294 salt '*' pkg.clean_locks
2295 """
2296 LCK = "removed"
2297 out = {LCK: 0}
2298 locks = os.path.join(root, os.path.relpath(LOCKS, os.path.sep)) if root else LOCKS
2299 if not os.path.exists(locks):
2300 return out
2301
2302 for node in __zypper__(root=root).xml.call("cl").getElementsByTagName("message"):
2303 text = node.childNodes[0].nodeValue.lower()
2304 if text.startswith(LCK):
2305 out[LCK] = text.split(" ")[1]
2306 break
2307
2308 return out
2309
2310
2311def unhold(name=None, pkgs=None, root=None, **kwargs):

Callers

nothing calls this directly

Calls 3

relpathMethod · 0.45
existsMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected