Merge branch '2018.3' into fix_38310_pygit2_checkout_ext_pillar_remote_using_tag

This commit is contained in:
Lino E Carrillo 2018-07-20 16:05:34 -04:00 committed by GitHub
commit eb4361dcc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 10 deletions

View file

@ -1148,6 +1148,40 @@ Returns:
}'
}
.. jinja_ref:: traverse
``traverse``
------------
.. versionadded:: 2018.3.3
Traverse a dict or list using a colon-delimited target string.
The target 'foo:bar:0' will return data['foo']['bar'][0] if this value exists,
and will otherwise return the provided default value.
Example:
.. code-block:: jinja
{{ {'a1': {'b1': {'c1': 'foo'}}, 'a2': 'bar'} | traverse('a1:b1', 'default') }}
Returns:
.. code-block:: python
{'c1': 'foo'}
.. code-block:: jinja
{{ {'a1': {'b1': {'c1': 'foo'}}, 'a2': 'bar'} | traverse('a2:b2', 'default') }}
Returns:
.. code-block:: python
'default'
.. _`builtin filters`: http://jinja.pocoo.org/docs/templates/#builtin-filters
.. _`timelib`: https://github.com/pediapress/timelib/

View file

@ -1989,6 +1989,7 @@ def running(name,
if __opts__['test']:
ret['result'] = None
comments.append('Container would be started')
return _format_comments(ret, comments)
else:
try:
post_state = __salt__['docker.start'](name)['state']['new']

View file

@ -434,10 +434,8 @@ def vm_created(name, vm_name, cpu, memory, image, version, interfaces,
'comment': ''}
if __opts__['test']:
result.update({'result': None,
'changes': None,
'comment': 'Virtual machine '
'{0} will be created'.format(vm_name)})
result['comment'] = 'Virtual machine {0} will be created'.format(
vm_name)
return result
service_instance = __salt__['vsphere.get_service_instance_via_proxy']()

View file

@ -83,7 +83,7 @@ def present(name,
if isinstance(profile, string_types):
profile = __salt__['config.option'](profile)
ret = {'name': name, 'result': None, 'comment': None, 'changes': None}
ret = {'name': name, 'result': None, 'comment': None, 'changes': {}}
datasource = _get_datasource(profile, name)
data = _get_json_data(name, type, url, access, user, password, database,
basic_auth, basic_auth_user, basic_auth_password, is_default, json_data)
@ -126,7 +126,7 @@ def absent(name, profile='grafana'):
if isinstance(profile, string_types):
profile = __salt__['config.option'](profile)
ret = {'result': None, 'comment': None, 'changes': None}
ret = {'result': None, 'comment': None, 'changes': {}}
datasource = _get_datasource(profile, name)
if not datasource:

View file

@ -55,7 +55,7 @@ def policy_present(name, rules):
except Exception as e:
return {
'name': name,
'changes': None,
'changes': {},
'result': False,
'comment': 'Failed to get policy: {0}'.format(e)
}
@ -76,7 +76,7 @@ def _create_new_policy(name, rules):
if response.status_code != 204:
return {
'name': name,
'changes': None,
'changes': {},
'result': False,
'comment': 'Failed to create policy: {0}'.format(response.reason)
}
@ -93,7 +93,7 @@ def _handle_existing_policy(name, new_rules, existing_rules):
ret = {'name': name}
if new_rules == existing_rules:
ret['result'] = True
ret['changes'] = None
ret['changes'] = {}
ret['comment'] = 'Policy exists, and has the correct content'
return ret
@ -111,7 +111,7 @@ def _handle_existing_policy(name, new_rules, existing_rules):
if response.status_code != 204:
return {
'name': name,
'changes': None,
'changes': {},
'result': False,
'comment': 'Failed to change policy: {0}'.format(response.reason)
}

View file

@ -460,6 +460,7 @@ def traverse_dict(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM):
return data
@jinja_filter('traverse')
def traverse_dict_and_list(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM):
'''
Traverse a dict or list using a colon-delimited (or otherwise delimited,