diff --git a/Changelog.md b/Changelog.md index 8035262..2f9024e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +## 0.7.3 Released on 2017-09-02 + +- Fix #72: MacOS build +- Fix #73: Exit with the same error-code than Helm + ## 0.7.2 Released on 2017-08-13 - Add login/creds per namespaces / repo diff --git a/appr/commands/command_base.py b/appr/commands/command_base.py index ef2f130..3c48a63 100644 --- a/appr/commands/command_base.py +++ b/appr/commands/command_base.py @@ -5,7 +5,7 @@ import json import os import re - +import subprocess import requests import yaml @@ -143,6 +143,11 @@ def exec_cmd(self, render=True): payload["response"] = content self.render_error(payload) exit(2) + except subprocess.CalledProcessError as exc: + payload = {"message": str(exc.output)} + self.render_error(payload) + exit(exc.returncode) + if render: self.render() diff --git a/appr/commands/helm.py b/appr/commands/helm.py index 0f928cf..883bc1b 100644 --- a/appr/commands/helm.py +++ b/appr/commands/helm.py @@ -3,6 +3,7 @@ import argparse import os import tempfile +import subprocess from copy import copy from appr.commands.command_base import CommandBase from appr.commands.pull import PullCmd @@ -35,7 +36,12 @@ def exec_helm_cmd(self, cmd, options, helm_opts): pull_cmd = PullCmd(options) pull_cmd.exec_cmd(render=False) helm_cli = Helm() - output = helm_cli.action(cmd, pull_cmd.path, helm_opts) + try: + output = helm_cli.action(cmd, pull_cmd.path, helm_opts) + except subprocess.CalledProcessError as exc: + payload = {"message": str(exc.output)} + self.render_error(payload) + exit(exc.returncode) self.status = {'result': output} self.render() diff --git a/appr/plugins/helm.py b/appr/plugins/helm.py index e73871d..7c2172f 100644 --- a/appr/plugins/helm.py +++ b/appr/plugins/helm.py @@ -83,7 +83,4 @@ def action(self, cmd, package_path, helm_opts=None): def _call(self, cmd): command = ['helm'] + cmd - try: - return subprocess.check_output(command, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as exc: - return exc.output + return subprocess.check_output(command, stderr=subprocess.STDOUT) diff --git a/setup.py b/setup.py index ca10e74..6542620 100755 --- a/setup.py +++ b/setup.py @@ -37,6 +37,7 @@ extra_requirements = [ 'urllib3[secure]<1.22', + 'pyopenssl', 'jinja2>=2.8', 'jsonpatch', 'tabulate',