From a1364d55a0a271f019aa0a40490065d1d2007d0f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 26 Feb 2019 16:07:17 -0500 Subject: [PATCH] Handle firmware upload error 413 If software attempts to upload a file larger than the XCC supports. Report a more understandable condition in such a case. Change-Id: I8b5a80c0be8fbca141bdce34d5da39095217b30b --- pyghmi/ipmi/oem/lenovo/imm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 00c3f0a3..4db0189d 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -1455,6 +1455,8 @@ class XCCClient(IMMClient): progress({'phase': 'upload', 'progress': 100.0 * rsp['received'] / rsp['size']}) elif rsp['state'] != 'done': + if rsp.get('status', None) == 413: + raise Exception('File is larger than supported') raise Exception('Unexpected result:' + repr(rsp)) uploadstate = rsp['state'] self._refresh_token()