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.
This commit is contained in:
Jeffrey Townsend
2017-03-30 20:19:09 +00:00
parent dd31e1b84f
commit aa779809c7
2 changed files with 8 additions and 7 deletions

View File

@@ -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()

View File

@@ -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():