sysinv: ignore bootstrap config file if missing

In commit cf94bebd9 we added a routine to edit the saved bootstrap
config file.  Originally this was fine since the file was guaranteed
to exist.

However, we now want to be able to do a "skip version" upgrade from
earlier releases where the bootstrap config file won't exist.  In this
case we should just ignore the missing file.

Accordingly, catch the specific error case and emit an informational
log rather than failing the K8s upgrade.

Closes-Bug: 2009619

Change-Id: I103f9b769a4803f85624a8fa4014ae11fa4cf227
Signed-off-by: Chris Friesen <chris.friesen@windriver.com>
This commit is contained in:
Chris Friesen 2023-03-07 10:15:30 -06:00
parent efe9eece9e
commit 5f44f4a4a2
1 changed files with 4 additions and 0 deletions

View File

@ -16418,6 +16418,10 @@ class ConductorManager(service.PeriodicService):
try:
with open(FILENAME, "r") as stream:
info = newyaml.load(stream)
except FileNotFoundError:
# For "skip version" upgrades this is normal.
LOG.info("File %s not found, ignoring." % FILENAME)
return 0
except Exception as ex:
LOG.error("Problem reading from %s" % FILENAME)
LOG.error(str(ex))