From aa779809c75661394930f76eb32d5ad9535b31c9 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Thu, 30 Mar 2017 20:19:09 +0000 Subject: [PATCH] Fix Loader Upgrade Status When the Loader upgrade step was moved prior to platform setup the upgrade status was lost because the platform-current symlink had not been created yet. This simple fix places the upgrade status file in the absolute directory instead of the symlinked directory. The loader status and the firmware status should probably be separated anyways. The loader status doesn't belong in the platform-specific data. --- .../src/python/onl/platform/current.py | 11 ++++++----- .../vendor-config-onl/src/python/onl/upgrade/ubase.py | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/platform/current.py b/packages/base/all/vendor-config-onl/src/python/onl/platform/current.py index f1be67f9..bdf4c915 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/platform/current.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/platform/current.py @@ -17,7 +17,7 @@ import os import importlib -def import_subsystem_platform_class(subsystem='onl', klass='OnlPlatform'): +def platform_name_get(): # Determine the current platform name. platform = None if os.path.exists("/etc/onl/platform"): @@ -32,13 +32,14 @@ def import_subsystem_platform_class(subsystem='onl', klass='OnlPlatform'): if platform is None: raise RuntimeError("cannot find a platform declaration") + return platform + +def import_subsystem_platform_class(subsystem='onl', klass='OnlPlatform'): + platform = platform_name_get() platform_module = platform.replace('-', '_').replace('.', '_') - - # Import the platform module m = importlib.import_module('%s.platform.%s' % (subsystem, platform_module)) - return getattr(m, '%s_%s' % (klass, platform_module)) +OnlPlatformName = platform_name_get() OnlPlatform = import_subsystem_platform_class() - 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 6e73e43e..6e69b3d9 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 @@ -16,7 +16,7 @@ import argparse import yaml from time import sleep -from onl.platform.current import OnlPlatform +from onl.platform.current import OnlPlatform, OnlPlatformName from onl.mounts import OnlMountManager, OnlMountContextReadOnly, OnlMountContextReadWrite class BaseUpgrade(object): @@ -163,7 +163,7 @@ class BaseUpgrade(object): return default - UPGRADE_STATUS_JSON = "/lib/platform-config/current/onl/upgrade.json" + UPGRADE_STATUS_JSON = "/lib/platform-config/%s/onl/upgrade.json" % (OnlPlatformName) @staticmethod def upgrade_status_get():