Merge pull request #23429 from basepi/merge-forward-2015.5

[2015.5] Merge forward from 2014.7 to 2015.5
This commit is contained in:
Colton Myers 2015-05-06 23:35:13 -06:00
commit 3c4f734332
9 changed files with 32 additions and 20 deletions

View File

@ -218,7 +218,7 @@ Create the Build Environment
Right-click on the file named **dev_env_salt.ps1** and select **Run with Right-click on the file named **dev_env_salt.ps1** and select **Run with
Powershell** Powershell**
This will clone salt into ``C:\Salt-Dev\salt`` and set it to the 2015.2 This will clone salt into ``C:\Salt-Dev\salt`` and set it to the 2015.5
branch. You could optionally run the command from a powershell window with a branch. You could optionally run the command from a powershell window with a
``-Version`` switch to pull a different version. For example: ``-Version`` switch to pull a different version. For example:

View File

@ -129,7 +129,7 @@ configuration file named ``master``.
Minion Config Minion Config
--------------- ---------------
.. versionadded:: 2015.2.1 .. versionadded:: 2015.5.1
Minion config options can be defined globally using the master configuration Minion config options can be defined globally using the master configuration
option ``ssh_minion_opts``. It can also be defined on a per-minion basis with option ``ssh_minion_opts``. It can also be defined on a per-minion basis with

View File

@ -129,7 +129,7 @@ For APT-based distros such as Ubuntu and Debian:
switching to a new :conf_master:`gitfs_provider`, but it is less important switching to a new :conf_master:`gitfs_provider`, but it is less important
when switching between GitPython and pygit2. when switching between GitPython and pygit2.
Beginning in version 2015.2.0, the gitfs cache can be easily cleared using Beginning in version 2015.5.0, the gitfs cache can be easily cleared using
the :mod:`fileserver.clear_cache <salt.runners.fileserver.clear_cache>` the :mod:`fileserver.clear_cache <salt.runners.fileserver.clear_cache>`
runner. runner.
@ -183,7 +183,7 @@ master:
.. note:: .. note::
Dulwich does not recognize ``ssh://`` URLs, ``git+ssh://`` must be used Dulwich does not recognize ``ssh://`` URLs, ``git+ssh://`` must be used
instead. Salt version 2015.2.0 and later will automatically add the instead. Salt version 2015.5.0 and later will automatically add the
``git+`` to the beginning of these URLs before fetching, but earlier ``git+`` to the beginning of these URLs before fetching, but earlier
Salt versions will fail to fetch unless the URL is specified using Salt versions will fail to fetch unless the URL is specified using
``git+ssh://``. ``git+ssh://``.

View File

@ -525,7 +525,7 @@ def __get_ssh_credentials(vm_):
'ssh_username', vm_, __opts__, default=os.getenv('USER')) 'ssh_username', vm_, __opts__, default=os.getenv('USER'))
ssh_key = config.get_cloud_config_value( ssh_key = config.get_cloud_config_value(
'ssh_keyfile', vm_, __opts__, 'ssh_keyfile', vm_, __opts__,
default=os.getenv('HOME') + '/.ssh/google_compute_engine') default=os.path.expanduser('~/.ssh/google_compute_engine'))
return ssh_user, ssh_key return ssh_user, ssh_key

View File

@ -274,7 +274,7 @@ def gen_locale(locale, **kwargs):
if os.path.exists('/etc/locale.gen'): if os.path.exists('/etc/locale.gen'):
__salt__['file.replace']( __salt__['file.replace'](
'/etc/locale.gen', '/etc/locale.gen',
r'^#\s*{0}$'.format(locale), r'^\s*#\s*{0}\s*$'.format(locale),
'{0}'.format(locale), '{0}'.format(locale),
append_if_not_found=True append_if_not_found=True
) )

View File

@ -49,7 +49,7 @@ painful in windows.
To do this you just use pip with git to update to the version you want and then To do this you just use pip with git to update to the version you want and then
restart the service. Here is a sample state file that upgrades salt to the head restart the service. Here is a sample state file that upgrades salt to the head
of the 2015.2 branch: of the 2015.5 branch:
.. code-block:: yaml .. code-block:: yaml
@ -57,7 +57,7 @@ of the 2015.2 branch:
pip.installed: pip.installed:
- cwd: 'C:\salt\bin\scripts' - cwd: 'C:\salt\bin\scripts'
- bin_env: 'C:\salt\bin\scripts\pip.exe' - bin_env: 'C:\salt\bin\scripts\pip.exe'
- editable: git+https://github.com/saltstack/salt@2015.2#egg=salt - editable: git+https://github.com/saltstack/salt@2015.5#egg=salt
- upgrade: True - upgrade: True
restart_service: restart_service:

View File

@ -580,6 +580,7 @@ def hypermedia_in():
if (cherrypy.request.method.upper() == 'POST' if (cherrypy.request.method.upper() == 'POST'
and cherrypy.request.headers.get('Content-Length', '0') == '0'): and cherrypy.request.headers.get('Content-Length', '0') == '0'):
cherrypy.request.process_request_body = False cherrypy.request.process_request_body = False
cherrypy.request.unserialized_data = None
cherrypy.request.body.processors.clear() cherrypy.request.body.processors.clear()
cherrypy.request.body.default_proc = cherrypy.HTTPError( cherrypy.request.body.default_proc = cherrypy.HTTPError(

View File

@ -17,7 +17,7 @@ def envs(backend=None, sources=False, outputter=None):
backend backend
Narrow fileserver backends to a subset of the enabled ones. Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.2.0:: .. versionchanged:: 2015.5.0
If all passed backends start with a minus sign (``-``), then these If all passed backends start with a minus sign (``-``), then these
backends will be excluded from the enabled backends. However, if backends will be excluded from the enabled backends. However, if
there is a mix of backends with and without a minus sign (ex: there is a mix of backends with and without a minus sign (ex:
@ -66,7 +66,7 @@ def file_list(saltenv='base', backend=None, outputter=None):
``backend=-roots,git``) then the ones starting with a minus sign will ``backend=-roots,git``) then the ones starting with a minus sign will
be disregarded. be disregarded.
.. versionadded:: 2015.2.0 .. versionadded:: 2015.5.0
CLI Examples: CLI Examples:
@ -109,7 +109,7 @@ def symlink_list(saltenv='base', backend=None, outputter=None):
``backend=-roots,git``) then the ones starting with a minus sign will ``backend=-roots,git``) then the ones starting with a minus sign will
be disregarded. be disregarded.
.. versionadded:: 2015.2.0 .. versionadded:: 2015.5.0
CLI Example: CLI Example:
@ -152,7 +152,7 @@ def dir_list(saltenv='base', backend=None, outputter=None):
``backend=-roots,git``) then the ones starting with a minus sign will ``backend=-roots,git``) then the ones starting with a minus sign will
be disregarded. be disregarded.
.. versionadded:: 2015.2.0 .. versionadded:: 2015.5.0
CLI Example: CLI Example:
@ -182,7 +182,7 @@ def dir_list(saltenv='base', backend=None, outputter=None):
def empty_dir_list(saltenv='base', backend=None, outputter=None): def empty_dir_list(saltenv='base', backend=None, outputter=None):
''' '''
.. versionadded:: 2015.2.0 .. versionadded:: 2015.5.0
Return a list of empty directories in the given environment Return a list of empty directories in the given environment
@ -236,7 +236,7 @@ def update(backend=None):
backend backend
Narrow fileserver backends to a subset of the enabled ones. Narrow fileserver backends to a subset of the enabled ones.
.. versionchanged:: 2015.2.0 .. versionchanged:: 2015.5.0
If all passed backends start with a minus sign (``-``), then these If all passed backends start with a minus sign (``-``), then these
backends will be excluded from the enabled backends. However, if backends will be excluded from the enabled backends. However, if
there is a mix of backends with and without a minus sign (ex: there is a mix of backends with and without a minus sign (ex:
@ -261,7 +261,7 @@ def update(backend=None):
def clear_cache(backend=None): def clear_cache(backend=None):
''' '''
.. versionadded:: 2015.2.0 .. versionadded:: 2015.5.0
Clear the fileserver cache from VCS fileserver backends (:mod:`git Clear the fileserver cache from VCS fileserver backends (:mod:`git
<salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn
@ -299,7 +299,7 @@ def clear_cache(backend=None):
def clear_lock(backend=None, remote=None): def clear_lock(backend=None, remote=None):
''' '''
.. versionadded:: 2015.2.0 .. versionadded:: 2015.5.0
Clear the fileserver update lock from VCS fileserver backends (:mod:`git Clear the fileserver update lock from VCS fileserver backends (:mod:`git
<salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn
@ -340,7 +340,7 @@ def clear_lock(backend=None, remote=None):
def lock(backend=None, remote=None): def lock(backend=None, remote=None):
''' '''
.. versionadded:: 2015.2.0 .. versionadded:: 2015.5.0
Set a fileserver update lock for VCS fileserver backends (:mod:`git Set a fileserver update lock for VCS fileserver backends (:mod:`git
<salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn <salt.fileserver.gitfs>`, :mod:`hg <salt.fileserver.hgfs>`, :mod:`svn

View File

@ -1069,7 +1069,14 @@ def deploy_script(host,
) )
file_map_fail.append({local_file: remote_file}) file_map_fail.append({local_file: remote_file})
continue continue
if os.path.isdir(local_file):
dir_name = os.path.basename(local_file)
remote_dir = os.path.join(os.path.dirname(remote_file),
dir_name)
else:
remote_dir = os.path.dirname(remote_file) remote_dir = os.path.dirname(remote_file)
if remote_dir not in remote_dirs: if remote_dir not in remote_dirs:
root_cmd('mkdir -p \'{0}\''.format(remote_dir), tty, sudo, **ssh_kwargs) root_cmd('mkdir -p \'{0}\''.format(remote_dir), tty, sudo, **ssh_kwargs)
remote_dirs.append(remote_dir) remote_dirs.append(remote_dir)
@ -1547,6 +1554,8 @@ def sftp_file(dest_path, contents=None, kwargs=None, local_file=None):
''' '''
Use sftp to upload a file to a server Use sftp to upload a file to a server
''' '''
put_args = []
if kwargs is None: if kwargs is None:
kwargs = {} kwargs = {}
@ -1557,6 +1566,8 @@ def sftp_file(dest_path, contents=None, kwargs=None, local_file=None):
if local_file is not None: if local_file is not None:
tmppath = local_file tmppath = local_file
if os.path.isdir(local_file):
put_args = ['-r']
log.debug('Uploading {0} to {1} (sfcp)'.format(dest_path, kwargs.get('hostname'))) log.debug('Uploading {0} to {1} (sfcp)'.format(dest_path, kwargs.get('hostname')))
@ -1615,8 +1626,8 @@ def sftp_file(dest_path, contents=None, kwargs=None, local_file=None):
) )
) )
cmd = 'echo "put {0} {1}" | sftp {2} {3[username]}@{3[hostname]}'.format( cmd = 'echo "put {0} {1} {2}" | sftp {3} {4[username]}@{4[hostname]}'.format(
tmppath, dest_path, ' '.join(ssh_args), kwargs ' '.join(put_args), tmppath, dest_path, ' '.join(ssh_args), kwargs
) )
log.debug('SFTP command: {0!r}'.format(cmd)) log.debug('SFTP command: {0!r}'.format(cmd))
retcode = _exec_ssh_cmd(cmd, retcode = _exec_ssh_cmd(cmd,