Do not use mutable defaults in FieldAttribute, instead allow supplying a callable for defaults of mutable types. Fixes #46824 (#46833)

This commit is contained in:
Matt Martz
2018-10-12 10:43:09 -05:00
committed by GitHub
parent 0dd17b521f
commit a06a5ded61
14 changed files with 57 additions and 37 deletions

View File

@@ -0,0 +1,25 @@
---
- hosts: testhost
gather_facts: false
tasks:
- name: Static imports should expose vars at parse time, not at execution time
assert:
that:
- static_defaults_var == 'static_defaults'
- static_vars_var == 'static_vars'
- import_role:
name: static
- assert:
that:
- static_tasks_var == 'static_tasks'
- static_defaults_var == 'static_defaults'
- static_vars_var == 'static_vars'
- hosts: testhost
gather_facts: false
tasks:
- name: Ensure vars from import_roles do not bleed between plays
assert:
that:
- static_defaults_var is undefined
- static_vars_var is undefined

View File

@@ -81,3 +81,4 @@ ANSIBLE_STRATEGY='free' ansible-playbook tasks/test_include_dupe_loop.yml -i ../
test "$(grep -c '"item=foo"' test_include_dupe_loop.out)" = 3
ansible-playbook public_exposure/playbook.yml -i ../../inventory "$@"
ansible-playbook public_exposure/no_bleeding.yml -i ../../inventory "$@"