Merge pull request #43341 from ixs/fedora-rh_ip

Fix rh_ip template use for Fedora
This commit is contained in:
Mike Place 2017-09-11 10:30:53 -06:00 committed by GitHub
commit 2964707e5d
2 changed files with 5 additions and 2 deletions

View File

@ -1013,6 +1013,9 @@ def build_interface(iface, iface_type, enabled, **settings):
salt '*' ip.build_interface eth0 eth <settings>
'''
if __grains__['os'] == 'Fedora':
if __grains__['osmajorrelease'] >= 18:
rh_major = '7'
else:
rh_major = '6'
else:
rh_major = __grains__['osrelease'][:1]

View File

@ -58,7 +58,7 @@ class RhipTestCase(TestCase, LoaderModuleMockMixin):
'''
Test to build an interface script for a network interface.
'''
with patch.dict(rh_ip.__grains__, {'os': 'Fedora'}):
with patch.dict(rh_ip.__grains__, {'os': 'Fedora', 'osmajorrelease': 26}):
with patch.object(rh_ip, '_raise_error_iface', return_value=None):
self.assertRaises(AttributeError,