mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Return an actual amount of removed locks.
This commit is contained in:
parent
eaa6af9898
commit
453a18ea15
@ -879,13 +879,19 @@ def clean_locks():
|
||||
|
||||
salt '*' pkg.clean_locks
|
||||
'''
|
||||
if not os.path.exists(LOCKS):
|
||||
return False
|
||||
LCK = "removed"
|
||||
out = {LCK: 0}
|
||||
if not os.path.exists("/etc/zypp/locks"):
|
||||
return out
|
||||
|
||||
cmd = ('zypper --non-interactive cl')
|
||||
__salt__['cmd.run'](cmd, output_loglevel='trace')
|
||||
doc = dom.parseString(__salt__['cmd.run']('zypper --non-interactive -x cl', output_loglevel='trace'))
|
||||
for node in doc.getElementsByTagName("message"):
|
||||
text = node.childNodes[0].nodeValue.lower()
|
||||
if text.startswith(LCK):
|
||||
out[LCK] = text.split(" ")[1]
|
||||
break
|
||||
|
||||
return True
|
||||
return out
|
||||
|
||||
|
||||
def remove_lock(name=None, pkgs=None, **kwargs): # pylint: disable=unused-argument
|
||||
|
Loading…
Reference in New Issue
Block a user