From 4f588059bc8f4a80f418afd714e624069db26712 Mon Sep 17 00:00:00 2001 From: Maarten de Waard <maarten@greenhost.nl> Date: Wed, 19 Jun 2019 15:51:18 +0200 Subject: [PATCH] small bugfix in cosmos api, failed on machines with 0 network configurations --- test/cosmos.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/cosmos.py b/test/cosmos.py index 705472329..9655052f4 100755 --- a/test/cosmos.py +++ b/test/cosmos.py @@ -2,15 +2,16 @@ """Python module with helper functions to use the cosmos API.""" import json +from datetime import datetime +from datetime import timedelta import logging import os import re -import requests import socket -from tabulate import tabulate from time import sleep -from datetime import datetime -from datetime import timedelta + +import requests +from tabulate import tabulate from pytz import timezone # Helper functions @@ -235,11 +236,13 @@ def list_droplets(): log.debug(json.dumps(droplets, sort_keys=True, indent=2)) - table_droplets = [[ - droplet['id'], - droplet['name'], - droplet['networks']['v4'][0]['ip_address'], - droplet['status']] + table_droplets = [ + [ + droplet['id'], + droplet['name'], + ', '.join([x['ip_address'] for x in droplet['networks']['v4']]), + droplet['status'] + ] for droplet in droplets] log.info(tabulate(table_droplets, -- GitLab