summaryrefslogtreecommitdiffstats
path: root/tosca2heat/heat-translator/translator/common
diff options
context:
space:
mode:
Diffstat (limited to 'tosca2heat/heat-translator/translator/common')
-rw-r--r--tosca2heat/heat-translator/translator/common/utils.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tosca2heat/heat-translator/translator/common/utils.py b/tosca2heat/heat-translator/translator/common/utils.py
index 459b5ee..8e4b690 100644
--- a/tosca2heat/heat-translator/translator/common/utils.py
+++ b/tosca2heat/heat-translator/translator/common/utils.py
@@ -18,6 +18,7 @@ import numbers
import os
import re
import requests
+import six
from six.moves.urllib.parse import urlparse
import yaml
@@ -262,12 +263,17 @@ class UrlUtils(object):
def str_to_num(value):
"""Convert a string representation of a number into a numeric type."""
- if isinstance(value, numbers.Number):
+ if isinstance(value, numbers.Number) \
+ or isinstance(value, six.integer_types) \
+ or isinstance(value, float):
return value
try:
return int(value)
except ValueError:
- return float(value)
+ try:
+ return float(value)
+ except ValueError:
+ return None
def check_for_env_variables():