Merge pull request #19913 from basepi/merge-forward-2015.2

Merge forward from 2014.7 to 2015.2
This commit is contained in:
Thomas S Hatch 2015-01-21 12:03:08 -07:00
commit b6faad4bdc
7 changed files with 42 additions and 24 deletions

View File

@ -8,3 +8,5 @@ Version 2014.7.2 is a bugfix release for :doc:`2014.7.0
</topics/releases/2014.7.0>`. The changes include:
- Fix erroneous warnings for systemd service enabled check (:issue:`19606`)
- Fix FreeBSD kernel module loading, listing, and persistence
:mod:`kmod <salt.modules.freebsdkmod>` (:issue:`197151`, :issue:`19682`)

View File

@ -5,9 +5,24 @@ Azure Cloud Module
The Azure cloud module is used to control access to Microsoft Azure
Use of this module only requires the ``apikey`` parameter. Set up the cloud
configuration at ``/etc/salt/cloud.providers`` or
``/etc/salt/cloud.providers.d/azure.conf``:
:depends:
* `Microsoft Azure SDK for Python <https://pypi.python.org/pypi/azure/0.9.0>`_
:configuration:
Required provider parameters:
* ``apikey``
* ``certificate_path``
* ``subscription_id``
A Management Certificate (.pem and .crt files) must be created and the .pem
file placed on the same machine that salt-cloud is run from. Information on
creating the pem file to use, and uploading the associated cer file can be
found at:
http://www.windowsazure.com/en-us/develop/python/how-to-guides/service-management/
Example ``/etc/salt/cloud.providers`` or
``/etc/salt/cloud.providers.d/azure.conf`` configuration:
.. code-block:: yaml
@ -16,11 +31,6 @@ configuration at ``/etc/salt/cloud.providers`` or
subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
certificate_path: /etc/salt/azure.pem
management_host: management.core.windows.net
Information on creating the pem file to use, and uploading the associated cer
file can be found at:
http://www.windowsazure.com/en-us/develop/python/how-to-guides/service-management/
'''
# pylint: disable=E0102

View File

@ -11,6 +11,7 @@ import re
# Import salt libs
import salt.utils
import salt.utils.decorators as decorators
from salt.exceptions import CommandExecutionError
from salt.ext.six.moves import zip
@ -196,9 +197,11 @@ def percent(args=None):
return ret
@decorators.which('blkid')
def blkid(device=None):
'''
Return block device attributes: UUID, LABEL, etc.
Return block device attributes: UUID, LABEL, etc. This function only works
on systems where blkid is available.
CLI Example:

View File

@ -558,6 +558,12 @@ def _parse_settings_eth(opts, iface_type, enabled, iface):
result['dns'] = opts['dns']
result['peerdns'] = 'yes'
if 'mtu' in opts:
try:
result['mtu'] = int(opts['mtu'])
except Exception:
_raise_error_iface(iface, 'mtu', ['integer'])
if iface_type not in ['bridge']:
ethtool = _parse_ethtool_opts(opts, iface)
if ethtool:

View File

@ -347,7 +347,8 @@ def hypermedia_handler(*args, **kwargs):
try:
cherrypy.response.processors = dict(ct_out_map)
ret = cherrypy.serving.request._hypermedia_inner_handler(*args, **kwargs)
except salt.exceptions.EauthAuthenticationError:
except (salt.exceptions.EauthAuthenticationError,
salt.exceptions.TokenAuthenticationError):
raise cherrypy.HTTPError(401)
except cherrypy.CherryPyException:
raise

View File

@ -21,6 +21,7 @@ DEVICE="{{name}}"
{%endif%}{% if defroute %}DEFROUTE="{{defroute}}"
{%endif%}{% if bridge %}BRIDGE="{{bridge}}"
{%endif%}{% if delay %}DELAY="{{delay}}"
{%endif%}{% if mtu %}MTU="{{mtu}}"
{%endif%}{% if my_inner_ipaddr %}MY_INNER_IPADDR={{my_inner_ipaddr}}
{%endif%}{% if my_outer_ipaddr %}MY_OUTER_IPADDR={{my_outer_ipaddr}}
{%endif%}{%if bonding %}BONDING_OPTS="{%for item in bonding %}{{item}}={{bonding[item]}} {%endfor%}"

View File

@ -272,26 +272,21 @@ def render_jinja_tmpl(tmplstr, context, tmplpath=None):
jinja_env.globals['odict'] = OrderedDict
jinja_env.globals['show_full_context'] = show_full_context
unicode_context = {}
decoded_context = {}
for key, value in six.iteritems(context):
if not isinstance(value, string_types):
unicode_context[key] = value
decoded_context[key] = value
continue
# Let's try UTF-8 and fail if this still fails, that's why this is not
# wrapped in a try/except
if isinstance(value, six.text_type):
unicode_context[key] = value
else:
unicode_context[key] = six.text_type(value, 'utf-8')
decoded_context[key] = salt.utils.sdecode(value)
try:
template = jinja_env.from_string(tmplstr)
template.globals.update(unicode_context)
output = template.render(**unicode_context)
template.globals.update(decoded_context)
output = template.render(**decoded_context)
except jinja2.exceptions.TemplateSyntaxError as exc:
trace = traceback.extract_tb(sys.exc_info()[2])
line, out = _get_jinja_error(trace, context=unicode_context)
line, out = _get_jinja_error(trace, context=decoded_context)
if not line:
tmplstr = ''
raise SaltRenderError('Jinja syntax error: {0}{1}'.format(exc, out),
@ -299,7 +294,7 @@ def render_jinja_tmpl(tmplstr, context, tmplpath=None):
tmplstr)
except jinja2.exceptions.UndefinedError as exc:
trace = traceback.extract_tb(sys.exc_info()[2])
out = _get_jinja_error(trace, context=unicode_context)[1]
out = _get_jinja_error(trace, context=decoded_context)[1]
tmplstr = ''
# Don't include the line number, since it is misreported
# https://github.com/mitsuhiko/jinja2/issues/276
@ -309,7 +304,7 @@ def render_jinja_tmpl(tmplstr, context, tmplpath=None):
buf=tmplstr)
except (SaltInvocationError, CommandExecutionError) as exc:
trace = traceback.extract_tb(sys.exc_info()[2])
line, out = _get_jinja_error(trace, context=unicode_context)
line, out = _get_jinja_error(trace, context=decoded_context)
if not line:
tmplstr = ''
raise SaltRenderError(
@ -320,7 +315,7 @@ def render_jinja_tmpl(tmplstr, context, tmplpath=None):
except Exception as exc:
tracestr = traceback.format_exc()
trace = traceback.extract_tb(sys.exc_info()[2])
line, out = _get_jinja_error(trace, context=unicode_context)
line, out = _get_jinja_error(trace, context=decoded_context)
if not line:
tmplstr = ''
else: