mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Resolving differences in core modules post-merge
This commit is contained in:
committed by
Matt Clay
parent
95d59b61eb
commit
8afa090417
@@ -23,13 +23,11 @@ ANSIBLE_METADATA = {'status': ['preview'],
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: win_lineinfile
|
||||
author: Brian Lloyd (brian.d.lloyd@gmail.com)
|
||||
short_description: Ensure a particular line is in a file, or replace an
|
||||
existing line using a back-referenced regular expression.
|
||||
author: "Brian Lloyd <brian.d.lloyd@gmail.com>"
|
||||
short_description: Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression.
|
||||
description:
|
||||
- This module will search a file for a line, and ensure that it is present or absent.
|
||||
- This is primarily useful when you want to change a single line in
|
||||
a file only.
|
||||
- This is primarily useful when you want to change a single line in a file only.
|
||||
version_added: "2.0"
|
||||
options:
|
||||
dest:
|
||||
@@ -51,21 +49,14 @@ options:
|
||||
line:
|
||||
required: false
|
||||
description:
|
||||
- Required for C(state=present). The line to insert/replace into the
|
||||
file. If C(backrefs) is set, may contain backreferences that will get
|
||||
expanded with the C(regexp) capture groups if the regexp matches.
|
||||
- Required for C(state=present). The line to insert/replace into the file. If C(backrefs) is set, may contain backreferences that will get expanded with the C(regexp) capture groups if the regexp matches.
|
||||
backrefs:
|
||||
required: false
|
||||
default: "no"
|
||||
choices: [ "yes", "no" ]
|
||||
description:
|
||||
- Used with C(state=present). If set, line can contain backreferences
|
||||
(both positional and named) that will get populated if the C(regexp)
|
||||
matches. This flag changes the operation of the module slightly;
|
||||
C(insertbefore) and C(insertafter) will be ignored, and if the C(regexp)
|
||||
doesn't match anywhere in the file, the file will be left unchanged.
|
||||
If the C(regexp) does match, the last matching line will be replaced by
|
||||
the expanded line parameter.
|
||||
- Used with C(state=present). If set, line can contain backreferences (both positional and named) that will get populated if the C(regexp) matches. This flag changes the operation of the module slightly; C(insertbefore) and C(insertafter) will be ignored, and if the C(regexp) doesn't match anywhere in the file, the file will be left unchanged.
|
||||
- If the C(regexp) does match, the last matching line will be replaced by the expanded line parameter.
|
||||
insertafter:
|
||||
required: false
|
||||
default: EOF
|
||||
@@ -75,7 +66,6 @@ options:
|
||||
choices: [ 'EOF', '*regex*' ]
|
||||
insertbefore:
|
||||
required: false
|
||||
version_added: "1.1"
|
||||
description:
|
||||
- Used with C(state=present). If specified, the line will be inserted before the last match of specified regular expression. A value is available; C(BOF) for inserting the line at the beginning of the file.
|
||||
- If specified regular expression has no matches, the line will be inserted at the end of the file. May not be used with C(backrefs).
|
||||
@@ -85,16 +75,13 @@ options:
|
||||
choices: [ "yes", "no" ]
|
||||
default: "no"
|
||||
description:
|
||||
- Used with C(state=present). If specified, the file will be created
|
||||
if it does not already exist. By default it will fail if the file
|
||||
is missing.
|
||||
- Used with C(state=present). If specified, the file will be created if it does not already exist. By default it will fail if the file is missing.
|
||||
backup:
|
||||
required: false
|
||||
default: "no"
|
||||
choices: [ "yes", "no" ]
|
||||
description:
|
||||
- Create a backup file including the timestamp information so you can
|
||||
get the original file back if you somehow clobbered it incorrectly.
|
||||
- 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:
|
||||
@@ -105,23 +92,15 @@ options:
|
||||
required: false
|
||||
default: "auto"
|
||||
description:
|
||||
- Specifies the encoding of the source text file to operate on (and thus what the
|
||||
output encoding will be). The default of C(auto) will cause the module to auto-detect
|
||||
the encoding of the source file and ensure that the modified file is written with the
|
||||
same encoding.
|
||||
An explicit encoding can be passed as a string that is a valid value to pass to
|
||||
the .NET framework System.Text.Encoding.GetEncoding() method - see
|
||||
U(https://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.110%29.aspx).
|
||||
This is mostly useful with C(create=yes) if you want to create a new file with a specific
|
||||
encoding. If C(create=yes) is specified without a specific encoding, the default encoding
|
||||
(UTF-8, no BOM) will be used.
|
||||
- Specifies the encoding of the source text file to operate on (and thus what the output encoding will be). The default of C(auto) will cause the module to auto-detect the encoding of the source file and ensure that the modified file is written with the same encoding.
|
||||
- "An explicit encoding can be passed as a string that is a valid value to pass to the .NET framework System.Text.Encoding.GetEncoding() method - see U(https://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.110%29.aspx)."
|
||||
- This is mostly useful with C(create=yes) if you want to create a new file with a specific encoding. If C(create=yes) is specified without a specific encoding, the default encoding (UTF-8, no BOM) will be used.
|
||||
newline:
|
||||
required: false
|
||||
description:
|
||||
- "Specifies the line separator style to use for the modified file. This defaults to the windows line separator (C(\r\n)). Note that the indicated line separator will be used for file output regardless of the original line separator that appears in the input file."
|
||||
choices: [ "windows", "unix" ]
|
||||
default: "windows"
|
||||
|
||||
"""
|
||||
|
||||
EXAMPLES = r"""
|
||||
|
||||
@@ -27,13 +27,17 @@ $creates = Get-Attr $params "creates" $false
|
||||
$extra_args = Get-Attr $params "extra_args" ""
|
||||
$wait = Get-Attr $params "wait" $false | ConvertTo-Bool
|
||||
|
||||
If (-not $params.path.GetType)
|
||||
$result = New-Object psobject @{
|
||||
changed = $false
|
||||
};
|
||||
|
||||
If (($creates -ne $false) -and ($state -ne "absent") -and (Test-Path $creates))
|
||||
{
|
||||
Fail-Json $result "missing required arguments: path"
|
||||
Exit-Json $result;
|
||||
}
|
||||
|
||||
$logfile = [IO.Path]::GetTempFileName();
|
||||
If ($params.state.GetType -and $params.state -eq "absent")
|
||||
if ($state -eq "absent")
|
||||
{
|
||||
If ($wait)
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ options:
|
||||
- true
|
||||
- false
|
||||
default: false
|
||||
author: Matt Martz
|
||||
author: "Matt Martz (@sivel)"
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
||||
Reference in New Issue
Block a user