Merge remote-tracking branch 'upstream/2015.5' into merge-forward-2015.8

Conflicts:
    doc/conf.py
    doc/topics/cloud/config.rst
    doc/topics/cloud/index.rst
    salt/modules/git.py
    salt/states/git.py
    salt/states/pkgrepo.py
This commit is contained in:
Colton Myers 2015-09-01 15:35:21 -06:00
commit 1e1f5f3a95
21 changed files with 281 additions and 117 deletions

View file

@ -228,8 +228,11 @@ rst_prolog = """\
.. _`salt-packagers`: https://groups.google.com/forum/#!forum/salt-packagers
.. |windownload| raw:: html
<a href="https://repo.saltstack.com/windows/Salt-Minion-{release}-2-x86-Setup.exe"><strong>Salt-Minion-{release}-x86-Setup.exe</strong></a>
| <a href="https://repo.saltstack.com/windows/Salt-Minion-{release}-x86-Setup.exe.md5"><strong>md5</strong></a>
<p>x86: <a href="https://repo.saltstack.com/windows/Salt-Minion-{release}-x86-Setup.exe"><strong>Salt-Minion-{release}-x86-Setup.exe</strong></a>
| <a href="https://repo.saltstack.com/windows/Salt-Minion-{release}-x86-Setup.exe.md5"><strong>md5</strong></a></p>
<p>AMD64: <a href="https://repo.saltstack.com/windows/Salt-Minion-{release}-AMD64-Setup.exe"><strong>Salt-Minion-{release}-AMD64-Setup.exe</strong></a>
| <a href="https://repo.saltstack.com/windows/Salt-Minion-{release}-AMD64-Setup.exe.md5"><strong>md5</strong></a></p>
""".format(release=release)

View file

@ -15,6 +15,27 @@ Description
Salt-key executes simple management of Salt server public keys used for
authentication.
On initial connection, a Salt minion sends its public key to the Salt
master. This key must be accepted using the ``salt-key`` command on the
Salt master.
Salt minion keys can be in one of the following states:
- **unaccepted**: key is waiting to be accepted.
- **accepted**: key was accepted and the minion can communicate with the Salt
master.
- **rejected**: key was rejected using the ``salt-key`` command. In
this state the minion does not receive any communication from the Salt
master.
- **denied**: key was rejected automatically by the Salt master.
This occurs when a minion has a duplicate ID, or when a minion was rebuilt or
had new keys generated and the previous key was not deleted from the Salt
master. In this state the minion does not receive any communication from the
Salt master.
To change the state of a minion key, use ``-d`` to delete the key and then
accept or reject the key.
Options
=======
@ -163,4 +184,4 @@ See also
:manpage:`salt(7)`
:manpage:`salt-master(1)`
:manpage:`salt-minion(1)`
:manpage:`salt-minion(1)`

View file

@ -333,6 +333,21 @@ on.
The platform field is a comma-delimited list of platforms that this module is
known to run on.
Log Output
==========
You can call the logger from custom modules to write messages to the minion
logs. The following code snippet demonstrates writing log messages:
.. code-block:: python
import logging
log = logging.getLogger(__name__)
log.info('Here is Some Information')
log.warning('You Should Not Do That')
log.error('It Is Busted')
Private Functions
=================

View file

@ -228,6 +228,22 @@ prepared to refresh, then return True and the mod_init will not be called
the next time a pkg state is evaluated, otherwise return False and the mod_init
will be called next time a pkg state is evaluated.
Log Output
==========
You can call the logger from custom modules to write messages to the minion
logs. The following code snippet demonstrates writing log messages:
.. code-block:: python
import logging
log = logging.getLogger(__name__)
log.info('Here is Some Information')
log.warning('You Should Not Do That')
log.error('It Is Busted')
Full State Module Example
=========================

View file

@ -500,35 +500,11 @@ And in the map file:
Saltify
-------
The Saltify driver is a new, experimental driver for installing Salt on
existing machines (virtual or bare metal). Because it does not use an actual
cloud provider, it needs no configuration in the main cloud config file.
However, it does still require a profile to be set up, and is most useful when
used inside a map file. The key parameters to be set are ``ssh_host``,
``ssh_username`` and either ``ssh_keyfile`` or ``ssh_password``. These may all
be set in either the profile or the map. An example configuration might use the
following in cloud.profiles:
.. code-block:: yaml
make_salty:
driver: saltify
And in the map file:
.. code-block:: yaml
make_salty:
- myinstance:
ssh_host: 54.262.11.38
ssh_username: ubuntu
ssh_keyfile: '/etc/salt/mysshkey.pem'
sudo: True
.. note::
In the cloud profile that uses this provider configuration, the syntax for the
``provider`` required field would be ``provider: make_salty``.
The Saltify driver is a new, experimental driver designed to install Salt on a remote
machine, virtual or bare metal, using SSH. This driver is useful for provisioning
machines which are already installed, but not Salted. For more information about using
this driver and for configuration examples, please see the
:ref:`Gettting Started with Saltify <getting-started-with-saltify>` documentation.
Extending Profiles and Cloud Providers Configuration

View file

@ -171,6 +171,7 @@ Cloud Provider Specifics
Getting Started With Parallels <parallels>
Getting Started With Proxmox <proxmox>
Getting Started With Rackspace <rackspace>
Getting Started With Saltify <saltify>
Getting Started With Scaleway <scaleway>
Getting Started With SoftLayer <softlayer>
Getting Started With Vexxhost <vexxhost>
@ -178,9 +179,6 @@ Cloud Provider Specifics
Getting Started With vSphere <vsphere>
Miscellaneous Options
=====================

View file

@ -0,0 +1,121 @@
.. _getting-started-with-saltify:
============================
Getting Started With Saltify
============================
The Saltify driver is a new, experimental driver for installing Salt on existing
machines (virtual or bare metal).
Dependencies
============
The Saltify driver has no external dependencies.
Configuration
=============
Because the Saltify driver does not use an actual cloud provider host, it has a
simple provider configuration. The only thing that is required to be set is the
driver name, and any other potentially useful information, like the location of
the salt-master:
.. code-block:: yaml
# Note: This example is for /etc/salt/cloud.providers file or any file in
# the /etc/salt/cloud.providers.d/ directory.
my-saltify-config:
minion:
master: 111.222.333.444
provider: saltify
Profiles
========
Saltify requires a profile to be configured for each machine that needs Salt
installed. The initial profile can be set up at ``/etc/salt/cloud.profiles``
or in the ``/etc/salt/cloud.profiles.d/`` directory. Each profile requires
both an ``ssh_host`` and an ``ssh_username`` key parameter as well as either
an ``key_filename`` or a ``password``.
Profile configuration example:
.. code-block:: yaml
# /etc/salt/cloud.profiles.d/saltify.conf
salt-this-machine:
ssh_host: 12.34.56.78
ssh_username: root
key_filename: '/etc/salt/mysshkey.pem'
provider: my-saltify-config
The machine can now be "Salted" with the following command:
.. code-block:: bash
salt-cloud -p salt-this-machine my-machine
This will install salt on the machine specified by the cloud profile,
``salt-this-machine``, and will give the machine the minion id of
``my-machine``. If the command was executed on the salt-master, its Salt
key will automatically be signed on the master.
Once a salt-minion has been successfully installed on the instance, connectivity
to it can be verified with Salt:
.. code-block:: bash
salt my-machine test.ping
Using Map Files
---------------
The settings explained in the section above may also be set in a map file. An
example of how to use the Saltify driver with a map file follows:
.. code-block:: yaml
# /etc/salt/saltify-map
make_salty:
- my-instance-0:
ssh_host: 12.34.56.78
ssh_username: root
password: very-bad-password
- my-instance-1:
ssh_host: 44.33.22.11
ssh_username: root
password: another-bad-pass
Note: When using a cloud map with the Saltify driver, the name of the profile
to use, in this case ``make_salty``, must be defined in a profile config. For
example:
.. code-block:: yaml
# /etc/salt/cloud.profiles.d/saltify.conf
make_salty:
provider: my-saltify-config
The machines listed in the map file can now be "Salted" by applying the
following salt map command:
.. code-block:: bash
salt-cloud -m /etc/salt/saltify-map
This command will install salt on the machines specified in the map and will
give each machine their minion id of ``my-instance-0`` and ``my-instance-1``,
respectively. If the command was executed on the salt-master, its Salt key will
automatically be signed on the master.
Connectivity to the new "Salted" instances can now be verified with Salt:
.. code-block:: bash
salt 'my-instance-*' test.ping

View file

@ -2,4 +2,4 @@
Logging Internals
=================
TODO
TODO

View file

@ -2,7 +2,7 @@
SUSE Installation
=================
With openSUSE 13.1, Salt 0.16.4 has been available in the primary repositories.
With openSUSE 13.2, Salt 2014.1.11 is available in the primary repositories.
The devel:language:python repo will have more up to date versions of salt,
all package development will be done there.
@ -109,30 +109,6 @@ For openSUSE 13.1 run the following as root:
zypper refresh
zypper install salt salt-minion salt-master
For openSUSE 12.3 run the following as root:
.. code-block:: bash
zypper addrepo http://download.opensuse.org/repositories/devel:languages:python/openSUSE_12.3/devel:languages:python.repo
zypper refresh
zypper install salt salt-minion salt-master
For openSUSE 12.2 run the following as root:
.. code-block:: bash
zypper addrepo http://download.opensuse.org/repositories/devel:languages:python/openSUSE_12.2/devel:languages:python.repo
zypper refresh
zypper install salt salt-minion salt-master
For openSUSE 12.1 run the following as root:
.. code-block:: bash
zypper addrepo http://download.opensuse.org/repositories/devel:languages:python/openSUSE_12.1/devel:languages:python.repo
zypper refresh
zypper install salt salt-minion salt-master
For bleeding edge python Factory run the following as root:
.. code-block:: bash

View file

@ -23,7 +23,7 @@ minion exe>` should match the contents of the corresponding md5 file.
`Earlier builds from supported branches <https://repo.saltstack.com/windows/>`__
`Archived builds from unsupported branches <https://repo.saltstack.com/archive/>`__
`Archived builds from unsupported branches <https://repo.saltstack.com/windows/archive/>`__
.. note::

View file

@ -184,14 +184,15 @@ configuration file:
.. code-block:: yaml
schedule:
orchestrate:
run_my_orch:
function: state.orchestrate
seconds: 35
minutes: 30
hours: 3
hours: 6
splay: 600
args:
- orchestration.my_orch
The above configuration will execute the state.orchestrate runner every 3 hours,
30 minutes and 35 seconds, or every 12,635 seconds.
The above configuration is analogous to running
``salt-run state.orch orchestration.my_orch`` every 6 hours.
Scheduler With Returner
=======================

38
doc/topics/ssh/index.html Normal file
View file

@ -0,0 +1,38 @@
<row class="intro-row">
<div class="col-sm-6">
<div class="intro-text">Execute salt commands and states over ssh without installing a salt-minion.</div>
</div>
<div class="col-sm-6">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/F3WZKhKKhz0"></iframe>
</div>
</div>
</row>
<row class="intro-row">
<div class="col-sm-12"><br />
</div>
</row>
<row class="intro-row">
<div class="col-sm-6">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/qWG5pI8Glbs"></iframe>
</div>
</div>
<div class="col-sm-6">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/d1Q1g5AFHbk"></iframe>
</div>
</div>
</row>
<row class="intro-row">
<div class="col-sm-12"><br />
</div>
</row>

View file

@ -2,43 +2,30 @@
Salt SSH
========
.. note::
.. raw:: html
:file: index.html
Salt ssh is considered production ready in version 2014.7.0
.. note::
On many systems, the ``salt-ssh`` executable will be in its own package, usually named
``salt-ssh``.
In version 0.17.0 of Salt a new transport system was introduced, the ability
to use SSH for Salt communication. This addition allows for Salt routines to
be executed on remote systems entirely through ssh, bypassing the need for
a Salt Minion to be running on the remote systems and the need for a Salt
Master.
.. note::
The Salt SSH system does not supercede the standard Salt communication
systems, it simply offers an SSH based alternative that does not require
ZeroMQ and a remote agent. Be aware that since all communication with Salt SSH is
executed via SSH it is substantially slower than standard Salt with ZeroMQ.
Getting Started
===============
Salt SSH is very easy to use, simply set up a basic `roster` file of the
systems to connect to and run ``salt-ssh`` commands in a similar way as
standard ``salt`` commands.
.. note::
The Salt SSH eventually is supposed to support the same set of commands and
functionality as standard ``salt`` command.
At the moment fileserver operations must be wrapped to ensure that the
relevant files are delivered with the ``salt-ssh`` commands.
The state module is an exception, which compiles the state run on the
master, and in the process finds all the references to ``salt://`` paths and
copies those files down in the same tarball as the state run.
However, needed fileserver wrappers are still under development.
- Salt ssh is considered production ready in version 2014.7.0
- Python is required on the remote system (unless using the ``-r`` option to send raw ssh commands)
- On many systems, the ``salt-ssh`` executable will be in its own package, usually named
``salt-ssh``
- The Salt SSH system does not supercede the standard Salt communication
systems, it simply offers an SSH-based alternative that does not require
ZeroMQ and a remote agent. Be aware that since all communication with Salt SSH is
executed via SSH it is substantially slower than standard Salt with ZeroMQ.
- At the moment fileserver operations must be wrapped to ensure that the
relevant files are delivered with the ``salt-ssh`` commands.
The state module is an exception, which compiles the state run on the
master, and in the process finds all the references to ``salt://`` paths and
copies those files down in the same tarball as the state run.
However, needed fileserver wrappers are still under development.
Salt SSH Roster
===============

View file

@ -6,6 +6,7 @@ import os
from salt.utils import parsers
from salt.config import _expand_glob_path
import salt.cli.caller
import salt.defaults.exitcodes
class SaltCall(parsers.SaltCallOptionParser):
@ -41,10 +42,10 @@ class SaltCall(parsers.SaltCallOptionParser):
if self.options.doc:
caller.print_docs()
self.exit(os.EX_OK)
self.exit(salt.defaults.exitcodes.EX_OK)
if self.options.grains_run:
caller.print_grains()
self.exit(os.EX_OK)
self.exit(salt.defaults.exitcodes.EX_OK)
caller.run()

View file

@ -2,13 +2,12 @@
from __future__ import print_function
from __future__ import absolute_import
import os
from salt.utils import parsers
from salt.utils import activate_profile
from salt.utils import output_profile
from salt.utils.verify import check_user
from salt.exceptions import SaltClientError
import salt.defaults.exitcodes # pylint: disable=W0611
class SaltRun(parsers.SaltRunOptionParser):
@ -30,7 +29,7 @@ class SaltRun(parsers.SaltRunOptionParser):
runner = salt.runner.Runner(self.config)
if self.options.doc:
runner.print_docs()
self.exit(os.EX_OK)
self.exit(salt.defaults.exitcodes.EX_OK)
# Run this here so SystemExit isn't raised anywhere else when
# someone tries to use the runners via the python API

View file

@ -21,11 +21,12 @@ import subprocess
THIN_ARCHIVE = 'salt-thin.tgz'
EXT_ARCHIVE = 'salt-ext_mods.tgz'
# Keep these in sync with salt/exitcodes.py
# Keep these in sync with salt/defaults/exitcodes.py
EX_THIN_DEPLOY = 11
EX_THIN_CHECKSUM = 12
EX_MOD_DEPLOY = 13
EX_SCP_NOT_FOUND = 14
EX_CANTCREAT = 73
class OBJ(object):
@ -146,7 +147,7 @@ def main(argv): # pylint: disable=W0613
'ERROR: salt path "{0}" exists but is'
' not a directory\n'.format(OPTIONS.saltdir)
)
sys.exit(os.EX_CANTCREAT)
sys.exit(EX_CANTCREAT)
version_path = os.path.join(OPTIONS.saltdir, 'version')
if not os.path.exists(version_path) or not os.path.isfile(version_path):

View file

@ -1715,7 +1715,15 @@ class Map(Cloud):
# - bar1:
# - bar2:
overrides = {}
overrides.setdefault('name', name)
try:
overrides.setdefault('name', name)
except AttributeError:
log.error(
'Cannot use \'name\' as a minion id in a cloud map as it '
'is a reserved word. Please change \'name\' to a different '
'minion id reference.'
)
return ''
entries[name] = overrides
map_[profile] = entries
continue

View file

@ -6,13 +6,13 @@ The Saltify module is designed to install Salt on a remote machine, virtual or
bare metal, using SSH. This module is useful for provisioning machines which
are already installed, but not Salted.
Use of this module requires no configuration in the main cloud configuration
file. However, profiles must still be configured, as described in the
:ref:`core config documentation <config_saltify>`.
Use of this module requires some configuration in cloud profile and provider
files as described in the
:ref:`Gettting Started with Saltify <getting-started-with-saltify>` documentation.
'''
from __future__ import absolute_import
# Import python libs
from __future__ import absolute_import
import logging
# Import salt libs

View file

@ -571,8 +571,10 @@ def _find_set_info(set):
setinfo = {}
_tmp = out['stdout'].split('\n')
for item in _tmp:
key, value = item.split(':', 1)
setinfo[key] = value[1:]
# Only split if item has a colon
if ':' in item:
key, value = item.split(':', 1)
setinfo[key] = value[1:]
return setinfo

View file

@ -446,7 +446,7 @@ def latest(name,
bare = True
# Check to make sure rev and mirror/bare are not both in use
if rev and bare:
if rev != 'HEAD' and bare:
return _fail(ret, ('\'rev\' is not compatible with the \'mirror\' and '
'\'bare\' arguments'))

View file

@ -171,7 +171,7 @@ def managed(name, **kwargs):
dist
This dictates the release of the distro the packages should be built
for. (e.g. unstable)
for. (e.g. unstable). This option is rarely needed.
keyid
The KeyID of the GPG key to install. This option also requires
@ -179,11 +179,12 @@ def managed(name, **kwargs):
keyserver
This is the name of the keyserver to retrieve gpg keys from. The
keyid option must also be set for this option to work.
``keyid`` option must also be set for this option to work.
key_url
URL to retrieve a GPG key from. Allows the usage of ``http://``,
``https://`` as well as ``salt://``.
``https://`` as well as ``salt://``. Use either ``keyid``/``keyserver``
or ``key_url``, but not both.
consolidate
If set to true, this will consolidate all sources definitions to