mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge remote-tracking branch 'upstream/2015.5' into merge-forward-2015.8
Conflicts: salt/modules/postgres.py salt/states/postgres_user.py
This commit is contained in:
commit
3b5e16db67
8 changed files with 57 additions and 28 deletions
|
@ -466,11 +466,6 @@ class AsyncClientMixin(object):
|
|||
except AttributeError:
|
||||
outputter = None
|
||||
|
||||
try:
|
||||
if event.get('return').get('outputter'):
|
||||
event['return'].pop('outputter')
|
||||
except AttributeError:
|
||||
pass
|
||||
# if this is a ret, we have our own set of rules
|
||||
if suffix == 'ret':
|
||||
# Check if ouputter was passed in the return data. If this is the case,
|
||||
|
|
|
@ -928,7 +928,8 @@ _OS_NAME_MAP = {
|
|||
'cloudserve': 'CloudLinux',
|
||||
'pidora': 'Fedora',
|
||||
'scientific': 'ScientificLinux',
|
||||
'synology': 'Synology'
|
||||
'synology': 'Synology',
|
||||
'manjaro': 'Manjaro',
|
||||
}
|
||||
|
||||
# Map the 'os' grain to the 'os_family' grain
|
||||
|
@ -972,7 +973,8 @@ _OS_FAMILY_MAP = {
|
|||
'Linaro': 'Debian',
|
||||
'elementary OS': 'Debian',
|
||||
'ScientificLinux': 'RedHat',
|
||||
'Raspbian': 'Debian'
|
||||
'Raspbian': 'Debian',
|
||||
'Manjaro': 'Arch',
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -674,7 +674,11 @@ def find_cached_job(jid):
|
|||
proc_dir = os.path.join(__opts__['cachedir'], 'minion_jobs')
|
||||
job_dir = os.path.join(proc_dir, str(jid))
|
||||
if not os.path.isdir(job_dir):
|
||||
return
|
||||
if not __opts__.get('cache_jobs'):
|
||||
return ('Local jobs cache directory not found; you may need to'
|
||||
' enable cache_jobs on this minion')
|
||||
else:
|
||||
return 'Local jobs cache directory {0} not found'.format(job_dir)
|
||||
path = os.path.join(job_dir, 'return.p')
|
||||
with salt.utils.fopen(path, 'rb') as fp_:
|
||||
buf = fp_.read()
|
||||
|
|
|
@ -759,16 +759,51 @@ def get_known_host(user, hostname, config=None, port=None):
|
|||
|
||||
|
||||
@decorators.which('ssh-keyscan')
|
||||
def recv_known_host(hostname, enc=None, port=None, hash_hostname=False):
|
||||
def recv_known_host(hostname,
|
||||
enc=None,
|
||||
port=None,
|
||||
hash_hostname=True,
|
||||
hash_known_hosts=True):
|
||||
'''
|
||||
Retrieve information about host public key from remote server
|
||||
|
||||
hostname
|
||||
The name of the remote host (e.g. "github.com")
|
||||
|
||||
enc
|
||||
Defines what type of key is being used, can be ed25519, ecdsa ssh-rsa
|
||||
or ssh-dss
|
||||
|
||||
port
|
||||
optional parameter, denoting the port of the remote host, which will be
|
||||
used in case, if the public key will be requested from it. By default
|
||||
the port 22 is used.
|
||||
|
||||
hash_hostname : True
|
||||
Hash all hostnames and addresses in the known hosts file.
|
||||
|
||||
.. deprecated:: Carbon
|
||||
|
||||
Please use hash_known_hosts instead.
|
||||
|
||||
hash_known_hosts : True
|
||||
Hash all hostnames and addresses in the known hosts file.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' ssh.recv_known_host <hostname> enc=<enc> port=<port>
|
||||
'''
|
||||
|
||||
if not hash_hostname:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'The hash_hostname parameter is misleading as ssh-keygen can only '
|
||||
'hash the whole known hosts file, not entries for individual'
|
||||
'hosts. Please use hash_known_hosts=False instead.')
|
||||
hash_known_hosts = hash_hostname
|
||||
|
||||
# The following list of OSes have an old version of openssh-clients
|
||||
# and thus require the '-t' option for ssh-keyscan
|
||||
need_dash_t = ['CentOS-5']
|
||||
|
@ -780,7 +815,7 @@ def recv_known_host(hostname, enc=None, port=None, hash_hostname=False):
|
|||
chunks += ['-t', str(enc)]
|
||||
if not enc and __grains__.get('osfinger') in need_dash_t:
|
||||
chunks += ['-t', 'rsa']
|
||||
if hash_hostname:
|
||||
if hash_known_hosts:
|
||||
chunks.append('-H')
|
||||
chunks.append(str(hostname))
|
||||
cmd = ' '.join(chunks)
|
||||
|
@ -928,11 +963,6 @@ def set_known_host(user=None,
|
|||
return {'status': 'error',
|
||||
'error': 'hostname argument required'}
|
||||
|
||||
if port is not None and port != DEFAULT_SSH_PORT and hash_hostname:
|
||||
return {'status': 'error',
|
||||
'error': 'argument port can not be used in '
|
||||
'conjunction with argument hash_hostname'}
|
||||
|
||||
if not hash_hostname:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
|
@ -941,6 +971,11 @@ def set_known_host(user=None,
|
|||
'hosts. Please use hash_known_hosts=False instead.')
|
||||
hash_known_hosts = hash_hostname
|
||||
|
||||
if port is not None and port != DEFAULT_SSH_PORT and hash_known_hosts:
|
||||
return {'status': 'error',
|
||||
'error': 'argument port can not be used in '
|
||||
'conjunction with argument hash_known_hosts'}
|
||||
|
||||
update_required = False
|
||||
check_required = False
|
||||
stored_host = get_known_host(user, hostname, config, port)
|
||||
|
@ -961,7 +996,7 @@ def set_known_host(user=None,
|
|||
remote_host = recv_known_host(hostname,
|
||||
enc=enc,
|
||||
port=port,
|
||||
hash_hostname=hash_hostname)
|
||||
hash_known_hosts=hash_known_hosts)
|
||||
if not remote_host:
|
||||
return {'status': 'error',
|
||||
'error': 'Unable to receive remote host key'}
|
||||
|
@ -987,7 +1022,7 @@ def set_known_host(user=None,
|
|||
if key:
|
||||
remote_host = {'hostname': hostname, 'enc': enc, 'key': key}
|
||||
|
||||
if hash_hostname or port == DEFAULT_SSH_PORT:
|
||||
if hash_known_hosts or port == DEFAULT_SSH_PORT:
|
||||
line = '{hostname} {enc} {key}\n'.format(**remote_host)
|
||||
else:
|
||||
remote_host['port'] = port
|
||||
|
|
|
@ -4,9 +4,6 @@ Manage users with the useradd command
|
|||
'''
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Import python libs
|
||||
import re
|
||||
|
||||
try:
|
||||
import pwd
|
||||
HAS_PWD = True
|
||||
|
@ -22,10 +19,6 @@ from salt.exceptions import CommandExecutionError
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
RETCODE_12_ERROR_REGEX = re.compile(
|
||||
r'userdel(.*)warning(.*)/var/mail(.*)No such file or directory'
|
||||
)
|
||||
|
||||
# Define the module's virtual name
|
||||
__virtualname__ = 'user'
|
||||
|
||||
|
@ -242,7 +235,7 @@ def delete(name, remove=False, force=False):
|
|||
if __grains__['os_family'] not in ('Debian',):
|
||||
return False
|
||||
|
||||
if RETCODE_12_ERROR_REGEX.match(ret['stderr']) is not None:
|
||||
if 'var/mail' in ret['stderr'] or 'var/spool/mail' in ret['stderr']:
|
||||
# We've hit the bug, let's log it and not fail
|
||||
log.debug(
|
||||
'While the userdel exited with code 12, this is a known bug on '
|
||||
|
|
|
@ -50,7 +50,7 @@ def returner(ret):
|
|||
'''
|
||||
Return data to the local syslog
|
||||
'''
|
||||
syslog.syslog(syslog.LOG_INFO, 'salt-minion: {0}'.format(json.dumps(ret)))
|
||||
syslog.syslog(syslog.LOG_INFO, '{0}'.format(json.dumps(ret)))
|
||||
|
||||
|
||||
def prep_jid(nocache=False, passed_jid=None): # pylint: disable=unused-argument
|
||||
|
|
|
@ -56,7 +56,7 @@ def orchestrate(mods, saltenv='base', test=None, exclude=None, pillar=None):
|
|||
test,
|
||||
exclude,
|
||||
pillar=pillar)
|
||||
ret = {minion.opts['id']: running, 'outputter': 'highstate'}
|
||||
ret = {'data': {minion.opts['id']: running}, 'outputter': 'highstate'}
|
||||
return ret
|
||||
|
||||
# Aliases for orchestrate runner
|
||||
|
|
|
@ -1327,7 +1327,7 @@ def managed(name,
|
|||
|
||||
# If no source is specified, set replace to False, as there is nothing
|
||||
# to replace the file with.
|
||||
src_defined = source or contents or contents_pillar or contents_grains
|
||||
src_defined = source or contents is not None or contents_pillar or contents_grains
|
||||
if not src_defined and replace:
|
||||
replace = False
|
||||
log.warning(
|
||||
|
|
Loading…
Add table
Reference in a new issue