Puppet Function: simplib::mock_data
- Defined in:
- lib/puppet/functions/simplib/mock_data.rb
- Function type:
- Ruby 4.x API
Overview
A mock data function
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/puppet/functions/simplib/mock_data.rb', line 2 Puppet::Functions.create_function(:'simplib::mock_data') do # @param options # @param context # # @return [Any] dispatch :mock_data do param 'Hash', :options param 'Puppet::LookupContext', :context end # @param key # @param options # @param context # # @return [Any] dispatch :mock_data_lookup_key do param 'String', :key param 'Hash', :options param 'Puppet::LookupContext', :context end def mock_data(, context) case ["path"] when "/path/1" { "profiles::test1::variable" => "goodvar", "profiles::test2::variable" => "badvar", "profiles::test::test1::variable" => "goodvar", "apache::sync" => "badvar", "user::root_password" => "badvar", } when "/path/2" { "profiles::test1::variable" => "goodvar", "profiles::test2::variable" => "badvar", "profiles::test::test1::variable" => "goodvar", } else {} end end def mock_data_lookup_key(key, , context) data = mock_data(, context) if (data.key?(key)) data[key] else context.not_found end end end |