for-azure icon indicating copy to clipboard operation
for-azure copied to clipboard

Error with 18.03 upgrade - NoneType object is not iterable

Open djeeg opened this issue 7 years ago • 3 comments

Hopefully im not jumping the gun here, 18.03 looks live on the releases page, and the template went active today (https://download.docker.com/azure/stable/18.03.0/Docker.tmpl)

Expected behavior

Upgrade starts

Actual behavior

ERROR: The upgrade process encountered errors:
Traceback (most recent call last):
  File "/usr/bin/azupgrade.py", line 456, in main
    update_deployment_template(args.template_url, resource_client)
  File "/usr/bin/azupgrade.py", line 239, in update_deployment_template
    target_template = adjust_template(template_url)
  File "/usr/bin/azupgrade.py", line 141, in adjust_template
    for lb_rule in lb_rules:
TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/usr/bin/azupgrade.py", line 490, in <module>
    main()
  File "/usr/bin/azupgrade.py", line 456, in main
    update_deployment_template(args.template_url, resource_client)
  File "/usr/bin/azupgrade.py", line 239, in update_deployment_template
    target_template = adjust_template(template_url)
  File "/usr/bin/azupgrade.py", line 141, in adjust_template
    for lb_rule in lb_rules:
TypeError: 'NoneType' object is not iterable

Steps to reproduce the behavior

swarm-manager000003:/$ docker --version
Docker version 17.12.0-ce, build c97c6d6
docker run \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /usr/bin/docker:/usr/bin/docker \
  -ti \
  docker4x/upgrade-azure:18.03-latest

I see that the error is in lb_rules. I have added some custom loadbalancer rules

image

This is because I am running traefik on managers with host mode networking to bypass ingress network (to get actual client IP within docker containers)

djeeg avatar Mar 26 '18 23:03 djeeg

@djeeg thanks for the quick report :) - I did a deployment qa, I'll check the upgrade.

FrenchBen avatar Mar 27 '18 00:03 FrenchBen

I dont see any loadBalancingRules in the template

Get the script

swarm-manager000003:$ docker ps -a | grep upgrade
6affa25f1b09        docker4x/upgrade-azure-core:18.03.0-ce-azure1                     "/usr/bin/upgrade.sh"    11 minutes ago      Exited (1) 11 minutes ago                                                         elated_babbage
7b8b1cd7fc06        docker4x/upgrade-azure:18.03-latest                               "/usr/bin/upgrade_wr…"   11 minutes ago      Exited (1) 11 minutes ago  
swarm-manager000003:/home/release/docker/stacks$ docker commit 6affa25f1b09 azureupgrade
swarm-manager000003:/home/release/docker/stacks$ docker run -ti --entrypoint /bin/bash azureupgrade
bash-4.3# find / -iname *azupgrade*
/opt/azupgrade.py
/opt/azupgrade_log_cfg.json
bash-4.3# cat /opt/azupgrade.py

Script seems to be looking for lbSSHName -> loadBalancingRules


        if resource['name'] == "[variables('lbSSHName')]":
            lb_rules = resource['properties'].get('loadBalancingRules')
            for lb_rule in lb_rules:
                if lb_rule['name'] == UCP_RULE_NAME:
                    lb_rule['properties']['backendPort'] = UCP_PORT
                    LOG.info("Set LB Rule for UCP to {}".format(UCP_PORT))

lbSSHName from template

        {
            "apiVersion": "[variables('apiVersion')]", 
            "dependsOn": [
                "[concat('Microsoft.Network/publicIPAddresses/', variables('lbSSHPublicIPAddressName'))]"
            ], 
            "location": "[resourceGroup().location]", 
            "name": "[variables('lbSSHName')]", 
            "properties": {
                "backendAddressPools": [
                    {
                        "name": "default"
                    }
                ], 
                "frontendIPConfigurations": [
                    {
                        "name": "default", 
                        "properties": {
                            "publicIPAddress": {
                                "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('lbSSHPublicIPAddressName'))]"
                            }
                        }
                    }
                ], 
                "inboundNatPools": [
                    {
                        "name": "default", 
                        "properties": {
                            "backendPort": 22, 
                            "frontendIPConfiguration": {
                                "id": "[variables('lbSSHFrontEndIPConfigID')]"
                            }, 
                            "frontendPortRangeEnd": "[variables('natSSHEndPort')]", 
                            "frontendPortRangeStart": "[variables('natSSHStartPort')]", 
                            "protocol": "tcp"
                        }
                    }
                ], 
                "probes": [
                    {
                        "name": "default", 
                        "properties": {
                            "intervalInSeconds": 10, 
                            "numberOfProbes": 2, 
                            "port": 22, 
                            "protocol": "Tcp"
                        }
                    }
                ]
            }, 
            "tags": {
                "channel": "[variables('channel')]", 
                "provider": "[toUpper(variables('DockerProviderTag'))]"
            }, 
            "type": "Microsoft.Network/loadBalancers"
        }

djeeg avatar Mar 27 '18 00:03 djeeg

Are there any updates on this issue?

khell avatar May 18 '18 02:05 khell