From a86b1abc03c1f7ecd4434a67b166c65affa1151e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 18 Aug 2024 10:46:04 +0200 Subject: [PATCH] osmo-smdpp: Proper error handling in case ctxParams1 is missing member ************* Module osmo-smdpp osmo-smdpp.py:373:15: E0601: Using variable 'iccid_str' before assignment (used-before-assignment) Change-Id: I52bef18cbcc9f5d14519ff1473532c8502d45908 --- osmo-smdpp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osmo-smdpp.py b/osmo-smdpp.py index a044b9ba..3dbe9b10 100755 --- a/osmo-smdpp.py +++ b/osmo-smdpp.py @@ -368,9 +368,9 @@ class SmDppHttpServer: with open(path, 'rb') as f: pes = saip.ProfileElementSequence.from_der(f.read()) iccid_str = b2h(pes.get_pe_for_type('header').decoded['iccid']) - - # make pylint happy: E0601: Using variable 'iccid_str' before assignment (used-before-assignment) - assert iccid_str + else: + # there's currently no other option in the ctxParams1 choice, so this cannot happen + raise ApiError('1.3.1', '2.2', 'ctxParams1 missing mandatory ctxParamsForCommonAuthentication') # FIXME: we actually want to perform the profile binding herr, and read the profile metadat from the profile