While we want all the post-upgrade actions to be undertaken, should one
of these fail, the correct error code should be returned so that the
upgrade script can report issues.

Signed-off-by: Hrvoje Ribicic <[email protected]>
---
 tools/post-upgrade | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/post-upgrade b/tools/post-upgrade
index 4ab460d..d625360 100644
--- a/tools/post-upgrade
+++ b/tools/post-upgrade
@@ -51,13 +51,17 @@ def main():
 
   version = utils.version.ParseVersion(versionstring)
 
+  error_code = 0
+
   if utils.version.IsBefore(version, 2, 12, 5):
     result = utils.RunCmd(["gnt-cluster", "renew-crypto",
                            "--new-node-certificates", "-f"])
     if result.failed:
       cli.ToStderr("Failed to create node certificates: %s; Output %s" %
                    (result.fail_reason, result.output))
-  return 0
+      error_code = 1
+
+  return error_code
 
 if __name__ == "__main__":
   exit(main())
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to