Fix NoneType error when creating router 71/56171/1
authorLinda Wang <wangwulin@huawei.com>
Sat, 21 Apr 2018 02:31:09 +0000 (02:31 +0000)
committerLinda Wang <wangwulin@huawei.com>
Sat, 21 Apr 2018 02:31:09 +0000 (02:31 +0000)
Change-Id: Icef5f8a769b5c33da68b7da33ac8ba87132830e2
Signed-off-by: Linda Wang <wangwulin@huawei.com>
requirements.txt
snaps/openstack/create_router.py

index 5139ae7..91e67e6 100644 (file)
@@ -13,3 +13,4 @@ wrapt>=1.7.0 # BSD License
 scp
 cryptography>=2.1 # BSD/Apache-2.0
 concurrencytest
+six>=1.10.0 # MIT
index 260fc03..441b21a 100644 (file)
@@ -14,6 +14,8 @@
 # limitations under the License.
 import logging
 
+import six
+
 from neutronclient.common.exceptions import NotFound, Unauthorized
 
 from snaps.config.router import RouterConfig
@@ -149,7 +151,7 @@ class OpenStackRouter(OpenStackNetworkObject):
         :param sub_config:
         :return:
         """
-        if isinstance(sub_config, str):
+        if isinstance(sub_config, six.text_type):
             return neutron_utils.get_subnet_by_name(
                 self._neutron, self._keystone,
                 subnet_name=sub_config)