mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #35347 from rallytime/merge-2016.3
[2016.3] Merge forward from 2015.8 to 2016.3
This commit is contained in:
commit
87e29188c0
7 changed files with 59 additions and 20 deletions
|
@ -318,7 +318,7 @@ class SSH(object):
|
|||
'''
|
||||
if not isinstance(ret[host], dict) or self.opts.get('ssh_key_deploy'):
|
||||
target = self.targets[host]
|
||||
if 'passwd' in target or self.opts['ssh_passwd']:
|
||||
if target.get('passwd', False) or self.opts['ssh_passwd']:
|
||||
self._key_deploy_run(host, target, False)
|
||||
return ret
|
||||
if ret[host].get('stderr', '').count('Permission denied'):
|
||||
|
@ -851,6 +851,12 @@ class Single(object):
|
|||
minion_opts=self.minion_opts,
|
||||
**self.target)
|
||||
opts_pkg = pre_wrapper['test.opts_pkg']() # pylint: disable=E1102
|
||||
if '_error' in opts_pkg:
|
||||
#Refresh failed
|
||||
retcode = opts_pkg['retcode']
|
||||
ret = json.dumps({'local': opts_pkg})
|
||||
return ret, retcode
|
||||
|
||||
opts_pkg['file_roots'] = self.opts['file_roots']
|
||||
opts_pkg['pillar_roots'] = self.opts['pillar_roots']
|
||||
opts_pkg['ext_pillar'] = self.opts['ext_pillar']
|
||||
|
@ -866,12 +872,6 @@ class Single(object):
|
|||
|
||||
retcode = 0
|
||||
|
||||
if '_error' in opts_pkg:
|
||||
#Refresh failed
|
||||
retcode = opts_pkg['retcode']
|
||||
ret = json.dumps({'local': opts_pkg['_error']})
|
||||
return ret, retcode
|
||||
|
||||
pillar = salt.pillar.Pillar(
|
||||
opts_pkg,
|
||||
opts_pkg['grains'],
|
||||
|
|
|
@ -385,13 +385,22 @@ def _netstat_route_freebsd():
|
|||
out = __salt__['cmd.run'](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
ret.append({
|
||||
'addr_family': 'inet',
|
||||
'destination': comps[0],
|
||||
'gateway': comps[1],
|
||||
'netmask': comps[2],
|
||||
'flags': comps[3],
|
||||
'interface': comps[5]})
|
||||
if __grains__['os'] == 'FreeBSD' and __grains__.get('osmajorrelease', 0) < 10:
|
||||
ret.append({
|
||||
'addr_family': 'inet',
|
||||
'destination': comps[0],
|
||||
'gateway': comps[1],
|
||||
'netmask': comps[2],
|
||||
'flags': comps[3],
|
||||
'interface': comps[5]})
|
||||
else:
|
||||
ret.append({
|
||||
'addr_family': 'inet',
|
||||
'destination': comps[0],
|
||||
'gateway': comps[1],
|
||||
'netmask': '',
|
||||
'flags': comps[2],
|
||||
'interface': comps[3]})
|
||||
cmd = 'netstat -f inet6 -rn | tail -n+5'
|
||||
out = __salt__['cmd.run'](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
|
|
|
@ -2389,8 +2389,7 @@ def recurse(name,
|
|||
return _error(
|
||||
ret, 'The path {0} exists and is not a directory'.format(name))
|
||||
if not __opts__['test']:
|
||||
__salt__['file.makedirs_perms'](
|
||||
name, user, group, int(str(dir_mode), 8) if dir_mode else None)
|
||||
__salt__['file.makedirs_perms'](name, user, group, dir_mode)
|
||||
|
||||
def add_comment(path, comment):
|
||||
comments = ret['comment'].setdefault(path, [])
|
||||
|
|
|
@ -129,7 +129,8 @@ def present(
|
|||
result = __salt__['ssh.check_known_host'](user, name,
|
||||
key=key,
|
||||
fingerprint=fingerprint,
|
||||
config=config)
|
||||
config=config,
|
||||
port=port)
|
||||
except CommandNotFoundError as err:
|
||||
ret['result'] = False
|
||||
ret['comment'] = 'ssh.check_known_host error: {0}'.format(err)
|
||||
|
|
|
@ -117,10 +117,9 @@ class Terminal(object):
|
|||
# Let's avoid Zombies!!!
|
||||
_cleanup()
|
||||
|
||||
if not args and not executable and not shell:
|
||||
if not args and not executable:
|
||||
raise TerminalException(
|
||||
'You need to pass at least one of \'args\', \'executable\' '
|
||||
'or \'shell=True\''
|
||||
'You need to pass at least one of "args", "executable" '
|
||||
)
|
||||
|
||||
self.args = args
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Hello world!
|
|
@ -768,6 +768,36 @@ class FileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
|||
finally:
|
||||
shutil.rmtree(name, ignore_errors=True)
|
||||
|
||||
def test_recurse_issue_34945(self):
|
||||
'''
|
||||
This tests the case where the source dir for the file.recurse state
|
||||
does not contain any files (only subdirectories), and the dir_mode is
|
||||
being managed. For a long time, this corner case resulted in the top
|
||||
level of the destination directory being created with the wrong initial
|
||||
permissions, a problem that would be corrected later on in the
|
||||
file.recurse state via running state.directory. However, the
|
||||
file.directory state only gets called when there are files to be
|
||||
managed in that directory, and when the source directory contains only
|
||||
subdirectories, the incorrectly-set initial perms would not be
|
||||
repaired.
|
||||
|
||||
This was fixed in https://github.com/saltstack/salt/pull/35309
|
||||
'''
|
||||
dir_mode = '2775'
|
||||
issue_dir = 'issue-34945'
|
||||
name = os.path.join(integration.TMP, issue_dir)
|
||||
|
||||
try:
|
||||
ret = self.run_state('file.recurse',
|
||||
name=name,
|
||||
source='salt://' + issue_dir,
|
||||
dir_mode=dir_mode)
|
||||
self.assertSaltTrueReturn(ret)
|
||||
actual_dir_mode = oct(stat.S_IMODE(os.stat(name).st_mode))[-4:]
|
||||
self.assertEqual(dir_mode, actual_dir_mode)
|
||||
finally:
|
||||
shutil.rmtree(name, ignore_errors=True)
|
||||
|
||||
def test_replace(self):
|
||||
'''
|
||||
file.replace
|
||||
|
|
Loading…
Add table
Reference in a new issue