Skip to content

Commit

Permalink
Merge pull request #51543 from mateiw/develop-dpkg-info-status
Browse files Browse the repository at this point in the history
Let dpkg.info expose package status
  • Loading branch information
garethgreenaway authored Feb 8, 2019
2 parents 927adb3 + 067cae2 commit 79217f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions salt/modules/dpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ def _get_pkg_info(*packages, **kwargs):
"SHA256:${SHA256}\\n" \
"origin:${Origin}\\n" \
"homepage:${Homepage}\\n" \
"status:${db:Status-Abbrev}\\n" \
"======\\n" \
"description:${Description}\\n" \
"------\\n'"
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/modules/test_dpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class DpkgTestCase(TestCase, LoaderModuleMockMixin):
'depend on the latest\n recommended Emacs release.\n',
'package': 'emacs', 'source': 'emacs-defaults',
'maintainer': 'Simpsons Developers <[email protected]>',
'build_date_time_t': 1407430308, 'installed_size': '25', 'install_date': '2016-12-14T20:02:58Z'}
'build_date_time_t': 1407430308, 'installed_size': '25', 'install_date': '2016-12-14T20:02:58Z',
'status': 'ii'}
]

def setup_loader_modules(self):
Expand Down Expand Up @@ -147,12 +148,13 @@ def test_info(self):
for pkg_section in ['section', 'architecture', 'original-maintainer', 'maintainer', 'package', 'installed-size',
'build_date_time_t', 'sha256', 'origin', 'build_date', 'size', 'source', 'version',
'install_date_time_t', 'license', 'priority', 'description', 'md5sum', 'supported',
'filename', 'sha1', 'install_date', 'arch']:
'filename', 'sha1', 'install_date', 'arch', "status"]:
assert pkg_section in pkg_data

assert pkg_data['section'] == 'editors'
assert pkg_data['maintainer'] == 'Simpsons Developers <[email protected]>'
assert pkg_data['license'] == 'BSD v3'
assert pkg_data['status'] == 'ii'

@patch('salt.modules.dpkg._get_pkg_ds_avail', MagicMock(return_value=dselect_pkg))
@patch('salt.modules.dpkg._get_pkg_info', MagicMock(return_value=pkgs_info))
Expand Down

0 comments on commit 79217f3

Please sign in to comment.