Requires python-ordereddict only if Centos6
OrderedDict class is a part of collections module since at least python2.7 which is default python version for Centos 7. For making it possible to use this code both on python26 and on python27 we wrap ordereddict imports into try/except. Change-Id: I877506a8f039e86480c287e03387b9a3689d870e Closes-Bug: #1509464
This commit is contained in:
parent
a918dcccd7
commit
4000f153d9
|
@ -15,7 +15,12 @@
|
|||
import collections
|
||||
import logging
|
||||
|
||||
from ordereddict import OrderedDict
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
except Exception:
|
||||
# python 2.6 or earlier use backport
|
||||
from ordereddict import OrderedDict
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
|
|
|
@ -14,8 +14,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
except Exception:
|
||||
# python 2.6 or earlier use backport
|
||||
from ordereddict import OrderedDict
|
||||
import mock
|
||||
import ordereddict
|
||||
|
||||
from fuelmenu import settings
|
||||
|
||||
|
@ -38,11 +42,11 @@ sample:
|
|||
}
|
||||
]
|
||||
}
|
||||
assert isinstance(data, ordereddict.OrderedDict)
|
||||
assert isinstance(data, OrderedDict)
|
||||
|
||||
|
||||
@mock.patch('fuelmenu.settings.file', side_effect=Exception('Error'))
|
||||
def test_read_settings_with_error(_):
|
||||
data = settings.Settings().read('some_path')
|
||||
assert data == {}
|
||||
assert isinstance(data, ordereddict.OrderedDict)
|
||||
assert isinstance(data, OrderedDict)
|
||||
|
|
|
@ -22,9 +22,11 @@ Requires: python-netaddr
|
|||
Requires: python-netifaces
|
||||
Requires: python-urwid >= 1.1.0
|
||||
Requires: PyYAML
|
||||
Requires: python-ordereddict
|
||||
Requires: screen
|
||||
Requires: python-six
|
||||
%if 0%{?rhel} == 6
|
||||
Requires: python-ordereddict
|
||||
%endif
|
||||
|
||||
%description
|
||||
Summary: Console utility for pre-configuration of Fuel server
|
||||
|
|
Loading…
Reference in New Issue