Merge branch '2018.3' into 'fluorine'

No conflicts.
This commit is contained in:
rallytime 2018-09-06 12:20:52 -04:00
commit 0412c5654e
No known key found for this signature in database
GPG Key ID: E8F1A4B90D0DEA19
11 changed files with 72 additions and 9 deletions

View File

@ -4,5 +4,6 @@ yappi>=0.8.2
--allow-unverified python-novaclient>2.17.0
--allow-unverified python-neutronclient>2.3.6
python-gnupg
cherrypy>=3.2.2
cherrypy>=3.2.2,<18.0.0; python_version < '3.5'
cherrypy>=3.2.2; python_version >= '3.5'
libnacl

View File

@ -21,7 +21,8 @@ kubernetes<4.0
psutil
pyvmomi
setproctitle
cherrypy; sys.platform != 'win32' and sys.platform != 'darwin'
cherrypy>=3.2.2,<18.0.0; python_version < '3.5' and sys.platform != 'win32' and sys.platform != 'darwin'
cherrypy>=3.2.2; python_version >= '3.5' and sys.platform != 'win32' and sys.platform != 'darwin'
ldap; sys.platform != 'win32' and sys.platform != 'darwin'
pyinotify; sys.platform != 'win32' and sys.platform != 'darwin'
PyMySQL; sys.platform != 'win32' and sys.platform != 'darwin'

View File

@ -7,6 +7,8 @@ from __future__ import absolute_import, print_function, unicode_literals
import time
import logging
import salt.utils.stringutils
log = logging.getLogger(__name__)
_DEFAULT_SPLAYTIME = 300
@ -28,7 +30,7 @@ def _get_hash():
bitmask = 0xffffffff
h = 0
for i in bytearray(__grains__['id']):
for i in bytearray(salt.utils.stringutils.to_bytes(__grains__['id'])):
h = (h + i) & bitmask
h = (h + (h << 10)) & bitmask
h = (h ^ (h >> 6)) & bitmask

View File

@ -355,6 +355,10 @@ class Fileserver(object):
if not isinstance(back, list):
return ret
# Avoid error logging when performing lookups in the LazyDict by
# instead doing the membership check on the result of a call to its
# .keys() attribute rather than on the LaztDict itself.
server_funcs = self.servers.keys()
try:
subtract_only = all((x.startswith('-') for x in back))
except AttributeError:
@ -364,16 +368,16 @@ class Fileserver(object):
# Only subtracting backends from enabled ones
ret = self.opts['fileserver_backend']
for sub in back:
if '{0}.envs'.format(sub[1:]) in self.servers:
if '{0}.envs'.format(sub[1:]) in server_funcs:
ret.remove(sub[1:])
elif '{0}.envs'.format(sub[1:-2]) in self.servers:
elif '{0}.envs'.format(sub[1:-2]) in server_funcs:
ret.remove(sub[1:-2])
return ret
for sub in back:
if '{0}.envs'.format(sub) in self.servers:
if '{0}.envs'.format(sub) in server_funcs:
ret.append(sub)
elif '{0}.envs'.format(sub[:-2]) in self.servers:
elif '{0}.envs'.format(sub[:-2]) in server_funcs:
ret.append(sub[:-2])
return ret

View File

@ -6,6 +6,7 @@ import random
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.helpers import flaky
from tests.support.unit import skipIf
# Import Salt libs
@ -18,6 +19,7 @@ class StatusModuleTest(ModuleCase):
Test the status module
'''
@skipIf(salt.utils.platform.is_windows(), 'minion is windows')
@flaky
def test_status_pid(self):
'''
status.pid

View File

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase
import salt.executors.splay as splay_exec
class SplayTestCase(TestCase, LoaderModuleMockMixin):
def setup_loader_modules(self):
return {
splay_exec: {
'__grains__': {'id': 'foo'},
}
}
def test__get_hash(self):
# We just want to make sure that this function does not result in an
# error due to passing a unicode value to bytearray()
assert splay_exec._get_hash()

View File

@ -6,6 +6,7 @@ import logging
from copy import deepcopy
import pkg_resources
import os.path
import sys
# imprt salt paths
from tests.support.paths import TESTS_DIR
@ -121,6 +122,7 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
@mock_ec2_deprecated
@mock_elb_deprecated
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
def test_register_instances_valid_id_result_true(self):
'''
tests that given a valid instance id and valid ELB that
@ -140,6 +142,7 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
@mock_ec2_deprecated
@mock_elb_deprecated
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
def test_register_instances_valid_id_string(self):
'''
tests that given a string containing a instance id and valid ELB that
@ -163,6 +166,7 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
@mock_ec2_deprecated
@mock_elb_deprecated
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
def test_deregister_instances_valid_id_result_true(self):
'''
tests that given an valid id the boto_elb deregister_instances method
@ -184,6 +188,7 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
@mock_ec2_deprecated
@mock_elb_deprecated
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
def test_deregister_instances_valid_id_string(self):
'''
tests that given an valid id the boto_elb deregister_instances method
@ -210,6 +215,7 @@ class BotoElbTestCase(TestCase, LoaderModuleMockMixin):
@mock_ec2_deprecated
@mock_elb_deprecated
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
def test_deregister_instances_valid_id_list(self):
'''
tests that given an valid ids in the form of a list that the boto_elb

View File

@ -6,6 +6,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import logging
import pkg_resources
import os.path
import sys
# Import Salt Libs
import salt.config
@ -69,6 +70,7 @@ def _has_required_moto():
@skipIf(HAS_MOTO is False, 'The moto module must be installed.')
@skipIf(_has_required_moto() is False, 'The moto module must be >= to {0} for '
'PY2 or {1} for PY3.'.format(required_moto, required_moto_py3))
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
class BotoRoute53TestCase(TestCase, LoaderModuleMockMixin):
'''
TestCase for salt.modules.boto_route53 module

View File

@ -6,6 +6,7 @@ import random
import string
from copy import deepcopy
import os.path
import sys
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
@ -120,6 +121,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
{'to_port': 80, 'from_port': 80, 'ip_protocol': u'tcp', 'cidr_ip': u'0.0.0.0/0'}]
self.assertEqual(boto_secgroup._split_rules(rules), split_rules)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_create_ec2_classic(self):
'''
@ -140,6 +142,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
secgroup_created_group[0].vpc_id]
self.assertEqual(expected_create_result, secgroup_create_result)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_create_ec2_vpc(self):
'''
@ -158,6 +161,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
secgroup_create_result = [secgroup_created_group[0].name, secgroup_created_group[0].description, secgroup_created_group[0].vpc_id]
self.assertEqual(expected_create_result, secgroup_create_result)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_get_group_id_ec2_classic(self):
'''
@ -200,6 +204,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
**conn_parameters)
self.assertEqual(group_vpc.id, retrieved_group_id)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_get_config_single_rule_group_name(self):
'''
@ -224,6 +229,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
secgroup_get_config_result = boto_secgroup.get_config(group_id=group.id, **conn_parameters)
self.assertEqual(expected_get_config_result, secgroup_get_config_result)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_exists_true_name_classic(self):
'''
@ -237,10 +243,12 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
salt_exists_result = boto_secgroup.exists(name=group_name, **conn_parameters)
self.assertTrue(salt_exists_result)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_exists_false_name_classic(self):
pass
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_exists_true_name_vpc(self):
'''
@ -253,6 +261,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
salt_exists_result = boto_secgroup.exists(name=group_name, vpc_id=vpc_id, **conn_parameters)
self.assertTrue(salt_exists_result)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_exists_false_name_vpc(self):
'''
@ -262,6 +271,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
salt_exists_result = boto_secgroup.exists(group_name, vpc_id=vpc_id, **conn_parameters)
self.assertFalse(salt_exists_result)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_exists_true_group_id(self):
'''
@ -274,6 +284,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
salt_exists_result = boto_secgroup.exists(group_id=group.id, **conn_parameters)
self.assertTrue(salt_exists_result)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_exists_false_group_id(self):
'''
@ -283,6 +294,7 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
salt_exists_result = boto_secgroup.exists(group_id=group_id, **conn_parameters)
self.assertFalse(salt_exists_result)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_delete_group_ec2_classic(self):
'''
@ -309,10 +321,12 @@ class BotoSecgroupTestCase(TestCase, LoaderModuleMockMixin):
actual_groups = [group.id for group in conn.get_all_security_groups()]
self.assertEqual(expected_groups, actual_groups)
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test_delete_group_name_ec2_vpc(self):
pass
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
@mock_ec2_deprecated
def test__get_conn_true(self):
'''

View File

@ -8,6 +8,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import random
import string
import os.path
import sys
# pylint: disable=3rd-party-module-not-gated
import pkg_resources
from pkg_resources import DistributionNotFound
@ -271,6 +272,7 @@ class BotoVpcTestCaseMixin(object):
return rtbl
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
'''
TestCase for salt.modules.boto_vpc module
@ -369,7 +371,6 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
self.assertFalse(vpc_exists_result['exists'])
@mock_ec2_deprecated
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
def test_that_when_checking_if_a_vpc_exists_but_providing_no_filters_the_vpc_exists_method_raises_a_salt_invocation_error(self):
'''
Tests checking vpc existence when no filters are provided
@ -446,7 +447,6 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
self.assertEqual(get_id_result['id'], None)
@mock_ec2_deprecated
@skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493')
def test_get_vpc_id_method_when_not_providing_filters_raises_a_salt_invocation_error(self):
'''
Tests getting vpc id but providing no filters
@ -591,6 +591,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
' or equal to version {}. Installed: {}'
.format(required_boto_version, _get_boto_version()))
@skipIf(_has_required_moto() is False, 'The moto version must be >= to version {0}'.format(required_moto_version))
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
@mock_ec2_deprecated
def test_get_subnet_association_single_subnet(self):
@ -893,6 +894,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
@skipIf(_has_required_boto() is False, 'The boto module must be greater than'
' or equal to version {}. Installed: {}'
.format(required_boto_version, _get_boto_version()))
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
class BotoVpcInternetGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
@mock_ec2_deprecated
def test_that_when_creating_an_internet_gateway_the_create_internet_gateway_method_returns_true(self):
@ -954,6 +956,7 @@ class BotoVpcInternetGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
@skipIf(_has_required_boto() is False, 'The boto module must be greater than'
' or equal to version {}. Installed: {}'
.format(required_boto_version, _get_boto_version()))
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
class BotoVpcNatGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
@mock_ec2_deprecated
def test_that_when_creating_an_nat_gateway_the_create_nat_gateway_method_returns_true(self):
@ -1042,6 +1045,7 @@ class BotoVpcCustomerGatewayTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
' or equal to version {}. Installed: {}'
.format(required_boto_version, _get_boto_version()))
@skipIf(_has_required_moto() is False, 'The moto version must be >= to version {0}'.format(required_moto_version))
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
@mock_ec2_deprecated
def test_that_when_creating_dhcp_options_succeeds_the_create_dhcp_options_method_returns_true(self):
@ -1209,6 +1213,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
@skipIf(_has_required_boto() is False, 'The boto module must be greater than'
' or equal to version {}. Installed: {}'
.format(required_boto_version, _get_boto_version()))
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
@mock_ec2_deprecated
def test_that_when_creating_network_acl_for_an_existing_vpc_the_create_network_acl_method_returns_true(self):
@ -1792,6 +1797,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
' or equal to version {}. Installed: {}'
.format(required_boto_version, _get_boto_version()))
@skipIf(_has_required_moto() is False, 'The moto version must be >= to version {0}'.format(required_moto_version))
@skipIf(sys.version_info > (3, 6), 'Disabled for 3.7+ pending https://github.com/spulec/moto/issues/1706.')
class BotoVpcPeeringConnectionsTest(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
@mock_ec2_deprecated