Skip to content
This repository was archived by the owner on Aug 14, 2019. It is now read-only.
This repository was archived by the owner on Aug 14, 2019. It is now read-only.

Digital Ocean IP addresses being swapped #6

Description

@rm-rf-etc

See DigitalOcean_ArangoDB_Cluster.sh, lines 697, 698, 701, 704.

At the step where directories are supposed to be created, the script can't gain SSH access, it just loops thru repeat attempts endlessly. I figured out that the script has swapped the internal and external IP's. I suspect DO may have changed their JSON, causing the order to change. Below shows that public (external) comes first, however, the script expects private first.

		"networks": {
			"v4": [
				{
					"ip_address": "138.67.249.178",
					"netmask": "255.255.240.0",
					"gateway": "128.67.241.1",
					"type": "public"
				},
				{
					"ip_address": "10.137.172.58",
					"netmask": "255.255.0.0",
					"gateway": "10.138.0.1",
					"type": "private"
				}
			],
			"v6": []
		},

I changed the code like this

      a=`echo $RESULT2 | python -mjson.tool | grep "\"ip_address\"" | head -n 1 | awk '{print $2}' | cut -c 2- | rev | cut -c 3- | rev`
      b=`echo $RESULT2 | python -mjson.tool | grep "\"ip_address\"" | head -n 2 | tail -1 |awk '{print $2}' | cut -c 2- | rev | cut -c 3- | rev`

      if [ -n "$a" ]; then
        echo $a > "$OUTPUT/temp/EXTERNAL$1"
      fi
      if [ -n "$b" ]; then
        echo $b > "$OUTPUT/temp/INTERNAL$1"
      fi

Now $a is stored in EXTERNAL and $b is stored in INTERNAL. This solved the problem, but the proper fix would be to improve the JSON parsing so as to store the IP in EXTERNAL which has "type": "public", and store the IP in INTERNAL which has the "type": "private".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions