Skip to content

Commit c47d704

Browse files
committed
(CONT-1023) - Addressing review comments
1 parent 4120eb2 commit c47d704

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

functions/deferrable_epp.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# have to explicitly pass the entire scope to the client.
77
#
88
function stdlib::deferrable_epp(String $template, Hash $variables) >> Variant[String, Sensitive[String], Deferred] {
9-
if $variables.nested_values.any |$value| { $value.is_a(Deferred) } {
9+
if $variables.stdlib::nested_values.any |$value| { $value.is_a(Deferred) } {
1010
Deferred(
1111
'inline_epp',
1212
[find_template($template).file, $variables],

lib/puppet/functions/nested_values.rb renamed to lib/puppet/functions/stdlib/nested_values.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
# frozen_string_literal: true
22

33
# This function will return list of Hash values, the return value will be Array
4-
# NOTE : This function is expecting only Hash and return value will be Array
54
#
65
# @example :
76
# $hash = {
87
# "key1" => "value1",
98
# "key2" => { "key2.1" => "value2.1"}
109
# }
11-
# $hash.nested_values
10+
# $hash.stdlib::nested_values
1211
#
1312
# Output : ["value1", "value2.1"]
1413
#
15-
Puppet::Functions.create_function(:nested_values) do
14+
Puppet::Functions.create_function(:'stdlib::nested_values') do
1615
dispatch :nested_values do
1716
param 'Hash', :options
1817
return_type 'Array'

spec/functions/nested_values_spec.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
require 'spec_helper'
44

5-
describe 'nested_values' do
6-
# please note that these tests are examples only
7-
# you will need to replace the params and return value
8-
# with your expectations
5+
describe 'stdlib::nested_values' do
96
it { is_expected.to run.with_params({}).and_return([]) }
107
it { is_expected.to run.with_params({ 'key' => 'value' }).and_return(['value']) }
118
it { is_expected.to run.with_params({ 'key' => { 'key1' => 'value1', 'key2' => 'value2' } }).and_return(['value1', 'value2']) }

0 commit comments

Comments
 (0)