steps/runconfig: Avoid storing jsonconfig as a property

We already have a log, don't duplicate the data as a property as it will
cause excess database growth.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2020-11-12 10:22:34 +00:00
parent 7898d68ccc
commit 2b497317d2

View File

@ -172,7 +172,15 @@ class RunConfigCheckSteps(shell.ShellCommand):
def evaluateCommand(self, cmd):
# If the command fails, fall back to old style run-config execution
rc = super().evaluateCommand(cmd)
jsonconfig = self.getProperty("runconfig-json", None)
logLines = self.log_observer_json.getStdout()
json_text = ''.join([line for line in logLines.splitlines()])
jsonconfig = None
if json_text:
try:
jsonconfig = json.loads(json_text)
except Exception as ex:
self._addToLog('stderr', 'ERROR: unable to parse data, exception: {}'.format(ex))
if rc == FAILURE or not jsonconfig:
steps = [get_runconfig_legacy_step(self.posttrigger)]
else:
@ -186,18 +194,6 @@ class RunConfigCheckSteps(shell.ShellCommand):
self.build.addStepsAfterCurrentStep(steps)
return SUCCESS
def commandComplete(self, cmd):
super().commandComplete(cmd)
logLines = self.log_observer_json.getStdout()
json_text = ''.join([line for line in logLines.splitlines()])
if not json_text:
return
try:
jsonconfig = json.loads(json_text)
self.setProperty("runconfig-json", jsonconfig)
except Exception as ex:
self._addToLog('stderr', 'ERROR: unable to parse data, exception: {}'.format(ex))
@defer.inlineCallbacks
def _addToLog(self, logName, message):
try: