Class: Chef::Resource::RemoteRecipe

Inherits:
Chef::Resource show all
Defined in:
lib/chef/providers/remote_recipe_resource.rb

Overview

Recipe that should be run on a remote RightLink agent

Instance Method Summary collapse

Constructor Details

#initialize(name, run_context = nil) ⇒ RemoteRecipe

Initialize log resource with a name as the string to log

Parameters

name(String)

Message to log

collection(Array)

Collection of included recipes

node(Chef::Node)

Node where resource will be used



36
37
38
39
40
41
42
# File 'lib/chef/providers/remote_recipe_resource.rb', line 36

def initialize(name, run_context=nil)
  super(name, run_context)
  @resource_name = :remote_recipe
  @scope = :all
  @action = :run
  @allowed_actions.push(:run)
end

Instance Method Details

#attributes(arg = nil) ⇒ Object

Override attributes that should be used to run the remote recipe



54
55
56
57
58
59
60
# File 'lib/chef/providers/remote_recipe_resource.rb', line 54

def attributes(arg=nil)
  set_or_return(
    :attributes,
    arg,
    :kind_of => [ Hash ]
  )
end

#recipe(arg = nil) ⇒ Object

Name of recipe that should be run remotely



45
46
47
48
49
50
51
# File 'lib/chef/providers/remote_recipe_resource.rb', line 45

def recipe(arg=nil)
  set_or_return(
    :recipe,
    arg,
    :kind_of => [ String ]
  )
end

#recipients(arg = nil) ⇒ Object

List of ids of agents that should run the recipe These ids should have been retrieved using the :from attribute of a remote recipe previously run on this agent



65
66
67
68
69
70
71
72
# File 'lib/chef/providers/remote_recipe_resource.rb', line 65

def recipients(arg=nil)
  converted_arg = arg.is_a?(String) ? [ arg ] : arg
  set_or_return(
    :recipients,
    converted_arg,
    :kind_of => [ Array ]
  )
end

#recipients_tags(arg = nil) ⇒ Object

List of tags used to route the request Only instances that expose all of the tags in this list will run the recipe



77
78
79
80
81
82
83
84
# File 'lib/chef/providers/remote_recipe_resource.rb', line 77

def recipients_tags(arg=nil)
  converted_arg = arg.is_a?(String) ? [ arg ] : arg
  set_or_return(
    :recipient_tags,
    converted_arg,
    :kind_of => [ Array ]
  )
end

#scope(arg = nil) ⇒ Object

Scope of remote recipe: whether a single or all potential recipients should run the recipe. Only applies when used in conjunction with recipients_tags Defaults to :all



90
91
92
93
94
95
96
# File 'lib/chef/providers/remote_recipe_resource.rb', line 90

def scope(arg=nil)
  set_or_return(
    :scope,
    arg,
    :equal_to => [ :single, :all ]
  )
end