mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Cleanup pkgin isatty mess
This commit is contained in:
parent
07cac0b434
commit
ddf8a8d2bb
1 changed files with 3 additions and 13 deletions
|
@ -75,15 +75,6 @@ def _supports_regex():
|
|||
return tuple([int(i) for i in _get_version()]) > (0, 5)
|
||||
|
||||
|
||||
@decorators.memoize
|
||||
def _supports_parsing():
|
||||
'''
|
||||
Check support of parsing
|
||||
'''
|
||||
|
||||
return tuple([int(i) for i in _get_version()]) > (0, 7)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
Set the virtual pkg module if the os is supported by pkgin
|
||||
|
@ -263,10 +254,9 @@ def list_pkgs(versions_as_list=False, **kwargs):
|
|||
out = __salt__['cmd.run'](pkg_command, output_loglevel='trace')
|
||||
for line in out.splitlines():
|
||||
try:
|
||||
if _supports_parsing():
|
||||
pkg, ver = line.split(';', 1)[0].rsplit('-', 1)
|
||||
else:
|
||||
pkg, ver = line.split(' ', 1)[0].rsplit('-', 1)
|
||||
# Some versions of pkgin check isatty unfortunately
|
||||
# this results in cases where a ' ' or ';' can be used
|
||||
pkg, ver = re.split('[; ]', line, 1)[0].rsplit('-', 1)
|
||||
except ValueError:
|
||||
continue
|
||||
__salt__['pkg_resource.add_pkg'](ret, pkg, ver)
|
||||
|
|
Loading…
Add table
Reference in a new issue