diff --git a/CHANGELOG.md b/CHANGELOG.md index 8abc10961..ccc7743c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,25 @@ 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). -## [v7.1.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v7.1.0) (2021-05-15) +## [v8.0.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v8.0.0) (2021-08-24) + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v7.1.0...v8.0.0) + +### Changed + +- Flip installed and present in Function ensure\_packages [\#1196](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1196) ([cocker-cc](https://github.com/cocker-cc)) + +### Added + +- New function to\_python\(\) / to\_ruby\(\) [\#1200](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1200) ([smortex](https://github.com/smortex)) +- pdksync - \(IAC-1709\) - Add Support for Debian 11 [\#1199](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1199) ([david22swan](https://github.com/david22swan)) +- Stdlib::Http::Method: Add new type for http methods [\#1192](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1192) ([b4ldr](https://github.com/b4ldr)) + +### Fixed + +- \(MODULES-11099\) Make merge parameter data types actually backwards compatible [\#1191](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1191) ([SimonPe](https://github.com/SimonPe)) + +## [v7.1.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v7.1.0) (2021-05-17) [Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v7.0.1...v7.1.0) diff --git a/REFERENCE.md b/REFERENCE.md index 04b2b2e02..f51e130f1 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -180,6 +180,8 @@ in a hash. * [`to_bytes`](#to_bytes): Converts the argument into bytes, for example 4 kB becomes 4096. * [`to_json`](#to_json): } * [`to_json_pretty`](#to_json_pretty): Convert data structure and output to pretty JSON +* [`to_python`](#to_python): Convert an object into a String containing its Python representation +* [`to_ruby`](#to_ruby): Convert an object into a String containing its Ruby representation * [`to_yaml`](#to_yaml): } * [`try_get_value`](#try_get_value) * [`type`](#type): **DEPRECATED:** This function will cease to function on Puppet 4; @@ -3294,15 +3296,15 @@ $merged_hash = merge($hash1, $hash2) # $merged_hash = {'one' => 1, 'two' => 'do ['a', 'b', 'c', 'c', 'd', 'b', 'blah', 'blah'].merge | $hsh, $v | { if $v =~ String[1,1] { { $v => $hsh[$v].lest || { 0 } + 1 } } } # results in { a => 1, b => 2, c => 2, d => 1 } ``` -#### `merge(Variant[Hash, Undef, String[0,0]] *$args)` +#### `merge(Variant[Hash[Scalar,Any], Undef, String[0,0]] *$args)` The merge function. -Returns: `Hash` The merged hash +Returns: `Hash[Scalar,Any]` The merged hash ##### `*args` -Data type: `Variant[Hash, Undef, String[0,0]]` +Data type: `Variant[Hash[Scalar,Any], Undef, String[0,0]]` Repeated Param - The hashes that are to be merged @@ -4692,6 +4694,106 @@ hash-map of settings passed to JSON.pretty_generate, see https://ruby-doc.org/stdlib-2.0.0/libdoc/json/rdoc/JSON.html#method-i-generate. Note that `max_nesting` doesn't take the value `false`; use `-1` instead. +### `to_python` + +Type: Ruby 4.x API + +Convert an object into a String containing its Python representation + +#### Examples + +##### how to output Python + +```puppet +# output Python to a file +$listen = '0.0.0.0' +$port = 8000 +file { '/opt/acme/etc/settings.py': + content => inline_epp(@("SETTINGS")), + LISTEN = <%= $listen.to_python %> + PORT = <%= $mailserver.to_python %> + | SETTINGS +} +``` + +#### `to_python(Any $object)` + +The to_python function. + +Returns: `Any` + +##### Examples + +###### how to output Python + +```puppet +# output Python to a file +$listen = '0.0.0.0' +$port = 8000 +file { '/opt/acme/etc/settings.py': + content => inline_epp(@("SETTINGS")), + LISTEN = <%= $listen.to_python %> + PORT = <%= $mailserver.to_python %> + | SETTINGS +} +``` + +##### `object` + +Data type: `Any` + + + +### `to_ruby` + +Type: Ruby 4.x API + +Convert an object into a String containing its Ruby representation + +#### Examples + +##### how to output Ruby + +```puppet +# output Ruby to a file +$listen = '0.0.0.0' +$port = 8000 +file { '/opt/acme/etc/settings.rb': + content => inline_epp(@("SETTINGS")), + LISTEN = <%= $listen.to_ruby %> + PORT = <%= $mailserver.to_ruby %> + | SETTINGS +} +``` + +#### `to_ruby(Any $object)` + +The to_ruby function. + +Returns: `Any` + +##### Examples + +###### how to output Ruby + +```puppet +# output Ruby to a file +$listen = '0.0.0.0' +$port = 8000 +file { '/opt/acme/etc/settings.rb': + content => inline_epp(@("SETTINGS")), + LISTEN = <%= $listen.to_ruby %> + PORT = <%= $mailserver.to_ruby %> + | SETTINGS +} +``` + +##### `object` + +Data type: `Any` + + + ### `to_yaml` Type: Ruby 4.x API diff --git a/metadata.json b/metadata.json index 685a8a8c7..0aaabb091 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-stdlib", - "version": "7.1.0", + "version": "8.0.0", "author": "puppetlabs", "summary": "Standard library of resources for Puppet modules.", "license": "Apache-2.0",