Class: Chef::Resource::ServerCollection

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

Overview

Servers with associated tags

Instance Method Summary collapse

Constructor Details

#initialize(name, run_context = nil) ⇒ ServerCollection

Initialize resource

Parameters

name(String)

Collection name

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/server_collection_resource.rb', line 36

def initialize(name, run_context=nil)
  super(name, run_context)
  @resource_name = :server_collection
  @action = :load
  @allowed_actions.push(:load)
  @timeout = 120
end

Instance Method Details

#agent_ids(arg = nil) ⇒ Object

List of agent ids whose tags should be retrieved

Parameters

arg(String|Array)

List of agent ids (or single agent id) to set

nil

Return list instead of setting

Return

(Array)

List of agent ids



52
53
54
55
56
57
58
59
# File 'lib/chef/providers/server_collection_resource.rb', line 52

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

#tags(arg = nil) ⇒ Object

List of tags used to query agents and associated tags

Parameters

arg(String|Array)

List of tags (or single tag) to set

nil

Return list instead of setting

Return

(Array)

List of tags



69
70
71
72
73
74
75
76
# File 'lib/chef/providers/server_collection_resource.rb', line 69

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

#timeout(arg = nil) ⇒ Object

(Fixnum) Common timeout parameter for command line tools



79
80
81
82
83
84
85
# File 'lib/chef/providers/server_collection_resource.rb', line 79

def timeout(arg=nil)
  set_or_return(
    :timeout,
    arg,
    :kind_of => [ Fixnum ]
  )
end