From 0f67df24c3387a4dc0ab152611d68f821c714161 Mon Sep 17 00:00:00 2001 From: Eric Putnam Date: Wed, 25 Oct 2017 15:50:07 -0700 Subject: [PATCH 1/3] (MODULES-5806) release prep for version 4.21.0 [skip-ci] --- CHANGELOG.md | 16 ++++++++++++++++ metadata.json | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57b9ebbbb..c92ccf397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## Supported Release 4.21.0 +### Summary + +This is a small feature release that includes a revamped, albeit backwards-compatible file_line type. + +#### Added +- `replace_all_matches_not_matching_line` parameter in file_line +- additional tests and documentation for file_line + +#### Removed +- duplicate spec test for absolute_path + +#### Fixed +- Unixpath type to allow "/" as valid path +- file_line behavior that caused infinite appending of `line` to a file ([MODULES-5651](https://tickets.puppet.com/browse/MODULES-5651)) + ## Supported Release 4.20.0 ### Summary diff --git a/metadata.json b/metadata.json index f1f9562c0..22a2944a2 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-stdlib", - "version": "4.20.0", + "version": "4.21.0", "author": "puppetlabs", "summary": "Standard library of resources for Puppet modules.", "license": "Apache-2.0", From 87339608f4815f38c47fe7d174572bfa5be10b73 Mon Sep 17 00:00:00 2001 From: jbondpdx Date: Wed, 25 Oct 2017 17:00:46 -0700 Subject: [PATCH 2/3] README fixups for 4.21.0 release --- README.md | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index b6d6c0dd2..d3eeeecf3 100644 --- a/README.md +++ b/README.md @@ -127,14 +127,17 @@ file_line { 'bashrc_proxy': } ``` -In this code example, `match` looks for a line beginning with export followed by HTTP_PROXY and replaces it with the value in line. If a match is not found, then no changes are made to the file. +In this code example, `match` looks for a line beginning with export followed by 'HTTP_PROXY' and replaces it with the value in line. If a match is not found, then no changes are made to the file. -Examples With `ensure => absent`: +Examples of `ensure => absent`: This type has two behaviors when `ensure => absent` is set. -One possibility is to set `match => ...` and `match_for_absence => true`, -as in the following example: +The first is to set `match => ...` and `match_for_absence => true`. Match looks for a line beginning with 'export', followed by 'HTTP_PROXY', and then deletes it. If multiple lines match, an error is raised unless the `multiple => true` parameter is set. + +The `line => ...` parameter in this example would be accepted but ignored. + +For example: ```puppet file_line { 'bashrc_proxy': @@ -145,15 +148,9 @@ file_line { 'bashrc_proxy': } ``` -In this code example match will look for a line beginning with export -followed by HTTP_PROXY and delete it. If multiple lines match, an -error will be raised unless the `multiple => true` parameter is set. +The second way of using `ensure => absent` is to specify a `line => ...` and no match. When ensuring lines are absent, the default behavior is to remove all lines matching. This behavior can't be disabled. -Note that the `line => ...` parameter would be accepted *but ignored* in -the above example. - -The second way of using `ensure => absent` is to specify a `line => ...`, -and no match: +For example: ```puppet file_line { 'bashrc_proxy': @@ -163,9 +160,6 @@ file_line { 'bashrc_proxy': } ``` -Note that when ensuring lines are absent this way, the default behavior -this time is to always remove all lines matching, and this behavior -can't be disabled. Encoding example: @@ -236,7 +230,7 @@ Default value: `false`. ##### `multiple` -Specifies whether `match` and `after` can change multiple lines. If set to `false`, allows file\_line to replace only one line and raises an error if more than one will be replaced. If set to `true`, allows file\_line to replace one or more lines. +Specifies whether `match` and `after` can change multiple lines. If set to `false`, allows file_line to replace only one line and raises an error if more than one will be replaced. If set to `true`, allows file_line to replace one or more lines. Values: `true`, `false`. @@ -271,7 +265,7 @@ Default value: `true`. ##### `replace_all_matches_not_matching_line` -Replace all lines matched by `match` parameter, even if `line` already exists in the file. +Replaces all lines matched by `match` parameter, even if `line` already exists in the file. Default value: `false`. From 5d6cca1d528cd450ec9ac1afcd28c53ea79e3ff4 Mon Sep 17 00:00:00 2001 From: transifex-bot Date: Wed, 1 Nov 2017 14:04:07 +1100 Subject: [PATCH 3/3] Updating translations for readmes/README_ja_JP.md --- readmes/README_ja_JP.md | 58 ++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/readmes/README_ja_JP.md b/readmes/README_ja_JP.md index 013b74ce4..e5b1cf083 100644 --- a/readmes/README_ja_JP.md +++ b/readmes/README_ja_JP.md @@ -117,29 +117,49 @@ file_line { 'bashrc_proxy': マッチ例: - file_line { 'bashrc_proxy': - ensure => present, - path => '/etc/bashrc', - line => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128', - match => '^export\ HTTP_PROXY\=', - append_on_no_match => false, - } +```puppet +file_line { 'bashrc_proxy': + ensure => present, + path => '/etc/bashrc', + line => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128', + match => '^export\ HTTP_PROXY\=', + append_on_no_match => false, +} +``` + +このコードの例では、`match`によってexportで始まり'HTTP_PROXY'が続く行が検索され、その行が行内の値に置き換えられます。マッチするものが見つからない場合、ファイルは変更されません。 + + `ensure => absent`の例: -このコードの例では、`match`によってexportで始まりHTTP_PROXYが続く行が検索され、その行が行内の値に置き換えられます。マッチするものが見つからない場合、ファイルは変更されません。 +`ensure => absent`を設定する場合に、このタイプの動作には2通りがあります。 - `ensure => absent`を用いたマッチ例: +1つは`match => ...`と`match_for_absence => true`の設定です。`match`により、'export'で始まり'HTTP_PROXY'と続く行が探され、その行が削除されます。複数の行がマッチし、`multiple => true`パラメータが設定されていない場合は、エラーが生じます。 + +この例で`line => ...`パラメータは承認されますが無視されます。 + +例: ```puppet file_line { 'bashrc_proxy': ensure => absent, path => '/etc/bashrc', - line => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128', match => '^export\ HTTP_PROXY\=', match_for_absence => true, } ``` -上の例では、`match`により、'export'で始まり'HTTP_PROXY'と続く行が探され、その行が削除されます。複数の行がマッチし、`multiple => true`パラメータが設定されていない場合は、エラーが生じます。 +`ensure => absent`を設定する場合のもう1つの動作は、`line => ...`の指定と一致なしです。行が存在しないことを確認した場合のデフォルトの動作では、マッチするすべての行を削除します。この動作を無効にすることはできません。 + +例: + +```puppet +file_line { 'bashrc_proxy': + ensure => absent, + path => '/etc/bashrc', + line => 'export HTTP_PROXY=http://squid.puppetlabs.vm:3128', +} +``` + エンコード例: @@ -193,7 +213,7 @@ file_line { "XScreenSaver": ##### `match` -ファイル内の既存の行と比較する正規表現を指定します。マッチが見つかった場合、新規の行を追加するかわりに、置き換えられます。正規表現の比較は行の値に照らして行われ、マッチしない場合は、例外が発生します。 +ファイル内の既存の行と比較する正規表現を指定します。マッチが見つかった場合、新規の行を追加する代わりに、置き換えられます。 値: 正規表現を含む文字列 @@ -210,7 +230,7 @@ file_line { "XScreenSaver": ##### `multiple` -`match`および`after`により複数の行を変更できるかどうかを指定します。`false`に設定すると、複数の行がマッチする場合に例外が発生します。 +`match`および`after`により複数の行を変更できるかどうかを指定します。`false`に設定すると、file_lineは1つの行のみ置き換えることができますが、複数の行を置き換えようとするとエラーが発生します。`true`に設定すると、file_lineは1つまたは複数の行を置き換えることができます。 値: `true`、`false` @@ -235,12 +255,20 @@ file_line { "XScreenSaver": ##### `replace` -`match`パラメータとマッチする既存の行を上書きするかどうかを指定します。`false`に設定すると、`match`パラメータにマッチする行が見つかった場合、その行はファイルに配置されません。 +`match`パラメータとマッチする既存の行をリソースで上書きするかどうかを指定します。`false`に設定すると、`match`パラメータにマッチする行が見つかった場合、その行はファイルに配置されません。 + +`false`に設定すると、`match`パラメータにマッチする行が見つかった場合、その行はファイルに配置されません。 ブーリアン デフォルト値: `true` +##### `replace_all_matches_not_matching_line` + +`line`がファイルにすでに存在する場合でも、`match`パラメータに一致するすべての行が置き換えられます。 + +デフォルト値: `false` + ### データタイプ #### `Stdlib::Absolutepath` @@ -2214,7 +2242,7 @@ validate_ip_address('260.2.32.43') 例: ```puppet -validate_legacy("Optional[String]", "validate_re", "Value to be validated", ["."]) +validate_legacy('Optional[String]', 'validate_re', 'Value to be validated', ["."]) ``` この関数は、Puppet 3形式の引数確認(stdlibの`validate_*`関数を使用)からPuppet 4データタイプへのモジュールのアップデートに対応しており、Puppet 3形式の確認に頼っている場合も機能性が中断することはありません。