Merge "Update ODL tag to release/carbon"
[functest.git] / functest / utils / openstack_clean.py
old mode 100755 (executable)
new mode 100644 (file)
index b516789..d7df8f8
@@ -23,7 +23,6 @@
 #
 
 import logging
-import sys
 import time
 import yaml
 
@@ -148,8 +147,8 @@ def remove_floatingips(neutron_client, default_floatingips):
     init_len = len(floatingips)
     deleted = 0
     for fip in floatingips:
-        fip_id = getattr(fip, 'id')
-        fip_ip = getattr(fip, 'ip')
+        fip_id = fip['id']
+        fip_ip = fip['floating_ip_address']
         logger.debug("'%s', ID=%s " % (fip_ip, fip_id))
         if (fip_id not in default_floatingips and
                 fip_ip not in default_floatingips.values()):
@@ -382,6 +381,7 @@ def remove_tenants(keystone_client, default_tenants):
 
 
 def main():
+    logging.basicConfig()
     logger.info("Cleaning OpenStack resources...")
 
     nova_client = os_utils.get_nova_client()
@@ -430,8 +430,3 @@ def main():
     remove_tenants(keystone_client, default_tenants)
     separator()
     return 0
-
-
-if __name__ == '__main__':
-    logging.basicConfig()
-    sys.exit(main())