Merge remote-tracking branch 'upstream/2014.7' into merge-forward-2015.2

This commit is contained in:
Colton Myers 2015-04-21 10:33:39 -06:00
commit 92c51affc5
7 changed files with 83 additions and 9 deletions

View file

@ -67,7 +67,7 @@ help:
clean:
rm -rf $(BUILDDIR)/*
test -d 'locale' && find locale/ -name *.mo -exec rm {} \;
test -d 'locale' && find locale/ -name *.mo -exec rm {} \; || true
html: translations
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html

View file

@ -69,7 +69,7 @@ If Exist "%BinDir%\README.txt" del /q "%BinDir%\README.txt"
@ echo Building the installer...
@ echo -------------------------
makensis.exe /DSaltVersion="%Version%" "%InsDir%\Salt-Minion-Setup.nsi"
makensis.exe /DSaltVersion=%Version% "%InsDir%\Salt-Minion-Setup.nsi"
@ echo.
@ echo.

View file

@ -17,7 +17,7 @@ ${StrLoc}
${StrStrAdv}
!ifdef SaltVersion
!define PRODUCT_VERSION ${SaltVersion}
!define PRODUCT_VERSION "${SaltVersion}"
!else
!define PRODUCT_VERSION "Undefined Version"
!endif

View file

@ -514,7 +514,7 @@ def install(name=None,
if pkgs is None and kwargs.get('version') and len(pkg_params) == 1:
# Only use the 'version' param if 'name' was not specified as a
# comma-separated list
pkg_params = {name: kwargs.get('version')}
pkg_params = {name: str(kwargs.get('version'))}
targets = []
for param, version_num in six.iteritems(pkg_params):
if version_num is None:

View file

@ -32,6 +32,8 @@ def _get_or_create_hostfile():
does not exist.
'''
hfn = __get_hosts_filename()
if hfn is None:
hfn = ''
if not os.path.exists(hfn):
salt.utils.fopen(hfn, 'w').close()
return hfn

View file

@ -1,6 +1,77 @@
# -*- coding: utf-8 -*-
'''
r'''
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your custom modules. You can even upgrade salt itself using pip. For this
to work properly, you must specify the Current Working Directory (``cwd``) and
the Pip Binary (``bin_env``) salt should use.
For example, the following command will list all software installed using pip
to your current salt environment:
.. code-block:: bat
salt <minion> pip.list cwd='C:\salt\bin\Scripts' bin_env='C:\salt\bin\Scripts\pip.exe'
Specifying the ``cwd`` and ``bin_env`` options ensures you're modifying the
salt environment. If these are omitted, it will default to the local
installation of python. If python is not installed locally it will fail saying
it couldn't find pip.
State File Support
------------------
This functionality works in states as well. If you need to pip install colorama
with a state, for example, the following will work:
.. code-block:: yaml
install_colorama:
pip.installed:
- name: colorama
- cwd: 'C:\salt\bin\scripts'
- bin_env: 'C:\salt\bin\scripts\pip.exe'
- upgrade: True
Upgrading Salt using Pip
------------------------
You can now update salt using pip to any version from the 2014.7 branch
forward. Previous version require recompiling some of the dependencies which is
painful in windows.
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
of the 2015.2 branch:
.. code-block:: yaml
install_salt:
pip.installed:
- cwd: 'C:\salt\bin\scripts'
- bin_env: 'C:\salt\bin\scripts\pip.exe'
- editable: git+https://github.com/saltstack/salt@2015.2#egg=salt
- upgrade: True
restart_service:
service.running:
- name: salt-minion
- enable: True
- watch:
- pip: install_salt
.. note::
If you're having problems, you might try doubling the back slashes. For
example, cwd: 'C:\\salt\\bin\\scripts'. Sometimes python thinks the single
back slash is an escape character.
'''
from __future__ import absolute_import

View file

@ -181,10 +181,11 @@ class PipModuleTest(integration.ModuleCase):
)
try:
self.assertEqual(ret['retcode'], 0)
self.assertIn(
'Successfully installed pep8 Blinker SaltTesting',
ret['stdout']
)
for package in ('Blinker', 'SaltTesting', 'pep8'):
self.assertRegexpMatches(
ret['stdout'],
r'(?:.*)(Successfully installed)(?:.*)({0})(?:.*)'.format(package)
)
except AssertionError:
import pprint
pprint.pprint(ret)