diff --git a/salt/modules/rh_ip.py b/salt/modules/rh_ip.py index 668a648504..93d2fb1caa 100644 --- a/salt/modules/rh_ip.py +++ b/salt/modules/rh_ip.py @@ -8,7 +8,6 @@ from __future__ import absolute_import import logging import os.path import os -import StringIO # Import third party libs import jinja2 @@ -19,6 +18,7 @@ import salt.utils import salt.utils.templates import salt.utils.validate.net import salt.ext.six as six +from salt.ext.six.moves import StringIO # Set up logging log = logging.getLogger(__name__) @@ -841,7 +841,7 @@ def _write_file_network(data, filename): def _read_temp(data): - tout = StringIO.StringIO() + tout = StringIO() tout.write(data) tout.seek(0) output = tout.read().splitlines() # Discard newlines @@ -957,7 +957,7 @@ def build_routes(iface, **settings): ''' template = 'rh6_route_eth.jinja' - if __grains__['osrelease'][:1] < 6: + if float(__grains__['osrelease']) < 6: template = 'route_eth.jinja' log.debug('Template name: ' + template) diff --git a/tests/unit/modules/rh_ip_test.py b/tests/unit/modules/rh_ip_test.py index 504570e87f..e6cc5d3a47 100644 --- a/tests/unit/modules/rh_ip_test.py +++ b/tests/unit/modules/rh_ip_test.py @@ -99,7 +99,7 @@ class RhipTestCase(TestCase): ''' Test to build a route script for a network interface. ''' - with patch.dict(rh_ip.__grains__, {'osrelease': 'osrelease'}): + with patch.dict(rh_ip.__grains__, {'osrelease': '5.0'}): with patch.object(rh_ip, '_parse_routes', MagicMock()): mock = jinja2.exceptions.TemplateNotFound('foo') with patch.object(jinja2.Environment,