From 08cda6a3ba07b80a149ec7fa5ca54660d2cc5a11 Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 16 Apr 2019 09:21:26 -0400 Subject: [PATCH 1/7] catch jobzid not found errors --- azure/Jenkins_proj-master/deploy.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/azure/Jenkins_proj-master/deploy.py b/azure/Jenkins_proj-master/deploy.py index be7f978a..c3b99af0 100644 --- a/azure/Jenkins_proj-master/deploy.py +++ b/azure/Jenkins_proj-master/deploy.py @@ -91,22 +91,23 @@ def update_fw(fwMgtIP, api_key): call = "https://%s/api/?type=%s&cmd=%s&key=%s" % (fwMgtIP, type, cmd, api_key) try: r = send_request(call) - except: - DeployRequestException + except DeployRequestException: logger.debug("failed to get jobid this time. Try again") else: tree = ET.fromstring(r.text) jobid = tree[0][1].text print("Download latest Applications and Threats update - " + str(jobid)) completed = 0 - while (completed == 0): + while completed == 0: time.sleep(10) call = "https://%s/api/?type=op&cmd=%s&key=%s" % (fwMgtIP, jobid, api_key) try: r = send_request(call) logger.info('Response to show jobs was {}'.format(r.text)) - except: - DeployRequestException + if 'not found' in r.text: + raise DeployRequestException(r.text) + + except DeployRequestException: logger.debug("failed to get jobid this time. Try again") else: tree = ET.fromstring(r.text) From 9cef825c13a77319fd6e74f83e70213bcc43bb98 Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 16 Apr 2019 15:11:36 -0400 Subject: [PATCH 2/7] attempt to prevent infinite looping --- azure/Jenkins_proj-master/deploy.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/azure/Jenkins_proj-master/deploy.py b/azure/Jenkins_proj-master/deploy.py index c3b99af0..6be3620b 100644 --- a/azure/Jenkins_proj-master/deploy.py +++ b/azure/Jenkins_proj-master/deploy.py @@ -243,18 +243,23 @@ def getApiKey(hostname, username, password): Generate the API key from username / password ''' + print("getting api key") call = "https://%s/api/?type=keygen&user=%s&password=%s" % (hostname, username, password) api_key = "" + counter = 0 while True: try: # response = urllib.request.urlopen(url, data=encoded_data, context=ctx).read() response = send_request(call) - except DeployRequestException as updateerr: logger.info("No response from FW. Wait 20 secs before retry") time.sleep(10) + counter = counter + 1 + if counter >= 30: + raise Exception('Could not contact the firewall with the ip and credentials given') + continue else: @@ -543,8 +548,14 @@ def main(username, password, rg_name): api_key = getApiKey(fwMgtIP, username, password) + status_counter = 0 while True: err = getFirewallStatus(fwMgtIP, api_key) + status_couter = status_couter + 1 + if status_counter > 15: + print('Taking too long to get firewall status!') + exit(1) + if err == 'cmd_error': logger.info("Command error from fw ") From ebbc0a35a180917a63a3fd60e4d96fe4b32b8089 Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 29 May 2020 09:06:33 -0400 Subject: [PATCH 3/7] fix for #23 --- azure/Jenkins_proj-master/WebInBootstrap/resourcegroup.tf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure/Jenkins_proj-master/WebInBootstrap/resourcegroup.tf b/azure/Jenkins_proj-master/WebInBootstrap/resourcegroup.tf index 7c24c105..dd5c525f 100644 --- a/azure/Jenkins_proj-master/WebInBootstrap/resourcegroup.tf +++ b/azure/Jenkins_proj-master/WebInBootstrap/resourcegroup.tf @@ -1,5 +1,7 @@ # Configure the Microsoft Azure Provider -provider "azurerm" {} +provider "azurerm" { + version = "~> 1.44" +} resource "random_id" "resource_group" { byte_length = 2 From 2220437e122bc033cb51963cebf89d038bce2a5f Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 29 May 2020 09:15:16 -0400 Subject: [PATCH 4/7] bump zope.interfaces rev for #24 --- azure/Jenkins_proj-master/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/Jenkins_proj-master/requirements.txt b/azure/Jenkins_proj-master/requirements.txt index f5126452..902c76a8 100644 --- a/azure/Jenkins_proj-master/requirements.txt +++ b/azure/Jenkins_proj-master/requirements.txt @@ -224,4 +224,4 @@ vsts-cd-manager==1.0.2 wcwidth==0.1.7 websocket-client==0.56.0 xmltodict==0.12.0 -zope.interface==4.6.0 +zope.interface==5.1.0 From 7d7740bdc98490376433daab222d119fe3ddb01e Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 1 Mar 2021 10:30:20 -0500 Subject: [PATCH 5/7] simplify requirements --- .../.pan-cnc/login/.meta-cnc.yaml | 2 +- azure/Jenkins_proj-master/requirements.txt | 220 +----------------- 2 files changed, 3 insertions(+), 219 deletions(-) diff --git a/azure/Jenkins_proj-master/.pan-cnc/login/.meta-cnc.yaml b/azure/Jenkins_proj-master/.pan-cnc/login/.meta-cnc.yaml index 8e3c95eb..4e62720a 100644 --- a/azure/Jenkins_proj-master/.pan-cnc/login/.meta-cnc.yaml +++ b/azure/Jenkins_proj-master/.pan-cnc/login/.meta-cnc.yaml @@ -1,4 +1,4 @@ -name: azure_login +name: azure_login_csf label: Azure Login (Pre-Deployment Step) description: | diff --git a/azure/Jenkins_proj-master/requirements.txt b/azure/Jenkins_proj-master/requirements.txt index 902c76a8..1dbcc8ee 100644 --- a/azure/Jenkins_proj-master/requirements.txt +++ b/azure/Jenkins_proj-master/requirements.txt @@ -1,227 +1,11 @@ -adal==1.2.1 -amqp==2.4.2 -antlr4-python3-runtime==4.7.2 -applicationinsights==0.11.7 -argcomplete==1.9.5 -asgiref==3.0.0 -asn1crypto==0.24.0 -async-timeout==3.0.1 -atomicwrites==1.3.0 -attrs==19.1.0 -autobahn==19.3.3 -Automat==0.7.0 -azure-batch==6.0.0 -azure-cli==2.0.63 -azure-cli-acr==2.2.5 -azure-cli-acs==2.3.22 -azure-cli-advisor==2.0.0 -azure-cli-ams==0.4.5 -azure-cli-appservice==0.2.18 -azure-cli-backup==1.2.4 -azure-cli-batch==4.0.0 -azure-cli-batchai==0.4.8 -azure-cli-billing==0.2.1 -azure-cli-botservice==0.1.10 -azure-cli-cdn==0.2.3 -azure-cli-cloud==2.1.1 -azure-cli-cognitiveservices==0.2.5 -azure-cli-command-modules-nspkg==2.0.2 -azure-cli-configure==2.0.22 -azure-cli-consumption==0.4.2 -azure-cli-container==0.3.16 -azure-cli-core==2.0.63 -azure-cli-cosmosdb==0.2.10 -azure-cli-deploymentmanager==0.1.0 -azure-cli-dla==0.2.5 -azure-cli-dls==0.1.9 -azure-cli-dms==0.1.3 -azure-cli-eventgrid==0.2.3 -azure-cli-eventhubs==0.3.4 -azure-cli-extension==0.2.5 -azure-cli-feedback==2.2.1 -azure-cli-find==0.3.2 -azure-cli-hdinsight==0.3.3 -azure-cli-interactive==0.4.3 -azure-cli-iot==0.3.8 -azure-cli-iotcentral==0.1.6 -azure-cli-keyvault==2.2.14 -azure-cli-kusto==0.2.2 -azure-cli-lab==0.1.7 -azure-cli-maps==0.3.4 -azure-cli-monitor==0.2.13 -azure-cli-network==2.3.7 -azure-cli-nspkg==3.0.3 -azure-cli-policyinsights==0.1.2 -azure-cli-privatedns==1.0.0 -azure-cli-profile==2.1.5 -azure-cli-rdbms==0.3.10 -azure-cli-redis==0.4.2 -azure-cli-relay==0.1.4 -azure-cli-reservations==0.4.2 -azure-cli-resource==2.1.14 -azure-cli-role==2.6.0 -azure-cli-search==0.1.1 -azure-cli-security==0.1.1 -azure-cli-servicebus==0.3.4 -azure-cli-servicefabric==0.1.17 -azure-cli-signalr==1.0.0 -azure-cli-sql==2.2.2 -azure-cli-sqlvm==0.1.1 -azure-cli-storage==2.4.1 -azure-cli-telemetry==1.0.2 -azure-cli-vm==2.2.19 -azure-common==1.1.20 -azure-datalake-store==0.0.39 -azure-functions-devops-build==0.0.21 -azure-graphrbac==0.60.0 -azure-keyvault==1.1.0 -azure-mgmt-advisor==2.0.1 -azure-mgmt-applicationinsights==0.1.1 -azure-mgmt-authorization==0.50.0 -azure-mgmt-batch==6.0.0 -azure-mgmt-batchai==2.0.0 -azure-mgmt-billing==0.2.0 -azure-mgmt-botservice==0.1.0 -azure-mgmt-cdn==3.1.0 -azure-mgmt-cognitiveservices==3.0.0 -azure-mgmt-compute==4.6.1 -azure-mgmt-consumption==2.0.0 -azure-mgmt-containerinstance==1.4.0 -azure-mgmt-containerregistry==2.7.0 -azure-mgmt-containerservice==4.4.0 -azure-mgmt-cosmosdb==0.5.2 -azure-mgmt-datalake-analytics==0.2.1 -azure-mgmt-datalake-nspkg==3.0.1 -azure-mgmt-datalake-store==0.5.0 -azure-mgmt-datamigration==0.1.0 -azure-mgmt-deploymentmanager==0.1.0 -azure-mgmt-devtestlabs==2.2.0 -azure-mgmt-dns==2.1.0 -azure-mgmt-eventgrid==2.0.0 -azure-mgmt-eventhub==2.3.0 -azure-mgmt-hdinsight==0.2.1 -azure-mgmt-iotcentral==1.0.0 -azure-mgmt-iothub==0.7.0 -azure-mgmt-iothubprovisioningservices==0.2.0 -azure-mgmt-keyvault==1.1.0 -azure-mgmt-kusto==0.3.0 -azure-mgmt-loganalytics==0.2.0 -azure-mgmt-managementgroups==0.1.0 -azure-mgmt-maps==0.1.0 -azure-mgmt-marketplaceordering==0.1.0 -azure-mgmt-media==1.1.1 -azure-mgmt-monitor==0.5.2 -azure-mgmt-msi==0.2.0 -azure-mgmt-network==2.6.0 -azure-mgmt-nspkg==3.0.2 -azure-mgmt-policyinsights==0.2.0 -azure-mgmt-privatedns==0.1.0 -azure-mgmt-rdbms==1.7.1 -azure-mgmt-recoveryservices==0.1.1 -azure-mgmt-recoveryservicesbackup==0.1.2 -azure-mgmt-redis==6.0.0 -azure-mgmt-relay==0.1.0 -azure-mgmt-reservations==0.3.1 -azure-mgmt-resource==2.1.0 -azure-mgmt-search==2.0.0 -azure-mgmt-security==0.1.0 -azure-mgmt-servicebus==0.5.3 -azure-mgmt-servicefabric==0.2.0 -azure-mgmt-signalr==0.1.1 -azure-mgmt-sql==0.12.0 -azure-mgmt-sqlvirtualmachine==0.2.0 -azure-mgmt-storage==3.1.1 -azure-mgmt-trafficmanager==0.51.0 -azure-mgmt-web==0.41.0 -azure-multiapi-storage==0.2.3 -azure-nspkg==3.0.2 +azure-cli==2.7.0 azure-storage==0.36.0 azure-storage-blob==1.3.1 azure-storage-common==1.4.0 azure-storage-file==1.4.0 azure-storage-nspkg==3.1.0 -bcrypt==3.1.6 -billiard==3.6.0.0 -celery==4.3.0 -certifi==2019.3.9 -cffi==1.12.3 -chardet==3.0.4 -collections2==0.3.0 -colorama==0.4.1 -constantly==15.1.0 -cryptography==2.4.2 -decorator==4.4.0 -Django==2.2.8 -django-widget-tweaks==1.4.3 -docker==3.7.2 -docker-pycreds==0.4.0 -fabric==2.4.0 -gitdb2==2.0.5 -GitPython==2.1.11 -gunicorn==19.9.0 -humanfriendly==4.18 -hyperlink==18.0.0 -idna==2.8 -incremental==17.5.0 -invoke==1.2.0 -ipaddress==1.0.22 -isodate==0.6.0 -Jinja2==2.10.1 -jmespath==0.9.4 -jsonpath-ng==1.4.3 -knack==0.5.4 -kombu==4.5.0 -MarkupSafe==1.1.1 -mock==2.0.0 -more-itertools==7.0.0 -msrest==0.6.6 -msrestazure==0.6.0 -oauthlib==3.0.1 -oyaml==0.9 -pan-python==0.14.0 +pan-python==0.16.0 pandevice==0.6.6 -paramiko==2.4.2 -passlib==1.7.1 -pbr==5.2.0 -pluggy==0.9.0 -ply==3.11 -portalocker==1.2.1 -prompt-toolkit==1.0.15 -psutil==5.6.6 -py==1.8.0 -pyAesCrypt==0.4.2 -pyasn1==0.4.5 -pycparser==2.19 -pydocumentdb==2.3.3 -Pygments==2.3.1 -PyHamcrest==1.9.0 -PyJWT==1.7.1 -PyNaCl==1.3.0 -pyOpenSSL==19.0.0 -pyperclip==1.7.0 -pytest==4.4.0 -pytest-django==3.4.8 -python-dateutil==2.8.0 python-terraform==0.10.0 -pytz==2019.1 -PyYAML==5.1 -requests==2.21.0 -requests-oauthlib==1.2.0 -scp==0.13.2 -six==1.12.0 -smmap2==2.0.5 -sqlparse==0.3.0 sshtunnel==0.1.4 -tabulate==0.8.3 -twisted>=19.7.0 -txaio==18.8.1 -urllib3==1.24.2 -vine==1.3.0 -virtualenv==16.4.3 -virtualenv-clone==0.5.2 -vsts==0.1.25 -vsts-cd-manager==1.0.2 -wcwidth==0.1.7 -websocket-client==0.56.0 -xmltodict==0.12.0 zope.interface==5.1.0 From 80a60ca8334bc7e3a2312f22c7eeda11a2a89bb1 Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 1 Mar 2021 10:39:28 -0500 Subject: [PATCH 6/7] fixes for #23 for webinDeploy --- azure/Jenkins_proj-master/WebInDeploy/vnet-subnets.tf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azure/Jenkins_proj-master/WebInDeploy/vnet-subnets.tf b/azure/Jenkins_proj-master/WebInDeploy/vnet-subnets.tf index 12c64ba4..bbbc875c 100644 --- a/azure/Jenkins_proj-master/WebInDeploy/vnet-subnets.tf +++ b/azure/Jenkins_proj-master/WebInDeploy/vnet-subnets.tf @@ -1,5 +1,8 @@ # Configure the Microsoft Azure Provider -provider "azurerm" {} +provider "azurerm" { + version = "~> 1.44" + features {} +} data "azurerm_resource_group" "resourcegroup" { name = "${var.RG_Name}" From 277f343d96e767e8b063c7f551814d04969695e2 Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 1 Mar 2021 11:54:44 -0500 Subject: [PATCH 7/7] fix typo in status_counter --- azure/Jenkins_proj-master/deploy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/Jenkins_proj-master/deploy.py b/azure/Jenkins_proj-master/deploy.py index 6328d84e..19cd5a43 100644 --- a/azure/Jenkins_proj-master/deploy.py +++ b/azure/Jenkins_proj-master/deploy.py @@ -648,7 +648,7 @@ def main(username, password, rg_name, azure_region): status_counter = 0 while True: err = getFirewallStatus(fwMgtIP, api_key) - status_couter = status_couter + 1 + status_counter = status_counter + 1 if status_counter > 15: print('Taking too long to get firewall status!') exit(1)