Add Puppet helpers functions

Registered by Dmitry Ilyin

== Fetch ==

This function can be used to extract a value from a deeply nested structure by it's path.
$data = {
  'a' => {
    'b' => [
      'b1',
      'b2',
      'b3',
    ]
  }
}

$value = fetch($data, 'a/b/2', 'not_found', '/')
=> $value = 'b3'

== Store ==
This function can set a value inside a structure
$data = {
  'a' => {
    'b' => [
      'b1',
      'b2',
      'b3',
    ]
  }
}

store($data, 'a/b/2', 'new_value', '/')

=> $data = {
  'a' => {
    'b' => [
      'b1',
      'b2',
      'new_value',
    ]
  }
}

== Setvar ==
Puppet is known to have immutable "variables" inside it's manifests. This function allows a developer to update the value as he expects to be able in other programming languages.

$message = 'msg1'

notify { 'before' :
  message => $message,
}

setvar('message', 'msg2')

notify { 'after' :
  message => $message,
}

=> Notice: /Stage[main]/Main/Notify[before]/message: defined 'message' as 'msg1'
=> Notice: /Stage[main]/Main/Notify[after]/message: defined 'message' as 'msg2'

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Dmitry Ilyin
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.