From 92c8275f94d0584d6e57727fabe44689d4c2e8b6 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 16 Apr 2015 08:36:59 -0400 Subject: [PATCH] made certain flags part of base to make them universally settable --- v2/ansible/playbook/base.py | 10 ++++++++++ v2/ansible/playbook/play.py | 6 ------ v2/ansible/playbook/task.py | 6 ------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/v2/ansible/playbook/base.py b/v2/ansible/playbook/base.py index c6a9d9a0513..73eceba996b 100644 --- a/v2/ansible/playbook/base.py +++ b/v2/ansible/playbook/base.py @@ -41,6 +41,16 @@ from ansible.template import template class Base: + # connection/transport + _connection = FieldAttribute(isa='string') + _port = FieldAttribute(isa='int') + _remote_user = FieldAttribute(isa='string') + + # vars and flags + _vars = FieldAttribute(isa='dict', default=dict()) + _environment = FieldAttribute(isa='dict', default=dict()) + _no_log = FieldAttribute(isa='bool', default=False) + def __init__(self): # initialize the data loader and variable manager, which will be provided diff --git a/v2/ansible/playbook/play.py b/v2/ansible/playbook/play.py index 01bc275e940..457f2381090 100644 --- a/v2/ansible/playbook/play.py +++ b/v2/ansible/playbook/play.py @@ -56,15 +56,11 @@ class Play(Base, Taggable, Become): _accelerate_port = FieldAttribute(isa='int', default=5099) # should be alias of port # Connection - _connection = FieldAttribute(isa='string', default='smart') _gather_facts = FieldAttribute(isa='string', default='smart') _hosts = FieldAttribute(isa='list', default=[], required=True) _name = FieldAttribute(isa='string', default='') - _port = FieldAttribute(isa='int', default=22) - _remote_user = FieldAttribute(isa='string') # Variable Attributes - _vars = FieldAttribute(isa='dict', default=dict()) _vars_files = FieldAttribute(isa='list', default=[]) _vars_prompt = FieldAttribute(isa='dict', default=dict()) _vault_password = FieldAttribute(isa='string') @@ -80,9 +76,7 @@ class Play(Base, Taggable, Become): # Flag/Setting Attributes _any_errors_fatal = FieldAttribute(isa='bool', default=False) - _environment = FieldAttribute(isa='dict', default=dict()) _max_fail_percentage = FieldAttribute(isa='string', default='0') - _no_log = FieldAttribute(isa='bool', default=False) _serial = FieldAttribute(isa='int', default=0) _strategy = FieldAttribute(isa='string', default='linear') diff --git a/v2/ansible/playbook/task.py b/v2/ansible/playbook/task.py index 7c9478837d7..2c92dd4674a 100644 --- a/v2/ansible/playbook/task.py +++ b/v2/ansible/playbook/task.py @@ -63,10 +63,8 @@ class Task(Base, Conditional, Taggable, Become): _any_errors_fatal = FieldAttribute(isa='bool') _async = FieldAttribute(isa='int', default=0) _changed_when = FieldAttribute(isa='string') - _connection = FieldAttribute(isa='string') _delay = FieldAttribute(isa='int', default=5) _delegate_to = FieldAttribute(isa='string') - _environment = FieldAttribute(isa='dict') _failed_when = FieldAttribute(isa='string') _first_available_file = FieldAttribute(isa='list') _ignore_errors = FieldAttribute(isa='bool') @@ -80,16 +78,12 @@ class Task(Base, Conditional, Taggable, Become): _name = FieldAttribute(isa='string', default='') - _no_log = FieldAttribute(isa='bool') _notify = FieldAttribute(isa='list') _poll = FieldAttribute(isa='int') _register = FieldAttribute(isa='string') - _remote_user = FieldAttribute(isa='string') _retries = FieldAttribute(isa='int', default=1) _run_once = FieldAttribute(isa='bool') - _transport = FieldAttribute(isa='string') _until = FieldAttribute(isa='list') # ? - _vars = FieldAttribute(isa='dict', default=dict()) def __init__(self, block=None, role=None, task_include=None): ''' constructors a task, without the Task.load classmethod, it will be pretty blank '''