def lastupdate():
'''
Return the date of the last rpm package update/installation.
CLI Example:
.. code-block:: bash
salt '*' rpmpck.lastupdate
'''
installtime = lambda rpm_date: time.strptime(rpm_date, "%c")
cmd = ['rpm', '-qa', '--queryformat', r'%{INSTALLTID:date}\n']
out = __salt__['cmd.run'](cmd, output_loglevel='trace',
python_shell=False).splitlines()
last = max(installtime(rpm_date) for rpm_date in out)
return time.asctime(last)
评论列表
文章目录