[SWL-3475] Fix Firmware upgrade after initial ONIE upgrade.

The ONIE firware upgrade staging area is not initialized properly if we don't first boot into ONIE after
the initial upgrade. This causes our workflow of ONIE then CPLD upgrade to fail the first time.

The onie-fwpkg script does not report an error about the staging area which is why our code
is not detecting the failure to install the firmware package.
This commit is contained in:
Jeffrey Townsend
2016-11-21 21:21:41 +00:00
parent 956a28678d
commit 5c34495096

View File

@@ -1,5 +1,6 @@
from onl.mounts import OnlOnieBootContext, OnlMountContextReadWrite
import subprocess
import os
ONIE_BOOT_MODES = [ 'install',
'rescue',
@@ -17,8 +18,15 @@ def onie_boot_mode_set(mode):
with OnlOnieBootContext() as ob:
subprocess.check_call("%s/onie/tools/bin/onie-boot-mode -o %s" % (ob.directory, mode), shell=True)
def _makedirs(d):
if not os.path.exists(d):
os.makedirs(d)
def onie_fwpkg(arguments):
with OnlOnieBootContext() as ob:
# This is necessary if we've upgraded ONIE but haven't booted into it yet...
_makedirs("%s/onie/update/pending" % ob.directory)
_makedirs("%s/onie/update/attempts" % ob.directory)
subprocess.check_call("%s/onie/tools/bin/onie-fwpkg %s" % (ob.directory, arguments), shell=True)
def boot_entry_set(index):