Class: Chef::Resource::RightScript

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

Overview

RightScript chef resource. Allows defining recipes which wrap RightScripts.

Example

right_script “APP Mephisto bootstrap configure v2” do

source_file '/tmp/my_right_script'
parameters['APPLICATION'] 'My Mephisto App'
parameters['DB_SCHEMA_NAME'] 'db_schema'
parameters['RAILS_ENV'] 'production'
cache_dir '/var/cache/rightscale/app_mephisto'

end

Constant Summary collapse

DEFAULT_CACHE_DIR_ROOT =

Default directory used to cache RightScript source

::File.join(RightScale::Platform.filesystem.cache_dir, 'rightscale')

Instance Method Summary collapse

Constructor Details

#initialize(name, run_context = nil) ⇒ RightScript

Initialize RightScript resource with default values

Parameters

name(String)

Nickname of RightScript

collection(Array)

Collection of included recipes

node(Chef::Node)

Node where resource will be used



56
57
58
59
60
61
62
63
64
# File 'lib/chef/providers/right_script_resource.rb', line 56

def initialize(name, run_context=nil)
  super(name, run_context)
  @resource_name = :right_script
  @cache_dir = ::File.join(DEFAULT_CACHE_DIR_ROOT, RightScale::AgentIdentity.generate)
  @parameters = {}
  @display_version = nil
  @action = :run
  @allowed_actions.push(:run)
end

Instance Method Details

#cache_dir(arg = nil) ⇒ Object

(String) Path to directory where attachments source should be saved



103
104
105
106
107
108
109
# File 'lib/chef/providers/right_script_resource.rb', line 103

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

#display_version(arg = nil) ⇒ Object

(String) Displayable version for RightScript (revision, etc.) or nil



94
95
96
97
98
99
100
# File 'lib/chef/providers/right_script_resource.rb', line 94

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

#nickname(arg = nil) ⇒ Object

(String) RightScript nickname



67
68
69
70
71
72
73
# File 'lib/chef/providers/right_script_resource.rb', line 67

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

#parameters(arg = nil) ⇒ Object

(Hash) RightScript parameters values keyed by names



85
86
87
88
89
90
91
# File 'lib/chef/providers/right_script_resource.rb', line 85

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

#source_file(arg = nil) ⇒ Object

(String) Path to file containing RightScript source code



76
77
78
79
80
81
82
# File 'lib/chef/providers/right_script_resource.rb', line 76

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