mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2015.5' into '2015.8'
Conflicts: - tests/unit/modules/boto_vpc_test.py
This commit is contained in:
commit
8e36e90966
1 changed files with 24 additions and 12 deletions
|
@ -6,6 +6,8 @@
|
|||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
from distutils.version import LooseVersion # pylint: disable=import-error,no-name-in-module
|
||||
import pkg_resources
|
||||
from pkg_resources import DistributionNotFound
|
||||
|
||||
# Import Salt Testing libs
|
||||
from salttesting.unit import skipIf, TestCase
|
||||
|
@ -90,6 +92,19 @@ def _has_required_boto():
|
|||
return True
|
||||
|
||||
|
||||
def _get_moto_version():
|
||||
'''
|
||||
Returns the moto version
|
||||
'''
|
||||
try:
|
||||
return LooseVersion(moto.__version__)
|
||||
except AttributeError:
|
||||
try:
|
||||
return LooseVersion(pkg_resources.get_distribution('moto').version)
|
||||
except DistributionNotFound:
|
||||
return False
|
||||
|
||||
|
||||
def _has_required_moto():
|
||||
'''
|
||||
Returns True/False boolean depending on if Moto is installed and correct
|
||||
|
@ -98,17 +113,8 @@ def _has_required_moto():
|
|||
if not HAS_MOTO:
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
if LooseVersion(moto.__version__) < LooseVersion(required_moto_version):
|
||||
return False
|
||||
except AttributeError:
|
||||
import pkg_resources
|
||||
from pkg_resources import DistributionNotFound
|
||||
try:
|
||||
if LooseVersion(pkg_resources.get_distribution('moto').version) < LooseVersion(required_moto_version):
|
||||
return False
|
||||
except DistributionNotFound:
|
||||
return False
|
||||
if _get_moto_version() < LooseVersion(required_moto_version):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
@ -488,13 +494,19 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
|||
'''
|
||||
Tests describing parameters via vpc id if vpc exist
|
||||
'''
|
||||
# With moto 0.4.25 is_default is set to True. 0.4.24 and older, is_default is False
|
||||
if _get_moto_version() >= LooseVersion('0.4.25'):
|
||||
is_default = True
|
||||
else:
|
||||
is_default = False
|
||||
|
||||
vpc = self._create_vpc(name='test', tags={'test': 'testvalue'})
|
||||
|
||||
describe_vpc = boto_vpc.describe(vpc_id=vpc.id, **conn_parameters)
|
||||
|
||||
vpc_properties = dict(id=vpc.id,
|
||||
cidr_block=six.text_type(cidr_block),
|
||||
is_default=False,
|
||||
is_default=is_default,
|
||||
state=u'available',
|
||||
tags={u'Name': u'test', u'test': u'testvalue'},
|
||||
dhcp_options_id=u'dopt-7a8b9c2d',
|
||||
|
|
Loading…
Add table
Reference in a new issue