From da86365cceb431a6920f0dd4b921a3855cc403ca Mon Sep 17 00:00:00 2001 From: Tamas Plugor Date: Fri, 3 Feb 2023 22:10:22 +0000 Subject: [PATCH 1/3] adding support for downloading CVP Open-Ports PDFs --- eos_download.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eos_download.py b/eos_download.py index 9b3e42c..ee0ee33 100644 --- a/eos_download.py +++ b/eos_download.py @@ -169,6 +169,8 @@ def get_file_list(image, img): filename.append(image[:4] + "rpm-installer-" + image[4:]) elif img == 'upgrade': filename.append(image[:4] + "upgrade-" + image[4:] + ".tgz") + elif img == 'ports': + filename.append("CloudVision-" + image[4:] + "-Open-Ports-") else: # otherwise it's a normal EOS image they're after index = 'EOS' # corresponds to "EOS" top level folder if img == 'cEOS': @@ -228,7 +230,7 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve, else: return True # next check CVP images - if img == ('ova') or img == ('kvm') or img == ('upgrade') or img == ('rpm'): + if img == ('ova') or img == ('kvm') or img == ('upgrade') or img == ('rpm') or img == ('ports'): test = re.compile('^cvp-[0-9][0-9][0-9][0-9]\.[0-9]\.[0-9]$') cvp_valid = test.match(image) if not cvp_valid: @@ -343,6 +345,9 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve, path = grandchild.attrib['path'] elif grandchild.text == (filename_list[0] + '.md5'): sha512_path = grandchild.attrib['path'] # corresponds to the download path of the MD5 checksum + elif ('Open-Ports' in grandchild.text) and (filename_list[0] in grandchild.text): + filename_list[0] = grandchild.text + path = grandchild.attrib['path'] # corresponds to the download path elif child.attrib == {'label': "CVP IPAM Application"} and img == "ipam": for grandchild in child.iter('file'): #print(grandchild.text) @@ -403,7 +408,7 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve, download_file(download_link, filename_list[1]) - if (img != 'source') and (img != 'RN'): + if (img != 'source') and (img != 'RN') and (img != 'ports'): jsonpost = {'sessionCode': session_code, 'filePath': sha512_path} sha512_result = requests.post(download_link_url, data=json.dumps(jsonpost)) sha512_download_link = (sha512_result.json()["data"]["url"]) From fe46c37313ab12a70d6fdc268629d04dbb307c03 Mon Sep 17 00:00:00 2001 From: Tamas Plugor Date: Fri, 3 Feb 2023 22:13:00 +0000 Subject: [PATCH 2/3] Revert "adding support for downloading CVP Open-Ports PDFs" This reverts commit da86365cceb431a6920f0dd4b921a3855cc403ca. --- eos_download.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/eos_download.py b/eos_download.py index ee0ee33..9b3e42c 100644 --- a/eos_download.py +++ b/eos_download.py @@ -169,8 +169,6 @@ def get_file_list(image, img): filename.append(image[:4] + "rpm-installer-" + image[4:]) elif img == 'upgrade': filename.append(image[:4] + "upgrade-" + image[4:] + ".tgz") - elif img == 'ports': - filename.append("CloudVision-" + image[4:] + "-Open-Ports-") else: # otherwise it's a normal EOS image they're after index = 'EOS' # corresponds to "EOS" top level folder if img == 'cEOS': @@ -230,7 +228,7 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve, else: return True # next check CVP images - if img == ('ova') or img == ('kvm') or img == ('upgrade') or img == ('rpm') or img == ('ports'): + if img == ('ova') or img == ('kvm') or img == ('upgrade') or img == ('rpm'): test = re.compile('^cvp-[0-9][0-9][0-9][0-9]\.[0-9]\.[0-9]$') cvp_valid = test.match(image) if not cvp_valid: @@ -345,9 +343,6 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve, path = grandchild.attrib['path'] elif grandchild.text == (filename_list[0] + '.md5'): sha512_path = grandchild.attrib['path'] # corresponds to the download path of the MD5 checksum - elif ('Open-Ports' in grandchild.text) and (filename_list[0] in grandchild.text): - filename_list[0] = grandchild.text - path = grandchild.attrib['path'] # corresponds to the download path elif child.attrib == {'label': "CVP IPAM Application"} and img == "ipam": for grandchild in child.iter('file'): #print(grandchild.text) @@ -408,7 +403,7 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve, download_file(download_link, filename_list[1]) - if (img != 'source') and (img != 'RN') and (img != 'ports'): + if (img != 'source') and (img != 'RN'): jsonpost = {'sessionCode': session_code, 'filePath': sha512_path} sha512_result = requests.post(download_link_url, data=json.dumps(jsonpost)) sha512_download_link = (sha512_result.json()["data"]["url"]) From 220174d0532ae262e44499663991a9425eaf0ee2 Mon Sep 17 00:00:00 2001 From: Tamas Plugor Date: Fri, 3 Feb 2023 22:13:24 +0000 Subject: [PATCH 3/3] adding support for downloading CVP Open-Ports PDFs --- eos_download.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eos_download.py b/eos_download.py index 9b3e42c..ee0ee33 100644 --- a/eos_download.py +++ b/eos_download.py @@ -169,6 +169,8 @@ def get_file_list(image, img): filename.append(image[:4] + "rpm-installer-" + image[4:]) elif img == 'upgrade': filename.append(image[:4] + "upgrade-" + image[4:] + ".tgz") + elif img == 'ports': + filename.append("CloudVision-" + image[4:] + "-Open-Ports-") else: # otherwise it's a normal EOS image they're after index = 'EOS' # corresponds to "EOS" top level folder if img == 'cEOS': @@ -228,7 +230,7 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve, else: return True # next check CVP images - if img == ('ova') or img == ('kvm') or img == ('upgrade') or img == ('rpm'): + if img == ('ova') or img == ('kvm') or img == ('upgrade') or img == ('rpm') or img == ('ports'): test = re.compile('^cvp-[0-9][0-9][0-9][0-9]\.[0-9]\.[0-9]$') cvp_valid = test.match(image) if not cvp_valid: @@ -343,6 +345,9 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve, path = grandchild.attrib['path'] elif grandchild.text == (filename_list[0] + '.md5'): sha512_path = grandchild.attrib['path'] # corresponds to the download path of the MD5 checksum + elif ('Open-Ports' in grandchild.text) and (filename_list[0] in grandchild.text): + filename_list[0] = grandchild.text + path = grandchild.attrib['path'] # corresponds to the download path elif child.attrib == {'label': "CVP IPAM Application"} and img == "ipam": for grandchild in child.iter('file'): #print(grandchild.text) @@ -403,7 +408,7 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve, download_file(download_link, filename_list[1]) - if (img != 'source') and (img != 'RN'): + if (img != 'source') and (img != 'RN') and (img != 'ports'): jsonpost = {'sessionCode': session_code, 'filePath': sha512_path} sha512_result = requests.post(download_link_url, data=json.dumps(jsonpost)) sha512_download_link = (sha512_result.json()["data"]["url"])