Skip to content
This repository has been archived by the owner on Jan 23, 2020. It is now read-only.

Error with 18.03 upgrade - NoneType object is not iterable #62

Open
djeeg opened this issue Mar 26, 2018 · 3 comments
Open

Error with 18.03 upgrade - NoneType object is not iterable #62

djeeg opened this issue Mar 26, 2018 · 3 comments

Comments

@djeeg
Copy link

djeeg commented Mar 26, 2018

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)

@FrenchBen
Copy link
Contributor

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

@djeeg
Copy link
Author

djeeg commented Mar 27, 2018

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"
        }

@khell
Copy link

khell commented May 18, 2018

Are there any updates on this issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants