From c575a267dc240ad1d1fcb1f7a9c819fe17c46268 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Thu, 14 Jul 2016 17:20:38 +0000 Subject: [PATCH] Make the upgrade status accessible. --- .../src/python/onl/upgrade/ubase.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py index b9653815..52b39708 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py @@ -157,7 +157,7 @@ class BaseUpgrade(object): return default - UPGRADE_STATUS_JSON = "/lib/platform-config/current/upgrade.json" + UPGRADE_STATUS_JSON = "/lib/platform-config/current/onl/upgrade.json" def update_upgrade_status(self, key, value): data = {} @@ -168,7 +168,6 @@ class BaseUpgrade(object): with open(self.UPGRADE_STATUS_JSON, "w") as f: json.dump(data, f) - # # Initialize self.current_version, self.next_Version # and anything required for summarize() @@ -409,3 +408,13 @@ class BaseOnieUpgrade(BaseUpgrade): if os.path.exists(self.ONIE_UPDATER_PATH): self.logger.info("Removing previous onie-updater.") os.remove(self.ONIE_UPDATER_PATH) + + + +def upgrade_status(): + data = {} + if os.path.exists(BaseUpgrade.UPGRADE_STATUS_JSON): + with open(BaseUpgrade.UPGRADE_STATUS_JSON) as f: + data = json.load(f) + return data +