From 31045d58c659858c6ee9524411716a3d2a5f515b Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 27 Apr 2017 12:48:31 -0400 Subject: [PATCH] added versions to dep notices (#24019) * added versions to dep notices * pep7 * string --- lib/ansible/cli/galaxy.py | 2 +- lib/ansible/executor/task_executor.py | 5 +++-- lib/ansible/playbook/helpers.py | 5 +++-- lib/ansible/playbook/play.py | 2 +- lib/ansible/playbook/role/definition.py | 2 +- lib/ansible/playbook/role/requirement.py | 3 ++- lib/ansible/playbook/task.py | 2 +- lib/ansible/template/__init__.py | 2 +- 8 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py index 6baf7affbab..3b0192d2a4d 100644 --- a/lib/ansible/cli/galaxy.py +++ b/lib/ansible/cli/galaxy.py @@ -356,7 +356,7 @@ class GalaxyCLI(CLI): msg = "Unable to load data from the include requirements file: %s %s" raise AnsibleError(msg % (role_file, e)) else: - display.deprecated("going forward only the yaml format will be supported") + display.deprecated("going forward only the yaml format will be supported", version="2.6") # roles listed in a file, one per line for rline in f.readlines(): if rline.startswith("#") or rline.strip() == '': diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index ab9938a6155..b19b8b6c6a9 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -467,7 +467,8 @@ class TaskExecutor: if '_variable_params' in self._task.args: variable_params = self._task.args.pop('_variable_params') if isinstance(variable_params, dict): - display.deprecated("Using variables for task params is unsafe, especially if the variables come from an external source like facts") + display.deprecated("Using variables for task params is unsafe, especially if the variables come from an external source like facts", + version="2.6") variable_params.update(self._task.args) self._task.args = variable_params @@ -751,7 +752,7 @@ class TaskExecutor: if self._play_context.accelerate: # accelerate is deprecated as of 2.1... - display.deprecated('Accelerated mode is deprecated. Consider using SSH with ControlPersist and pipelining enabled instead') + display.deprecated('Accelerated mode is deprecated. Consider using SSH with ControlPersist and pipelining enabled instead', version='2.6') # launch the accelerated daemon here ssh_connection = connection handler = self._shared_loader_obj.action_loader.get( diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py index c3e587ca37c..297602ccbca 100644 --- a/lib/ansible/playbook/helpers.py +++ b/lib/ansible/playbook/helpers.py @@ -214,7 +214,7 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h "later. In the future, this will be an error unless 'static: no' is used " \ "on the include task. If you do not want missing includes to be considered " \ "dynamic, use 'static: yes' on the include or set the global ansible.cfg " \ - "options to make all inclues static for tasks and/or handlers" % include_file, + "options to make all inclues static for tasks and/or handlers" % include_file, version="2.7" ) task_list.append(t) continue @@ -247,7 +247,8 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h obj=task_ds, suppress_extended_error=True, ) - display.deprecated("You should not specify tags in the include parameters. All tags should be specified using the task-level option") + display.deprecated("You should not specify tags in the include parameters. All tags should be specified using the task-level option", + version="2.7") else: tags = ti_copy.tags[:] diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index ce943f09a88..afb90a6d640 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -204,7 +204,7 @@ class Play(Base, Taggable, Become): vars_prompts = [] for prompt_data in new_ds: if 'name' not in prompt_data: - display.deprecated("Using the 'short form' for vars_prompt has been deprecated") + display.deprecated("Using the 'short form' for vars_prompt has been deprecated", version="2.7") for vname, prompt in prompt_data.items(): vars_prompts.append(dict( name = vname, diff --git a/lib/ansible/playbook/role/definition.py b/lib/ansible/playbook/role/definition.py index 306e78f47c0..45b86a03645 100644 --- a/lib/ansible/playbook/role/definition.py +++ b/lib/ansible/playbook/role/definition.py @@ -207,7 +207,7 @@ class RoleDefinition(Base, Become, Conditional, Taggable): if key in ('connection', 'port', 'remote_user'): display.deprecated("Using '%s' as a role param has been deprecated. " % key + \ "In the future, these values should be entered in the `vars:` " + \ - "section for roles, but for now we'll store it as both a param and an attribute.") + "section for roles, but for now we'll store it as both a param and an attribute.", version="2.7") role_def[key] = value # this key does not match a field attribute, so it must be a role param role_params[key] = value diff --git a/lib/ansible/playbook/role/requirement.py b/lib/ansible/playbook/role/requirement.py index 55b2087793e..4df7e05da78 100644 --- a/lib/ansible/playbook/role/requirement.py +++ b/lib/ansible/playbook/role/requirement.py @@ -83,7 +83,8 @@ class RoleRequirement(RoleDefinition): # 'version': 'v1.0', # 'name': 'repo' # } - display.deprecated("The comma separated role spec format, use the yaml/explicit format instead. Line that trigger this: %s" % role_spec) + display.deprecated("The comma separated role spec format, use the yaml/explicit format instead. Line that trigger this: %s" % role_spec, + version="2.7") default_role_versions = dict(git='master', hg='tip') diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 74b8f79a7ca..abe62e381b4 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -218,7 +218,7 @@ class Task(Base, Conditional, Taggable, Become): if action == 'include' and k not in self._valid_attrs and k not in self.DEPRECATED_ATTRIBUTES: display.deprecated("Specifying include variables at the top-level of the task is deprecated." " Please see:\nhttp://docs.ansible.com/ansible/playbooks_roles.html#task-include-files-and-encouraging-reuse\n\n" - " for currently supported syntax regarding included files and variables") + " for currently supported syntax regarding included files and variables", version="2.7") new_ds['vars'][k] = v else: new_ds[k] = v diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py index 0c6ff1c9fe5..607d9ab0fc7 100644 --- a/lib/ansible/template/__init__.py +++ b/lib/ansible/template/__init__.py @@ -553,7 +553,7 @@ class Templar: if bare_deprecated: display.deprecated("Using bare variables is deprecated." " Update your playbooks so that the environment value uses the full variable syntax ('%s%s%s')" % - (self.environment.variable_start_string, variable, self.environment.variable_end_string)) + (self.environment.variable_start_string, variable, self.environment.variable_end_string), version='2.7') return "%s%s%s" % (self.environment.variable_start_string, variable, self.environment.variable_end_string) # the variable didn't meet the conditions to be converted,