Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Commit d39b3bb

Browse files
committed
It is now actually working :)
1 parent 3c882ef commit d39b3bb

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Diff for: config/exec_provider.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,25 @@ def run(self, previous_response=None):
5151
self.env['KUBERNETES_EXEC_INFO'] = json.dumps(kubernetes_exec_info)
5252
process = subprocess.Popen(
5353
self.args,
54-
stdin=subprocess.PIPE,
54+
stdout=subprocess.PIPE,
5555
stderr=subprocess.PIPE,
56-
env=self.env)
57-
process.wait()
58-
if process.returncode != 0:
59-
msg = 'exec: process returned %d' % process.returncode
60-
stderr = process.stderr.read().strip()
56+
env=self.env,
57+
universal_newlines=True)
58+
(stdout, stderr) = process.communicate()
59+
exit_code = process.wait()
60+
if exit_code != 0:
61+
msg = 'exec: process returned %d' % exit_code
62+
stderr = stderr.strip()
6163
if stderr:
6264
msg += '. %s' % stderr
6365
raise ConfigException(msg)
64-
stdout = process.stdout.read()
66+
stdout = stdout
6567
try:
6668
data = json.loads(stdout)
6769
except json.decoder.JSONDecodeError as de:
6870
raise ConfigException(
6971
'exec: failed to decode process output: %s' % de)
70-
if all(k in data for k in ('apiVersion', 'kind', 'status')):
72+
if not all(k in data for k in ('apiVersion', 'kind', 'status')):
7173
raise ConfigException(
7274
'exec: malformed response. plugin returned: %s' % stdout)
7375
if data['apiVersion'] != self.api_version:

0 commit comments

Comments
 (0)