Merge remote-tracking branch 'upstream/develop' into sam_raet_48

This commit is contained in:
Samuel M Smith 2014-06-27 17:10:11 -06:00
commit b8431b4e4b
9 changed files with 96 additions and 13 deletions

View File

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

View File

@ -18,7 +18,8 @@ testing making roughly double the coverage in the Salt tests, and comes with
many new features.
2014.1.0 is the first release to follow the new date-based release naming
system.
system. See the :doc:`version numbers</topics/releases/version_numbers>`
page for more details.
Major Features
==============

View File

@ -2,6 +2,9 @@
Release notes
=============
See the :doc:`version numbers</topics/releases/version_numbers>` page for more
information about the version numbering scheme.
.. releasestree::
:maxdepth: 1
@ -14,7 +17,7 @@ Archive
:maxdepth: 1
:glob:
*
[0-9]*
.. seealso:: :doc:`Legacy salt-cloud release docs <../cloud/releases/index>`

View File

@ -0,0 +1,33 @@
===============
Version Numbers
===============
Salt uses a date based system for version numbers. Version numbers are in the
format ``YYYY.MM.R``. The year (``YYYY``) and month (``MM``) reflect when the
release was created. The bugfix release number (``R``) increments within that
feature release.
.. note:: Prior to the ``2014.1.0`` release, the typical semantic versioning was
still being used. Because of the rolling nature of the project, this did not
make sense. The ``0.17`` release was the last of that style.
Code Names
----------
To distinguish future releases from the current release, code names are used.
The periodic table is used to derive the next codename. The first release in
the date based system was code named ``Hydrogen``, each subsequent release will
go to the next atomic number.
Example
-------
An example might help clarify how this all works.
It is the year ``2020`` and the current code name is ``Iodine``. A release is ready
to be cut and the month is ``June``. This would make the new release number
``2020.6.0``. After three bug fix releases, the release number would be
``2020.6.3``.
After the release is cut, new features would be worked on under the ``Xenon``
code name and the process repeats itself.

View File

@ -912,7 +912,10 @@ class NixExecutor(ioflo.base.deeding.Deed):
yid=data['jid'],
lanename=self.opts['id'],
dirpath=self.opts['sock_dir'])
self.uxd_stack.value.addRemote(ex_yard)
try:
self.uxd_stack.value.addRemote(ex_yard)
except Exception:
pass # if the yard is already there don't worry
process = multiprocessing.Process(
target=self.proc_run,
kwargs={'exchange': exchange}

View File

@ -267,7 +267,7 @@ def salt_auth_tool():
'''
# Redirect to the login page if the session hasn't been authed
if not cherrypy.session.has_key('token'): # pylint: disable=W8601
raise cherrypy.InternalRedirect('/login')
raise cherrypy.HTTPError(401)
# Session is authenticated; inform caches
cherrypy.response.headers['Cache-Control'] = 'private'
@ -298,7 +298,7 @@ def hypermedia_handler(*args, **kwargs):
cherrypy.response.processors = dict(ct_out_map)
ret = cherrypy.serving.request._hypermedia_inner_handler(*args, **kwargs)
except salt.exceptions.EauthAuthenticationError:
raise cherrypy.InternalRedirect('/login')
raise cherrypy.HTTPError(401)
except cherrypy.CherryPyException:
raise
except Exception as exc:
@ -1238,7 +1238,7 @@ class Events(object):
# Manually verify the token
if not salt_token or not self.auth.get_tok(salt_token):
raise cherrypy.InternalRedirect('/login')
raise cherrypy.HTTPError(401)
# Release the session lock before starting the long-running response
cherrypy.session.release_lock()

View File

@ -180,12 +180,28 @@ external template file.
following tags: `macro`, `set`, `load_yaml`, `load_json`, `import_yaml` and
`import_json`.
Calling Salt Functions
======================
The Jinja renderer provides a shorthand lookup syntax for the ``salt``
dictionary of :term:`execution function <Execution Function>`.
.. versionadded:: Helium
.. code-block:: yaml
# The following two function calls are equivalent.
{{ salt['cmd.run']('whoami') }}
{{ salt.cmd.run('whoami') }}
Debugging
=========
The ``show_full_context`` function can be used to output all variables present
in the current Jinja context.
.. versionadded:: Helium
.. code-block:: yaml
Context is: {{ show_full_context }}
@ -205,6 +221,23 @@ import salt.utils.templates
log = logging.getLogger(__name__)
def _split_module_dicts(__salt__):
'''
Create a dictionary from module.function as module[function]
Takes advantage of Jinja's syntactic sugar lookup:
.. code-block::
{{ salt.cmd.run('uptime') }}
'''
mod_dict = {}
for module_func_name in __salt__.keys():
mod, _, fun = module_func_name.partition('.')
mod_dict.setdefault(mod, {})[fun] = __salt__[module_func_name]
return mod_dict
def render(template_file, saltenv='base', sls='', argline='',
context=None, tmplpath=None, **kws):
'''
@ -218,9 +251,14 @@ def render(template_file, saltenv='base', sls='', argline='',
raise SaltRenderError(
'Unknown renderer option: {opt}'.format(opt=argline)
)
salt_dict = {}
salt_dict.update(_split_module_dicts(__salt__))
salt_dict.update(__salt__)
tmp_data = salt.utils.templates.JINJA(template_file,
to_str=True,
salt=__salt__,
salt=salt_dict,
grains=__grains__,
opts=__opts__,
pillar=__pillar__,

View File

@ -52,7 +52,6 @@ ensure_in_syspath(CODE_DIR, SALT_LIBS)
import salt
import salt._compat
import salt.config
import salt.master
import salt.minion
import salt.runner
import salt.output
@ -61,6 +60,12 @@ import salt.utils
from salt.utils import fopen, get_colors
from salt.utils.verify import verify_env
try:
import salt.master
except ImportError:
# Not required fro raet tests
pass
# Import 3rd-party libs
import yaml

View File

@ -23,8 +23,8 @@ class TestAuth(BaseRestCherryPyTest):
'''
POST requests to the root URL redirect to login
'''
self.assertRaisesRegexp(cherrypy.InternalRedirect, '/login',
self.request, '/', method='POST', data={})
request, response = self.request('/', method='POST', data={})
self.assertEqual(response.status, '401 Unauthorized')
def test_login_noauth(self):
'''
@ -37,8 +37,8 @@ class TestAuth(BaseRestCherryPyTest):
'''
Requests to the webhook URL require auth by default
'''
self.assertRaisesRegexp(cherrypy.InternalRedirect, '/login',
self.request, '/hook', method='POST', data={})
request, response = self.request('/hook', method='POST', data={})
self.assertEqual(response.status, '401 Unauthorized')
class TestLogin(BaseRestCherryPyTest):