summaryrefslogtreecommitdiff
path: root/lib/ansible/playbook
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2018-05-03 18:29:47 -0400
committerGitHub <noreply@github.com>2018-05-03 18:29:47 -0400
commitdf1001577f68a319a2594de0bb993ec4e91c2068 (patch)
tree2c3b69eecc82a3a3dd489cba0cd45d5659bd3a78 /lib/ansible/playbook
parentc8d287fecefd0fa791960e3b168279c370eea246 (diff)
downloadansible-df1001577f68a319a2594de0bb993ec4e91c2068.tar.gz
rebase base playbook base (#39533)
* rebase base playbook base fixes issues with loop control allowing generic attributes it shouldn't
Diffstat (limited to 'lib/ansible/playbook')
-rw-r--r--lib/ansible/playbook/base.py69
-rw-r--r--lib/ansible/playbook/loop_control.py5
2 files changed, 38 insertions, 36 deletions
diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py
index 74abae4b0b..16669d83b4 100644
--- a/lib/ansible/playbook/base.py
+++ b/lib/ansible/playbook/base.py
@@ -140,39 +140,7 @@ class BaseMeta(type):
return super(BaseMeta, cls).__new__(cls, name, parents, dct)
-class Base(with_metaclass(BaseMeta, object)):
-
- _name = FieldAttribute(isa='string', default='', always_post_validate=True, inherit=False)
-
- # connection/transport
- _connection = FieldAttribute(isa='string')
- _port = FieldAttribute(isa='int')
- _remote_user = FieldAttribute(isa='string')
-
- # variables
- _vars = FieldAttribute(isa='dict', priority=100, inherit=False)
-
- # module default params
- _module_defaults = FieldAttribute(isa='list', extend=True, prepend=True)
-
- # flags and misc. settings
- _environment = FieldAttribute(isa='list', extend=True, prepend=True)
- _no_log = FieldAttribute(isa='bool')
- _always_run = FieldAttribute(isa='bool')
- _run_once = FieldAttribute(isa='bool')
- _ignore_errors = FieldAttribute(isa='bool')
- _check_mode = FieldAttribute(isa='bool')
- _diff = FieldAttribute(isa='bool')
- _any_errors_fatal = FieldAttribute(isa='bool')
-
- # explicitly invoke a debugger on tasks
- _debugger = FieldAttribute(isa='string')
-
- # param names which have been deprecated/removed
- DEPRECATED_ATTRIBUTES = [
- 'sudo', 'sudo_user', 'sudo_pass', 'sudo_exe', 'sudo_flags',
- 'su', 'su_user', 'su_pass', 'su_exe', 'su_flags',
- ]
+class FieldAttributeBase(with_metaclass(BaseMeta, object)):
def __init__(self):
@@ -590,3 +558,38 @@ class Base(with_metaclass(BaseMeta, object)):
setattr(self, '_uuid', data.get('uuid'))
self._finalized = data.get('finalized', False)
self._squashed = data.get('squashed', False)
+
+
+class Base(FieldAttributeBase):
+
+ _name = FieldAttribute(isa='string', default='', always_post_validate=True, inherit=False)
+
+ # connection/transport
+ _connection = FieldAttribute(isa='string')
+ _port = FieldAttribute(isa='int')
+ _remote_user = FieldAttribute(isa='string')
+
+ # variables
+ _vars = FieldAttribute(isa='dict', priority=100, inherit=False)
+
+ # module default params
+ _module_defaults = FieldAttribute(isa='list', extend=True, prepend=True)
+
+ # flags and misc. settings
+ _environment = FieldAttribute(isa='list', extend=True, prepend=True)
+ _no_log = FieldAttribute(isa='bool')
+ _always_run = FieldAttribute(isa='bool')
+ _run_once = FieldAttribute(isa='bool')
+ _ignore_errors = FieldAttribute(isa='bool')
+ _check_mode = FieldAttribute(isa='bool')
+ _diff = FieldAttribute(isa='bool')
+ _any_errors_fatal = FieldAttribute(isa='bool')
+
+ # explicitly invoke a debugger on tasks
+ _debugger = FieldAttribute(isa='string')
+
+ # param names which have been deprecated/removed
+ DEPRECATED_ATTRIBUTES = [
+ 'sudo', 'sudo_user', 'sudo_pass', 'sudo_exe', 'sudo_flags',
+ 'su', 'su_user', 'su_pass', 'su_exe', 'su_flags',
+ ]
diff --git a/lib/ansible/playbook/loop_control.py b/lib/ansible/playbook/loop_control.py
index 59594b31f9..366d9cdaa4 100644
--- a/lib/ansible/playbook/loop_control.py
+++ b/lib/ansible/playbook/loop_control.py
@@ -20,11 +20,10 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.playbook.attribute import FieldAttribute
-from ansible.playbook.base import Base
+from ansible.playbook.base import FieldAttributeBase
-# FIXME: loopcontrol should not inherit attributes from base, just uses it for load
-class LoopControl(Base):
+class LoopControl(FieldAttributeBase):
_loop_var = FieldAttribute(isa='str', default='item')
_index_var = FieldAttribute(isa='str')