Puppet Function: choria::tasks::metadata

Defined in:
lib/puppet/functions/choria/tasks/metadata.rb
Function type:
Ruby 4.x API

Overview

choria::tasks::metadata(String $task, Optional[String] $tasks_environment)Any

Downloads metadata for a Puppet Task

This helper downloads the specification of a task from the Puppet Server, for this to work you should have followed the configuration guide at [choria.io](choria.io) to ensure the required Puppet Server configuration were complete

Parameters:

  • task (String)
  • tasks_environment (Optional[String])

Returns:

  • (Any)


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
# File 'lib/puppet/functions/choria/tasks/metadata.rb', line 6

Puppet::Functions.create_function(:"choria::tasks::metadata") do
  dispatch :fetch do
    param "String", :task
    optional_param "String", :tasks_environment
  end

  def init
    require_relative "../../../_load_choria"
  end

  def choria
    @_choria ||= begin
       init
       MCollective::Util::Choria.new
    end
  end

  def tasks_support
    @__tasks ||= choria.tasks_support
  end

  def fetch(task, tasks_environment = "production")
    tasks_support.(task, tasks_environment)
  end
end