Skip to content

Commit

Permalink
Extract package description
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Maryniuk committed Sep 9, 2015
1 parent a60348c commit b94ee3c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion salt/modules/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,18 +447,27 @@ def info(*packages):

pkg_data = dict()
pkg_name = None
for line in pkg_info[:]:
descr_marker = False
descr = list()
for line in pkg_info:
if descr_marker:
descr.append(line)
continue
line = [item.strip() for item in line.split(':', 1)]
if len(line) != 2:
continue
key, value = line
key = key.replace(' ', '_').lower()
if key == 'description':
descr_marker = True
continue
if key == 'name':
pkg_name = value
if key in ['build_date', 'install_date']:
value = _pkg_time_to_iso(value)
if key != 'description' and value:
pkg_data[key] = value
pkg_data['decription'] = os.linesep.join(descr)
if pkg_name:
ret[pkg_name] = pkg_data

Expand Down

0 comments on commit b94ee3c

Please sign in to comment.