From dc04714e1099f2e0e9fa75417afc4ea4d4ea6fed Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Fri, 19 Jan 2018 11:39:58 +0100 Subject: [PATCH] Bugfix for OTAs. --- tclcheck.py | 7 ++++--- tcllib.py | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tclcheck.py b/tclcheck.py index c9fc3d1..ea9bd33 100755 --- a/tclcheck.py +++ b/tclcheck.py @@ -70,9 +70,10 @@ req_xml = fc.do_request(curef, fv, tv, fw_id) print(fc.pretty_xml(req_xml)) fileid, fileurl, slaves, encslaves, s3_fileurl, s3_slaves = fc.parse_request(req_xml) -chksum_xml = fc.do_checksum(random.choice(encslaves), fileurl, fileurl) -print(fc.pretty_xml(chksum_xml)) -file_addr, sha1_body, sha1_enc_footer, sha1_footer = fc.parse_checksum(chksum_xml) +if len(encslaves) > 0: + chksum_xml = fc.do_checksum(random.choice(encslaves), fileurl, fileurl) + print(fc.pretty_xml(chksum_xml)) + file_addr, sha1_body, sha1_enc_footer, sha1_footer = fc.parse_checksum(chksum_xml) for s in slaves: print("http://{}{}".format(s, fileurl)) diff --git a/tcllib.py b/tcllib.py index ab1cd5e..4ef6d2c 100644 --- a/tcllib.py +++ b/tcllib.py @@ -383,7 +383,10 @@ class FotaCheck: file = root.find("FILE_LIST").find("FILE") fileid = file.find("FILE_ID").text fileurl = file.find("DOWNLOAD_URL").text - s3_fileurl = file.find("S3_DOWNLOAD_URL").text + s3_fileurl_node = file.find("S3_DOWNLOAD_URL") + s3_fileurl = "" + if s3_fileurl_node: + s3_fileurl = s3_fileurl_node.text slave_list = root.find("SLAVE_LIST").findall("SLAVE") enc_list = root.find("SLAVE_LIST").findall("ENCRYPT_SLAVE") s3_slave_list = root.find("SLAVE_LIST").findall("S3_SLAVE")