Make journal_dump py3.6 compatable

Currently journal_dump passes `capture_output` argument to subprocess.run
which is valid only since py3.7 while we're running systems with default
py3.6. We replace capture_output with old proven subprocess.PIPE for
compatability with older Python versions.

Change-Id: Id7713d8eeec86a910739ac64d3b0815fcfeb506d
This commit is contained in:
Dmitriy Rabotyagov 2021-04-28 12:54:55 +03:00
parent 660a172602
commit 0c5c43bfa1

View File

@ -34,7 +34,7 @@ def get_container_journals():
journals = []
try:
s = subprocess.run(['lxc-ls', '-1'], capture_output=True)
s = subprocess.run(['lxc-ls', '-1'], stdout=subprocess.PIPE)
except FileNotFoundError:
return journals
@ -44,9 +44,9 @@ def get_container_journals():
info = {}
info['name'] = container_name
info['subdir'] = "openstack"
s = subprocess.run(['lxc-info', '--pid', '--no-humanize', container_name], capture_output=True)
s = subprocess.run(['lxc-info', '--pid', '--no-humanize', container_name], stdout=subprocess.PIPE)
info['pid'] = s.stdout.decode('utf-8').strip()
if(len(info['pid']) == 0):
continue