From b19b95d992aacbd8340f4c4d59d5ff045ca6def1 Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 17 Apr 2015 11:41:07 -0600 Subject: [PATCH 01/16] Added release note for 2014.7.5 release --- doc/topics/releases/2014.7.5.rst | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 doc/topics/releases/2014.7.5.rst diff --git a/doc/topics/releases/2014.7.5.rst b/doc/topics/releases/2014.7.5.rst new file mode 100644 index 0000000000..791f9b63ea --- /dev/null +++ b/doc/topics/releases/2014.7.5.rst @@ -0,0 +1,59 @@ +=========================== +Salt 2014.7.5 Release Notes +=========================== + +:release: TBA + +Version 2014.7.5 is a bugfix release for :doc:`2014.7.0 +`. + +Changes: + +- +- Fixed a key error bug in salt-cloud +- Updated man pages to better match documentation +- Fixed bug concerning high CPU usage with salt-ssh +- Fixed bugs with remounting cvfs and fuse filesystems +- Fixed bug with alowing requisite tracking of entire sls files +- Fixed bug with aptpkg.mod_repo returning OK even if apt-add-repository fails +- Increased frequency of ssh terminal output checking +- Fixed malformed locale string in localmod module +- Fixed checking of available version of package when accept_keywords were changed +- Fixed bug to make git.latest work with empty repositories +- Added **kwargs to service.mod_watch which removes warnings about `enable` and `__reqs__` not being supported by the function +- Improved state comments to not grow so quickly on failed requisites +- Added force argument to service to trigger force_reload +- Fixed bug to andle pkgrepo keyids that have been converted to int +- Fixed module.portage_config bug with appending accept_keywords +- Fixed bug to correctly report disk usage on windows minion +- Added the ability to specify key prefix for S3 ext_pillar +- Fixed issues with batch mode operating on the incorrect number of minions +- Fixed a bug with the proxmox cloud provider stacktracing on disk definition +- Fixed a bug with the changes dictionary in the file state +- Fixed the TCP keep alive settings to work better with SREQ caching +- Fixed many bugs within the iptables state and module +- Fixed bug with states by adding `fun`, `state`, and `unless` to the state runtime internal keywords listing +- Added ability to eAuth against Active Directory +- Fixed some salt-ssh issues when running on Fedora 21 +- Fixed grains.get_or_set_hash to work with multiple entries under same key +- Added better explanations and more examples of how the Reactor calls functions to docs +- Fixed bug to not pass `ex_config_drive` to libcloud unless it's explicitly enabled +- Fixed bug with pip.install on windows +- Fixed bug where puppet.run always returns a 0 retcode +- Fixed race condition bug with minion scheduling via pillar +- Made efficiency improvements and bug fixes to the windows installer +- Updated environment variables to fix bug with pygit2 when running salt as non-root user +- Fixed cas behavior on data module -- data.cas was not saving changes +- Fixed GPG rendering error +- Fixed strace error in virt.query +- Fixed stacktrace when running chef-solo command +- Fixed possible bug wherein uncaught exceptions seem to make zmq3 tip over when threading is involved +- Fixed argument passing to the reactor +- Fixed glibc caching to prevent bug where salt-minion getaddrinfo in dns_check() never got updated nameservers + +Known issues: + +- In multimaster mode, a minion may become temporarily unresponsive + if modules or pillars are refreshed at the same time that one + or more masters are down. This can be worked around by setting + 'auth_timeout' and 'auth_tries' down to shorter periods. From fde1feed466d32ff2e95aef9334a27e199d07e65 Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 17 Apr 2015 11:42:14 -0600 Subject: [PATCH 02/16] Remove extra line --- doc/topics/releases/2014.7.5.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/topics/releases/2014.7.5.rst b/doc/topics/releases/2014.7.5.rst index 791f9b63ea..47ade5b4c9 100644 --- a/doc/topics/releases/2014.7.5.rst +++ b/doc/topics/releases/2014.7.5.rst @@ -9,7 +9,6 @@ Version 2014.7.5 is a bugfix release for :doc:`2014.7.0 Changes: -- - Fixed a key error bug in salt-cloud - Updated man pages to better match documentation - Fixed bug concerning high CPU usage with salt-ssh From 9d394dfe46ee09a9b1605a18dab5cac1a746ee76 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Fri, 17 Apr 2015 12:49:54 -0500 Subject: [PATCH 03/16] Improve error logging for pygit2 SSH-based remotes If libgit2 is compiled without libssh2, an "Unsupported URL protocol" GitError exception is raised. This commit catches this exception and, if the credentials are a keypair (which means SSH auth), logs an meaningful error message that will let the user know that libgit2 was probably not compiled with libssh2. --- salt/fileserver/gitfs.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/salt/fileserver/gitfs.py b/salt/fileserver/gitfs.py index 4b208a7175..1d7e2013d5 100644 --- a/salt/fileserver/gitfs.py +++ b/salt/fileserver/gitfs.py @@ -1147,7 +1147,21 @@ def update(): except KeyError: # No credentials configured for this repo pass - fetch = origin.fetch() + try: + fetch = origin.fetch() + except pygit2.errors.GitError as exc: + # Using exc.__str__() here to avoid deprecation warning + # when referencing exc.message + if 'unsupported url protocol' in exc.__str__().lower() \ + and isinstance(repo.get('credentials'), + pygit2.Keypair): + log.error( + 'Unable to fetch SSH-based gitfs remote {0}. ' + 'libgit2 must be compiled with libssh2 to support ' + 'SSH authentication.'.format(repo['url']) + ) + continue + raise try: # pygit2.Remote.fetch() returns a dict in pygit2 < 0.21.0 received_objects = fetch['received_objects'] From 2093bf8d963e9643baa7453f0a58d2ea4be0c247 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Fri, 17 Apr 2015 13:02:50 -0500 Subject: [PATCH 04/16] Adjust loglevels for gitfs errors The "critical" loglevel should be used for hard failures only. --- salt/fileserver/gitfs.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/salt/fileserver/gitfs.py b/salt/fileserver/gitfs.py index 1d7e2013d5..0d14487077 100644 --- a/salt/fileserver/gitfs.py +++ b/salt/fileserver/gitfs.py @@ -572,7 +572,7 @@ def _verify_auth(repo): ''' Helper function to log errors about missing auth parameters ''' - log.error( + log.critical( 'Incomplete authentication information for remote {0}. Missing ' 'parameters: {1}'.format(remote_url, ', '.join(missing)) ) @@ -595,7 +595,7 @@ def _verify_auth(repo): user = address.split('@')[0] if user == address: # No '@' sign == no user. This is a problem. - log.error( + log.critical( 'Password / keypair specified for remote {0}, but remote ' 'URL is missing a username'.format(repo['url']) ) @@ -620,7 +620,7 @@ def _verify_auth(repo): return True if password_ok: if transport == 'http' and not repo['insecure_auth']: - log.error( + log.critical( 'Invalid configuration for gitfs remote {0}. ' 'Authentication is disabled by default on http remotes. ' 'Either set gitfs_insecure_auth to True in the master ' @@ -636,7 +636,7 @@ def _verify_auth(repo): missing_auth = [x for x in required_params if not bool(repo[x])] _incomplete_auth(repo['url'], missing_auth) else: - log.error( + log.critical( 'Invalid configuration for remote {0}. Unsupported transport ' '{1!r}.'.format(repo['url'], transport) ) @@ -700,7 +700,7 @@ def init(): salt.utils.repack_dictlist(remote[repo_url]).items()] ) if not per_remote_conf: - log.error( + log.critical( 'Invalid per-remote configuration for gitfs remote {0}. ' 'If no per-remote parameters are being specified, there ' 'may be a trailing colon after the URL, which should be ' @@ -811,7 +811,7 @@ def init(): '{0}'.format(exc)) if provider == 'gitpython': msg += ' Perhaps git is not available.' - log.error(msg, exc_info_on_loglevel=logging.DEBUG) + log.critical(msg, exc_info_on_loglevel=logging.DEBUG) _failhard() if new_remote: @@ -1189,14 +1189,14 @@ def update(): try: refs_post = client.fetch(path, repo['repo']) except dulwich.errors.NotGitRepository: - log.critical( + log.error( 'Dulwich does not recognize remote {0} as a valid ' 'remote URL. Perhaps it is missing \'.git\' at the ' 'end.'.format(repo['url']) ) continue except KeyError: - log.critical( + log.error( 'Local repository cachedir {0!r} (corresponding ' 'remote: {1}) has been corrupted. Salt will now ' 'attempt to remove the local checkout to allow it to ' @@ -1207,7 +1207,7 @@ def update(): try: salt.utils.rm_rf(repo['cachedir']) except OSError as exc: - log.critical( + log.error( 'Unable to remove {0!r}: {1}' .format(repo['cachedir'], exc) ) @@ -1635,7 +1635,7 @@ def _file_lists(load, form): try: os.makedirs(list_cachedir) except os.error: - log.critical('Unable to make cachedir {0}'.format(list_cachedir)) + log.error('Unable to make cachedir {0}'.format(list_cachedir)) return [] list_cache = os.path.join( list_cachedir, From 09468d26076bf0a7015201aded683c1593b39733 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Fri, 17 Apr 2015 12:55:10 -0500 Subject: [PATCH 05/16] Fix incorrect log message In pygit2, the ssh transport doesn't accept password auth. --- salt/fileserver/gitfs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/fileserver/gitfs.py b/salt/fileserver/gitfs.py index 0d14487077..937f766196 100644 --- a/salt/fileserver/gitfs.py +++ b/salt/fileserver/gitfs.py @@ -596,8 +596,8 @@ def _verify_auth(repo): if user == address: # No '@' sign == no user. This is a problem. log.critical( - 'Password / keypair specified for remote {0}, but remote ' - 'URL is missing a username'.format(repo['url']) + 'Keypair specified for remote {0}, but remote URL is missing ' + 'a username'.format(repo['url']) ) _failhard() From 98885f71d629bb662c6805df8dc94ee43345166e Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Fri, 17 Apr 2015 13:24:14 -0500 Subject: [PATCH 06/16] Add information about libssh2 requirement for pygit2 ssh auth --- doc/topics/tutorials/gitfs.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/topics/tutorials/gitfs.rst b/doc/topics/tutorials/gitfs.rst index 106cd6f833..5c8ec4c42b 100644 --- a/doc/topics/tutorials/gitfs.rst +++ b/doc/topics/tutorials/gitfs.rst @@ -59,9 +59,12 @@ be used to install it: If pygit2_ is not packaged for the platform on which the Master is running, the pygit2_ website has installation instructions here__. Keep in mind however that following these instructions will install libgit2 and pygit2_ without system -packages. +packages. Additionally, keep in mind that :ref:`SSH authentication in pygit2 +` requires libssh2_ (*not* libssh) development +libraries to be present before libgit2 is built. .. __: http://www.pygit2.org/install.html +.. _libssh2: http://www.libssh2.org/ GitPython --------- @@ -186,7 +189,7 @@ master: ``git+ssh://``. 3. Restart the master to load the new configuration. - + .. note:: @@ -539,6 +542,8 @@ an ``insecure_auth`` parameter: - password: mypassword - insecure_auth: True +.. _pygit2-authentication-ssh: + SSH ~~~ @@ -647,7 +652,7 @@ server via SSH: .. code-block:: bash $ su - Password: + Password: # ssh github.com The authenticity of host 'github.com (192.30.252.128)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. From ce88b6ad414ae13cc221cecb1e52f7b3b626b83b Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 17 Apr 2015 13:33:22 -0600 Subject: [PATCH 07/16] Allow map file to work with softlayer Refs #17144 --- salt/cloud/clouds/softlayer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/salt/cloud/clouds/softlayer.py b/salt/cloud/clouds/softlayer.py index b88b8d3e72..68788f5455 100644 --- a/salt/cloud/clouds/softlayer.py +++ b/salt/cloud/clouds/softlayer.py @@ -571,6 +571,8 @@ def list_nodes(call=None): ret[node]['public_ips'] = nodes[node]['primaryIpAddress'] if 'primaryBackendIpAddress' in nodes[node]: ret[node]['private_ips'] = nodes[node]['primaryBackendIpAddress'] + if 'status' in nodes[node]: + ret[node]['state'] = str(nodes[node]['status']['name']) return ret From eadaead755ccdfd479f291c5930bc636261930c4 Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 17 Apr 2015 14:13:40 -0600 Subject: [PATCH 08/16] Add 2014.7.5 links to windows installation docs --- doc/topics/installation/windows.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/topics/installation/windows.rst b/doc/topics/installation/windows.rst index 19a66afa44..e548dd435c 100644 --- a/doc/topics/installation/windows.rst +++ b/doc/topics/installation/windows.rst @@ -20,6 +20,10 @@ minion exe>` should match the contents of the corresponding md5 file. .. admonition:: Download here + * 2014.7.5 + * `Salt-Minion-2014.7.4-x86-Setup.exe `__ | `md5 `__ + * `Salt-Minion-2014.7.4-AMD64-Setup.exe `__ | `md5 `__ + * 2014.7.4 * `Salt-Minion-2014.7.4-x86-Setup.exe `__ | `md5 `__ * `Salt-Minion-2014.7.4-AMD64-Setup.exe `__ | `md5 `__ From 5931a582d19dd2344ab8d24dc918c3a5d978b974 Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 17 Apr 2015 14:15:33 -0600 Subject: [PATCH 09/16] Replace all 4s with 5s --- doc/topics/installation/windows.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/topics/installation/windows.rst b/doc/topics/installation/windows.rst index e548dd435c..0401676cc5 100644 --- a/doc/topics/installation/windows.rst +++ b/doc/topics/installation/windows.rst @@ -21,8 +21,8 @@ minion exe>` should match the contents of the corresponding md5 file. .. admonition:: Download here * 2014.7.5 - * `Salt-Minion-2014.7.4-x86-Setup.exe `__ | `md5 `__ - * `Salt-Minion-2014.7.4-AMD64-Setup.exe `__ | `md5 `__ + * `Salt-Minion-2014.7.5-x86-Setup.exe `__ | `md5 `__ + * `Salt-Minion-2014.7.5-AMD64-Setup.exe `__ | `md5 `__ * 2014.7.4 * `Salt-Minion-2014.7.4-x86-Setup.exe `__ | `md5 `__ From d7e8741f02419d8de56b3e94116cb555320ef95f Mon Sep 17 00:00:00 2001 From: Colton Myers Date: Fri, 17 Apr 2015 14:29:23 -0600 Subject: [PATCH 10/16] Gate salt.states.file.py msgpack Fixes #22708 --- salt/states/file.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/salt/states/file.py b/salt/states/file.py index ae637a063b..2e26908cc6 100644 --- a/salt/states/file.py +++ b/salt/states/file.py @@ -272,7 +272,8 @@ def _load_accumulators(): with open(path, 'rb') as f: loaded = serial.load(f) return loaded if loaded else ret - except IOError: + except (IOError, NameError): + # NameError is a msgpack error from salt-ssh return ret loaded = _deserialize(_get_accumulator_filepath()) @@ -286,8 +287,12 @@ def _persist_accummulators(accumulators, accumulators_deps): 'accumulators_deps': accumulators_deps} serial = salt.payload.Serial(__opts__) - with open(_get_accumulator_filepath(), 'w+b') as f: - serial.dump(accumm_data, f) + try: + with open(_get_accumulator_filepath(), 'w+b') as f: + serial.dump(accumm_data, f) + except NameError: + # msgpack error from salt-ssh + pass def _check_user(user, group): From 02303b22ce928f276e6935b03825167fd121420b Mon Sep 17 00:00:00 2001 From: Colton Myers Date: Fri, 17 Apr 2015 14:32:02 -0600 Subject: [PATCH 11/16] Gate msgpack in salt/modules/data.py --- salt/modules/data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/modules/data.py b/salt/modules/data.py index c015219d6d..b3333909c3 100644 --- a/salt/modules/data.py +++ b/salt/modules/data.py @@ -47,7 +47,7 @@ def load(): datastore_path = os.path.join(__opts__['cachedir'], 'datastore') fn_ = salt.utils.fopen(datastore_path, 'rb') return serial.load(fn_) - except (IOError, OSError): + except (IOError, OSError, NameError): return {} @@ -75,7 +75,7 @@ def dump(new_data): return True - except (IOError, OSError): + except (IOError, OSError, NameError): return False From d4da8e66a41b4770ab917bbdac540311db9d159c Mon Sep 17 00:00:00 2001 From: Colton Myers Date: Fri, 17 Apr 2015 14:33:19 -0600 Subject: [PATCH 12/16] Gate msgpack in salt/modules/saltutil.py --- salt/modules/saltutil.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/salt/modules/saltutil.py b/salt/modules/saltutil.py index 0ece8d0919..7dd3dab3a0 100644 --- a/salt/modules/saltutil.py +++ b/salt/modules/saltutil.py @@ -522,7 +522,11 @@ def find_cached_job(jid): buf = fp_.read() fp_.close() if buf: - data = serial.loads(buf) + try: + data = serial.loads(buf) + except NameError: + # msgpack error in salt-ssh + return else: return if not isinstance(data, dict): From 8901b3b5a6131e6a99930a025a929310ea410434 Mon Sep 17 00:00:00 2001 From: twangboy Date: Fri, 17 Apr 2015 14:41:46 -0600 Subject: [PATCH 13/16] Updated instructions for building salt --- doc/topics/installation/windows.rst | 364 +++++++++++++++++++++------- 1 file changed, 274 insertions(+), 90 deletions(-) diff --git a/doc/topics/installation/windows.rst b/doc/topics/installation/windows.rst index 19a66afa44..90df32ec9f 100644 --- a/doc/topics/installation/windows.rst +++ b/doc/topics/installation/windows.rst @@ -161,7 +161,7 @@ line. The options `/master` and `/minion-name` allow for configuring the master hostname and minion name, respectively. Here's an example of using the silent installer: -.. code-block:: bash +.. code-block:: bat Salt-Minion-0.17.0-Setup-amd64.exe /S /master=yoursaltmaster /minion-name=yourminionname @@ -169,118 +169,304 @@ installer: Setting up a Windows build environment ====================================== -1. Install the Microsoft Visual C++ 2008 SP1 Redistributable, `vcredist_x86`_ - or `vcredist_x64`_. +This document will explain how to set up a development environment for salt on +Windows. The development environment allows you to work with the source code to +customize or fix bugs. It will also allow you to build your own installation. -2. Install `msysgit`_ +The Easy Way +============ -3. Clone the Salt git repository from GitHub - - .. code-block:: bash +Prerequisite Software +--------------------- - git clone git://github.com/saltstack/salt.git +To do this the easy way you only need to install `Git for Windows`_. -4. Install the latest point release of `Python 2.7`_ for the architecture you - wish to target +Create the Build Environment +---------------------------- +1. Clone the `Salt-Windows-Dev `_ + repo from github. -5. Add C:\\Python27 and C:\\Python27\\Scripts to your system path + Open a command line and type: -6. Download and run the Setuptools bootstrap - `ez_setup.py`_ + .. code-block:: bat - .. code-block:: bash + git clone https://github.com/saltstack/salt-windows-dev - python ez_setup.py - -7. Install Pip +2. Build the Python Environment - .. code-block:: bash - - easy_install pip + Go into the salt-windows-dev directory. Right-click the file named + **dev_env.ps1** and select **Run with PowerShell** -8. Install the latest point release of `OpenSSL for Windows`_ + If you get an error, you may need to change the execution policy. - #. During setup, choose first option to install in Windows system - directory + Open a powershell window and type the following: -9. Install the latest point release of `M2Crypto`_ + .. code-block:: powershell - #. In general, be sure to download installers targeted at py2.7 for your - chosen architecture + Set-ExecutionPolicy RemoteSigned -10. Install the latest point release of `pycrypto`_ + This will download and install Python with all the dependencies needed to + develop and build salt. -11. Install the latest point release of `pywin32`_ +3. Build the Salt Environment -12. Install the latest point release of `Cython`_ + Right-click on the file named **dev_env_salt.ps1** and select **Run with + Powershell** -13. Install the latest point release of `jinja2`_ + This will clone salt into ``C:\Salt-Dev\salt`` and set it to the 2015.2 + branch. You could optionally run the command from a powershell window with a + ``-Version`` switch to pull a different version. For example: -14. Install the latest point release of `msgpack`_ + .. code-block:: powershell -15. Install psutil + dev_env_salt.ps1 -Version '2014.7' - .. code-block:: bash + To view a list of available branches and tags, open a command prompt in your + `C:\Salt-Dev\salt` directory and type: - easy_install psutil + .. code-block:: bat -16. Install pyzmq - - .. code-block:: bash - - easy_install pyzmq - -17. Install PyYAML - - .. code-block:: bash - - easy_install pyyaml - -18. Install bbfreeze - - .. code-block:: bash - - easy_install bbfreeze - -19. Install wmi - - .. code-block:: bash - - pip install wmi - -20. Install esky - - .. code-block:: bash - - pip install esky - -21. Install Salt - - .. code-block:: bash - - cd salt - python setup.py install - -22. Build a frozen binary distribution of Salt - - .. code-block:: bash - - python setup.py bdist_esky - -A zip file has been created in the ``dist/`` folder, containing a frozen copy -of Python and the dependency libraries, along with Windows executables for each -of the Salt scripts. + git branch -a + git tag -n -Building the installer -====================== +The Hard Way +============ -The Salt Windows installer is built with the open-source NSIS compiler. The -source for the installer is found in the pkg directory of the Salt repo here: -:blob:`pkg/windows/installer/Salt-Minion-Setup.nsi`. To create the installer, -extract the frozen archive from ``dist/`` into ``pkg/windows/buildenv/`` and -run NSIS. +Prerequisite Software +--------------------- -The NSIS installer can be found here: http://nsis.sourceforge.net/Main_Page +Install the following software: + +1. `Git for Windows `_ +2. `Nullsoft Installer `_ + +Download the Prerequisite zip file for your CPU architecture from the +SaltStack download site: + +* `Salt32.zip `_ +* `Salt64.zip `_ + +These files contain all sofware required to build and develop salt. Unzip the +contents of the file to ``C:\Salt-Dev\temp``. + +Create the Build Environment +---------------------------- + +1. Build the Python Environment + + * Install Python: + + Browse to the ``C:\Salt-Dev\temp`` directory and find the Python + installation file for your CPU Architecture under the corresponding + subfolder. Double-click the file to install python. + + Make sure the following are in your **PATH** environment variable: + + .. code-block:: bat + + C:\Python27 + C:\Python27\Scripts + + * Install Pip + + Open a command prompt and navigate to ``C:\Salt-Dev\temp`` + Run the following command: + + .. code-block:: bat + + python get-pip.py + + * Easy Install compiled binaries. + + M2Crypto, PyCrypto, and PyWin32 need to be installed using Easy Install. + Open a command prompt and navigate to ``C:\Salt-Dev\temp\``. + Run the following commands: + + .. code-block:: bat + + easy_install -Z + easy_install -Z + easy_install -Z + + .. note:: + You can type the first part of the file name and then press the tab key + to auto-complete the name of the file. + + * Pip Install Additional Prerequisites + + All remaining prerequisites need to be pip installed. These prerequisites + are as follow: + + * MarkupSafe + * Jinja + * MsgPack + * PSUtil + * PyYAML + * PyZMQ + * WMI + * Requests + * Certifi + + Open a command prompt and navigate to ``C:\Salt-Dev\temp``. Run the following + commands: + + .. code-block:: bat + + pip install \ + pip install + pip install \ + pip install \ + pip install \ + pip install \ + pip install + pip install + pip install + +2. Build the Salt Environment + + * Clone Salt + + Open a command prompt and navigate to ``C:\Salt-Dev``. Run the following command + to clone salt: + + .. code-block:: bat + + git clone https://github.com/saltstack/salt + + * Checkout Branch + + Checkout the branch or tag of salt you want to work on or build. Open a + command prompt and navigate to ``C:\Salt-Dev\salt``. Get a list of + available tags and branches by running the following commands: + + .. code-block:: bat + + git fetch --all + + To view a list of available branches: + git branch -a + + To view a list of availabel tags: + git tag -n + + Checkout the branch or tag by typing the following command: + + .. code-block:: bat + + git checkout + + * Clean the Environment + + When switching between branches residual files can be left behind that + will interfere with the functionality of salt. Therefore, after you check + out the branch you want to work on, type the following commands to clean + the salt environment: + + .. code-block: bat + + git clean -fxd + git reset --hard HEAD + + +Developing with Salt +==================== +There are two ways to develop with salt. You can run salt's setup.py each time +you make a change to source code or you can use the setup tools develop mode. + + +Configure the Minion +-------------------- +Both methods require that the minion configuration be in the ``C:\salt`` +directory. Copy the conf and var directories from ``C:\Salt-Dev\salt\pkg\ +windows\buildenv`` to ``C:\salt``. Now go into the ``C:\salt\conf`` directory +and edit the file name ``minion`` (no extension). You need to configure the +master and id parameters in this file. Edit the following lines: + +.. code-block:: bat + + master: + id: + +Setup.py Method +--------------- +Go into the ``C:\Salt-Dev\salt`` directory from a cmd prompt and type: + +.. code-block:: bat + + python setup.py install --force + +This will install python into your python installation at ``C:\Python27``. +Everytime you make an edit to your source code, you'll have to stop the minion, +run the setup, and start the minion. + +To start the salt-minion go into ``C:\Python27\Scripts`` from a cmd prompt and +type: + +.. code-block:: bat + + salt-minion + +For debug mode type: + +.. code-block:: bat + + salt-minion -l debug + +To stop the minion press Ctrl+C. + + +Setup Tools Develop Mode (Preferred Method) +------------------------------------------- +To use the Setup Tools Develop Mode go into ``C:\Salt-Dev\salt`` from a cmd +prompt and type: + +.. code-block:: bat + + pip install -e . + +This will install pointers to your source code that resides at +``C:\Salt-Dev\salt``. When you edit your source code you only have to restart +the minion. + + +Build the windows installer +=========================== +This is the method of building the installer as of version 2014.7.4. + +Clean the Environment +--------------------- +Make sure you don't have any leftover salt files from previous versions of salt +in your Python directory. + +1. Remove all files that start with salt in the ``C:\Python27\Scripts`` + directory + +2. Remove all files and directorys that start with salt in the + ``C:\Python27\Lib\site-packages`` directory + +Install Salt +------------ +Install salt using salt's setup.py. From the ``C:\Salt-Dev\salt`` directory +type the following command: + +.. code-block:: bat + + python setup.py install --force + +Build the Installer +------------------- + +From cmd prompt go into the ``C:\Salt-Dev\salt\pkg\windows`` directory. Type +the following command for the branch or tag of salt you're building: + +.. code-block:: bat + + BuildSalt.bat + +This will copy python with salt installed to the ``buildenv\bin`` directory, +make it portable, and then create the windows installer . The .exe for the +windows installer will be placed in the ``installer`` directory. Testing the Salt minion @@ -335,7 +521,7 @@ salt, including all dependencies: This script is not up to date. Please use the installer found above -.. code-block:: bash +.. code-block:: powershell # (All in one line.) @@ -359,8 +545,6 @@ this, salt-minion can't report some installed softwares. .. _http://csa-net.dk/salt: http://csa-net.dk/salt -.. _vcredist_x86: http://www.microsoft.com/en-us/download/details.aspx?id=5582 -.. _vcredist_x64: http://www.microsoft.com/en-us/download/details.aspx?id=2092 .. _msysgit: http://code.google.com/p/msysgit/downloads/list?can=3 .. _Python 2.7: http://www.python.org/downloads .. _ez_setup.py: https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py From adc421acdd1921003a98116e13a753fcb24bcc42 Mon Sep 17 00:00:00 2001 From: twangboy Date: Fri, 17 Apr 2015 15:03:47 -0600 Subject: [PATCH 14/16] Fixed some formatting issues --- doc/topics/installation/windows.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/topics/installation/windows.rst b/doc/topics/installation/windows.rst index 90df32ec9f..e4990b17f6 100644 --- a/doc/topics/installation/windows.rst +++ b/doc/topics/installation/windows.rst @@ -174,15 +174,16 @@ Windows. The development environment allows you to work with the source code to customize or fix bugs. It will also allow you to build your own installation. The Easy Way -============ +------------ Prerequisite Software ---------------------- +^^^^^^^^^^^^^^^^^^^^^ -To do this the easy way you only need to install `Git for Windows`_. +To do this the easy way you only need to install `Git for Windows `_. Create the Build Environment ----------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1. Clone the `Salt-Windows-Dev `_ repo from github. @@ -231,10 +232,10 @@ Create the Build Environment The Hard Way -============ +------------ Prerequisite Software ---------------------- +^^^^^^^^^^^^^^^^^^^^^ Install the following software: @@ -251,7 +252,7 @@ These files contain all sofware required to build and develop salt. Unzip the contents of the file to ``C:\Salt-Dev\temp``. Create the Build Environment ----------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1. Build the Python Environment From f75b24ad68843626945598adb8c5378877edea95 Mon Sep 17 00:00:00 2001 From: Viet Hung Nguyen Date: Mon, 13 Apr 2015 18:59:26 +0700 Subject: [PATCH 15/16] gracefully handle when salt-minion cannot decrypt key or salt-minion will die. Returns None to deligate this job to compile_pillar function handle it, as it is the only caller of this function for now --- salt/transport/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/salt/transport/__init__.py b/salt/transport/__init__.py index b3d4e9ffdb..b9aa87d4ab 100644 --- a/salt/transport/__init__.py +++ b/salt/transport/__init__.py @@ -242,9 +242,13 @@ class ZeroMQChannel(Channel): def crypted_transfer_decode_dictentry(self, load, dictkey=None, tries=3, timeout=60): ret = self.sreq.send('aes', self.auth.crypticle.dumps(load), tries, timeout) key = self.auth.get_keys() - aes = key.private_decrypt(ret['key'], 4) - pcrypt = salt.crypt.Crypticle(self.opts, aes) - return pcrypt.loads(ret[dictkey]) + try: + aes = key.private_decrypt(ret['key'], 4) + except (TypeError, KeyError): + return None + else: + pcrypt = salt.crypt.Crypticle(self.opts, aes) + return pcrypt.loads(ret[dictkey]) def _crypted_transfer(self, load, tries=3, timeout=60): ''' From 8f1c0084cdc4dd08f00a8a9cd391fee92e1a35e7 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Fri, 17 Apr 2015 22:11:40 -0500 Subject: [PATCH 16/16] Clarify that for pygit2, receiving 0 objects means repo is up-to-date This seems to be too confusing to users, so this changes the log message to say that the repo is up-to-date instead of saying that 0 objects were received. --- salt/fileserver/gitfs.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/salt/fileserver/gitfs.py b/salt/fileserver/gitfs.py index 937f766196..2f0424596e 100644 --- a/salt/fileserver/gitfs.py +++ b/salt/fileserver/gitfs.py @@ -1169,10 +1169,16 @@ def update(): # pygit2.Remote.fetch() returns a class instance in # pygit2 >= 0.21.0 received_objects = fetch.received_objects - log.debug( - 'gitfs received {0} objects for remote {1}' - .format(received_objects, repo['url']) - ) + if received_objects != 0: + log.debug( + 'gitfs received {0} objects for remote {1}' + .format(received_objects, repo['url']) + ) + else: + log.debug( + 'gitfs remote {0} is up-to-date' + .format(repo['url']) + ) # Clean up any stale refs refs_post = repo['repo'].listall_references() cleaned = _clean_stale(repo['repo'], refs_post)