Merge branch '2019.2.1' into fix_lock_1688_lgpo

This commit is contained in:
Shane Lee 2019-07-02 17:46:47 -06:00 committed by GitHub
commit 7b05bf825a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 86 additions and 51 deletions

View file

@ -243,10 +243,6 @@ New-Item -Path "$($ini['Settings']['SitePkgs2Dir'])\win32com\gen_py" -ItemType D
Write-Output " - $script_name :: Removing pywin32_system32 Directory . . ."
Remove-Item "$($ini['Settings']['SitePkgs2Dir'])\pywin32_system32"
# Remove pythonwin directory
Write-Output " - $script_name :: Removing pythonwin Directory . . ."
Remove-Item "$($ini['Settings']['SitePkgs2Dir'])\pythonwin" -Force -Recurse
# Remove PyWin32 PostInstall and testall Scripts
Write-Output " - $script_name :: Removing PyWin32 scripts . . ."
Remove-Item "$($ini['Settings']['Scripts2Dir'])\pywin32_*" -Force -Recurse

View file

@ -241,10 +241,6 @@ New-Item -Path "$($ini['Settings']['SitePkgs3Dir'])\win32com\gen_py" -ItemType D
Write-Output " - $script_name :: Removing pywin32_system32 Directory . . ."
Remove-Item "$($ini['Settings']['SitePkgs3Dir'])\pywin32_system32"
# Remove pythonwin directory
Write-Output " - $script_name :: Removing pythonwin Directory . . ."
Remove-Item "$($ini['Settings']['SitePkgs3Dir'])\pythonwin" -Force -Recurse
# Remove PyWin32 PostInstall and testall Scripts
Write-Output " - $script_name :: Removing PyWin32 scripts . . ."
Remove-Item "$($ini['Settings']['Scripts3Dir'])\pywin32_*" -Force -Recurse

View file

@ -47,6 +47,37 @@ TARGET_REX = re.compile(
)
def _nodegroup_regex(nodegroup, words, opers):
opers_set = set(opers)
ret = words
if (set(ret) - opers_set) == set(ret):
# No compound operators found in nodegroup definition. Check for
# group type specifiers
group_type_re = re.compile('^[A-Z]@')
regex_chars = ['(', '[', '{', '\\', '?', '}', ']', ')']
if not [x for x in ret if '*' in x or group_type_re.match(x)]:
# No group type specifiers and no wildcards.
# Treat this as an expression.
if [x for x in ret if x in [x for y in regex_chars if y in x]]:
joined = 'E@' + ','.join(ret)
log.debug(
'Nodegroup \'%s\' (%s) detected as an expression. '
'Assuming compound matching syntax of \'%s\'',
nodegroup, ret, joined
)
else:
# Treat this as a list of nodenames.
joined = 'L@' + ','.join(ret)
log.debug(
'Nodegroup \'%s\' (%s) detected as list of nodenames. '
'Assuming compound matching syntax of \'%s\'',
nodegroup, ret, joined
)
# Return data must be a list of compound matching components
# to be fed into compound matcher. Enclose return data in list.
return [joined]
def parse_target(target_expression):
'''Parse `target_expressing` splitting it into `engine`, `delimiter`,
`pattern` - returns a dict'''
@ -141,36 +172,16 @@ def nodegroup_comp(nodegroup, nodegroups, skip=None, first_call=True):
# Only return list form if a nodegroup was expanded. Otherwise return
# the original string to conserve backwards compat
if expanded_nodegroup or not first_call:
if not first_call:
joined = _nodegroup_regex(nodegroup, words, opers)
if joined:
return joined
return ret
else:
opers_set = set(opers)
ret = words
if (set(ret) - opers_set) == set(ret):
# No compound operators found in nodegroup definition. Check for
# group type specifiers
group_type_re = re.compile('^[A-Z]@')
regex_chars = ['(', '[', '{', '\\', '?', '}', ']', ')']
if not [x for x in ret if '*' in x or group_type_re.match(x)]:
# No group type specifiers and no wildcards.
# Treat this as an expression.
if [x for x in ret if x in [x for y in regex_chars if y in x]]:
joined = 'E@' + ','.join(ret)
log.debug(
'Nodegroup \'%s\' (%s) detected as an expression. '
'Assuming compound matching syntax of \'%s\'',
nodegroup, ret, joined
)
else:
# Treat this as a list of nodenames.
joined = 'L@' + ','.join(ret)
log.debug(
'Nodegroup \'%s\' (%s) detected as list of nodenames. '
'Assuming compound matching syntax of \'%s\'',
nodegroup, ret, joined
)
# Return data must be a list of compound matching components
# to be fed into compound matcher. Enclose return data in list.
return [joined]
joined = _nodegroup_regex(nodegroup, ret, opers)
if joined:
return joined
log.debug(
'No nested nodegroups detected. Using original nodegroup '

View file

@ -102,15 +102,15 @@ class DigitalOceanTest(ShellCase):
pub = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example'
finger_print = '3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa'
_key = self.run_cloud('-f create_key {0} name="MyPubKey" public_key="{1}"'.format(PROVIDER_NAME, pub))
# Upload public key
self.assertIn(
finger_print,
[i.strip() for i in _key]
)
try:
_key = self.run_cloud('-f create_key {0} name="MyPubKey" public_key="{1}"'.format(PROVIDER_NAME, pub))
# Upload public key
self.assertIn(
finger_print,
[i.strip() for i in _key]
)
# List all keys
list_keypairs = self.run_cloud('-f list_keypairs {0}'.format(PROVIDER_NAME))

View file

@ -70,14 +70,22 @@ nodegroups:
min: minion
sub_min: sub_minion
mins: N@min or N@sub_min
list_nodegroup:
- 'minion'
- 'sub_minion'
multiline_nodegroup:
- 'minion'
- 'or'
- 'sub_minion'
one_minion_list:
- 'minion'
redundant_minions: N@min or N@mins
nodegroup_loop_a: N@nodegroup_loop_b
nodegroup_loop_b: N@nodegroup_loop_a
missing_minion: L@minion,ghostminion
list_group: N@multiline_nodegroup
one_list_group: N@one_minion_list
list_group2: N@list_nodegroup
mysql.host: localhost

View file

@ -17,7 +17,7 @@ import salt.utils.platform
@skip_if_not_root
@flaky
@flaky(attempts=10)
@skipIf(not salt.utils.platform.is_darwin(), 'Test only available on macOS')
@skipIf(not salt.utils.path.which('systemsetup'), '\'systemsetup\' binary not found in $PATH')
class MacPowerModuleTest(ModuleCase):
@ -142,7 +142,7 @@ class MacPowerModuleTest(ModuleCase):
@skip_if_not_root
@flaky
@flaky(attempts=10)
@skipIf(not salt.utils.platform.is_darwin(), 'Test only available on macOS')
@skipIf(not salt.utils.path.which('systemsetup'), '\'systemsetup\' binary not found in $PATH')
class MacPowerModuleTestSleepOnPowerButton(ModuleCase):
@ -193,7 +193,7 @@ class MacPowerModuleTestSleepOnPowerButton(ModuleCase):
@skip_if_not_root
@flaky
@flaky(attempts=10)
@skipIf(not salt.utils.platform.is_darwin(), 'Test only available on macOS')
@skipIf(not salt.utils.path.which('systemsetup'), '\'systemsetup\' binary not found in $PATH')
class MacPowerModuleTestRestartPowerFailure(ModuleCase):
@ -243,7 +243,7 @@ class MacPowerModuleTestRestartPowerFailure(ModuleCase):
@skip_if_not_root
@flaky
@flaky(attempts=10)
@skipIf(not salt.utils.platform.is_darwin(), 'Test only available on macOS')
@skipIf(not salt.utils.path.which('systemsetup'), '\'systemsetup\' binary not found in $PATH')
class MacPowerModuleTestWakeOnNet(ModuleCase):
@ -290,7 +290,7 @@ class MacPowerModuleTestWakeOnNet(ModuleCase):
@skip_if_not_root
@flaky
@flaky(attempts=10)
@skipIf(not salt.utils.platform.is_darwin(), 'Test only available on macOS')
@skipIf(not salt.utils.path.which('systemsetup'), '\'systemsetup\' binary not found in $PATH')
class MacPowerModuleTestWakeOnModem(ModuleCase):

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
'''
integration tests for mac_system
integration tests for mac_shadow
'''
# Import Python libs
@ -40,7 +40,7 @@ NO_USER = __random_string()
@skipIf(not salt.utils.path.which('pwpolicy'), '\'pwpolicy\' binary not found in $PATH')
class MacShadowModuleTest(ModuleCase):
'''
Validate the mac_system module
Validate the mac_shadow module
'''
def setUp(self):

View file

@ -34,7 +34,7 @@ SET_SUBNET_NAME = __random_string()
@skip_if_not_root
@flaky(attempts=8)
@flaky(attempts=10)
@skipIf(not salt.utils.platform.is_darwin(), 'Test only available on macOS')
@skipIf(not salt.utils.path.which('systemsetup'), '\'systemsetup\' binary not found in $PATH')
class MacSystemModuleTest(ModuleCase):

View file

@ -153,6 +153,23 @@ class MatchTest(ShellCase, ShellCaseCommonTestsMixin):
self.assertTrue(minion_in_returns('minion', data))
self.assertTrue(minion_in_returns('sub_minion', data))
def test_nodegroup_list(self):
data = self.run_salt('-N list_group test.ping')
self.assertTrue(minion_in_returns('minion', data))
self.assertTrue(minion_in_returns('sub_minion', data))
data = self.run_salt('-N list_group2 test.ping')
self.assertTrue(minion_in_returns('minion', data))
self.assertTrue(minion_in_returns('sub_minion', data))
data = self.run_salt('-N one_list_group test.ping')
self.assertTrue(minion_in_returns('minion', data))
self.assertFalse(minion_in_returns('sub_minion', data))
data = self.run_salt('-N one_minion_list test.ping')
self.assertTrue(minion_in_returns('minion', data))
self.assertFalse(minion_in_returns('sub_minion', data))
def test_glob(self):
'''
test salt glob matcher

View file

@ -19,6 +19,9 @@ NODEGROUPS = {
'group2': ['G@foo:bar', 'or', 'web1*'],
'group3': ['N@group1', 'or', 'N@group2'],
'group4': ['host4', 'host5', 'host6'],
'group5': 'N@group4',
'group6': 'N@group3',
'group7': ['host1']
}
EXPECTED = {
@ -26,6 +29,10 @@ EXPECTED = {
'group2': ['G@foo:bar', 'or', 'web1*'],
'group3': ['(', '(', 'L@host1,host2,host3', ')', 'or', '(', 'G@foo:bar', 'or', 'web1*', ')', ')'],
'group4': ['L@host4,host5,host6'],
'group5': ['(', 'L@host4,host5,host6', ')'],
'group6': ['(', '(', '(', 'L@host1,host2,host3', ')', 'or', '(',
'G@foo:bar', 'or', 'web1*', ')', ')', ')'],
'group7': ['L@host1']
}