Fix NoneType in create_router.py
[snaps.git] / snaps / openstack / os_credentials.py
index 6f25237..7cb5650 100644 (file)
@@ -15,7 +15,7 @@
 from neutronclient.common.utils import str2bool
 import numbers
 from snaps import file_utils
-from snaps.openstack.utils import glance_utils, keystone_utils
+from snaps.openstack.utils import glance_utils, keystone_utils, cinder_utils
 
 __author__ = 'spisarski'
 
@@ -42,6 +42,10 @@ class OSCreds:
                                     clients
         :param heat_api_version: The OpenStack's API version to use for Heat
                                     clients
+        :param volume_api_version: The OpenStack's API version to use
+                                   for Cinder clients
+        :param magnum_api_version: The OpenStack's API version to use
+                                   for magnum clients
         :param user_domain_id: Used for v3 APIs (default='default')
         :param user_domain_name: Used for v3 APIs (default='Default')
         :param project_domain_id: Used for v3 APIs (default='default')
@@ -49,10 +53,8 @@ class OSCreds:
         :param interface: Used to specify the endpoint type for keystone as
                           public, admin, internal
         :param proxy_settings: instance of os_credentials.ProxySettings class
-        :param cacert: Default to be True for http, or the certification file
-                       is specified for https verification, or set to be False
-                       to disable server certificate verification without cert
-                       file
+        :param cacert: True for https or the certification file for https
+                       verification (default=False)
         :param region_name: the region (optional default = None)
         """
         self.username = kwargs.get('username')
@@ -83,7 +85,19 @@ class OSCreds:
         if kwargs.get('heat_api_version') is None:
             self.heat_api_version = 1
         else:
-            self.heat_api_version = float(kwargs['heat_api_version'])
+            val = kwargs['heat_api_version']
+            ver = float(val)
+            self.heat_api_version = int(ver)
+
+        if kwargs.get('volume_api_version') is None:
+            self.volume_api_version = cinder_utils.VERSION_2
+        else:
+            self.volume_api_version = float(kwargs['volume_api_version'])
+
+        if kwargs.get('magnum_api_version') is None:
+            self.magnum_api_version = 1
+        else:
+            self.magnum_api_version = float(kwargs['magnum_api_version'])
 
         self.user_domain_id = kwargs.get('user_domain_id', 'default')
 
@@ -157,7 +171,6 @@ class OSCreds:
 
         return new_url
 
-    @property
     def __str__(self):
         """Converts object to a string"""
         return ('OSCreds - username=' + str(self.username) +
@@ -192,7 +205,6 @@ class ProxySettings:
         :param port: the HTTP proxy port
         :param https_host: the HTTPS proxy host (defaults to host)
         :param https_port: the HTTPS proxy port (defaults to port)
-        :param port: the HTTP proxy port
         :param ssh_proxy_cmd: the SSH proxy command string (optional)
         """
         self.host = kwargs.get('host')