From 70b3290a3be8fecb5b17f7a2e771598f6725f535 Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Tue, 2 Jun 2015 14:07:30 -0700 Subject: [PATCH] Move validate command into doc fragment and fix a few typos --- lib/ansible/modules/files/copy.py | 11 ++--------- lib/ansible/modules/files/lineinfile.py | 11 +---------- lib/ansible/modules/files/replace.py | 7 +------ lib/ansible/modules/files/template.py | 10 +--------- 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/lib/ansible/modules/files/copy.py b/lib/ansible/modules/files/copy.py index b7f333cead6..ad56800764b 100644 --- a/lib/ansible/modules/files/copy.py +++ b/lib/ansible/modules/files/copy.py @@ -63,21 +63,13 @@ options: force: description: - the default is C(yes), which will replace the remote file when contents - are different than the source. If C(no), the file will only be transferred + are different than the source. If C(no), the file will only be transferred if the destination does not exist. version_added: "1.1" required: false choices: [ "yes", "no" ] default: "yes" aliases: [ "thirsty" ] - validate: - description: - - The validation command to run before copying into place. The path to the file to - validate is passed in via '%s' which must be present as in the visudo example below. - The command is passed securely so shell features like expansion and pipes won't work. - required: false - default: "" - version_added: "1.2" directory_mode: description: - When doing a recursive copy set the mode for the directories. If this is not set we will use the system @@ -86,6 +78,7 @@ options: required: false version_added: "1.5" extends_documentation_fragment: files +extends_documentation_fragment: validate author: - "Ansible Core Team" - "Michael DeHaan" diff --git a/lib/ansible/modules/files/lineinfile.py b/lib/ansible/modules/files/lineinfile.py index 6bcfb3b3060..777f0a498a9 100644 --- a/lib/ansible/modules/files/lineinfile.py +++ b/lib/ansible/modules/files/lineinfile.py @@ -31,6 +31,7 @@ author: - "Daniel Hokka Zakrissoni (@dhozac)" - "Ahti Kitsik (@ahtik)" extends_documentation_fragment: files +extends_documentation_fragment: validate short_description: Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression. description: @@ -116,16 +117,6 @@ options: description: - Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. - validate: - required: false - description: - - validation to run before copying into place. - Use %s in the command to indicate the current file to validate. - The command is passed securely so shell features like - expansion and pipes won't work. - required: false - default: None - version_added: "1.4" others: description: - All arguments accepted by the M(file) module also work here. diff --git a/lib/ansible/modules/files/replace.py b/lib/ansible/modules/files/replace.py index fa0142823ea..dea2c32a54f 100644 --- a/lib/ansible/modules/files/replace.py +++ b/lib/ansible/modules/files/replace.py @@ -27,6 +27,7 @@ DOCUMENTATION = """ module: replace author: "Evan Kaufman (@EvanK)" extends_documentation_fragment: files +extends_documentation_fragment: validate short_description: Replace all instances of a particular string in a file using a back-referenced regular expression. description: @@ -61,12 +62,6 @@ options: description: - Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. - validate: - required: false - description: - - validation to run before copying into place - required: false - default: None others: description: - All arguments accepted by the M(file) module also work here. diff --git a/lib/ansible/modules/files/template.py b/lib/ansible/modules/files/template.py index a1dc72c27bd..120917f49c2 100644 --- a/lib/ansible/modules/files/template.py +++ b/lib/ansible/modules/files/template.py @@ -38,15 +38,6 @@ options: required: false choices: [ "yes", "no" ] default: "no" - validate: - description: - - The validation command to run before copying into place. - - The path to the file to validate is passed in via '%s' which must be present as in the visudo example below. - - validation to run before copying into place. The command is passed - securely so shell features like expansion and pipes won't work. - required: false - default: "" - version_added: "1.2" force: description: - the default is C(yes), which will replace the remote file when contents @@ -62,6 +53,7 @@ author: - Ansible Core Team - Michael DeHaan extends_documentation_fragment: files +extends_documentation_fragment: validate ''' EXAMPLES = '''