Class: Pauper::Config
- Inherits:
-
Object
- Object
- Pauper::Config
- Defined in:
- lib/pauper.rb
Defined Under Namespace
Classes: Node
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #bootstrap_ssh_key(key_path) ⇒ Object
- #chef_deb_name(name) ⇒ Object
- #chef_download_url(url) ⇒ Object
- #chef_environment(env) ⇒ Object
- #chef_options(opts) ⇒ Object
- #chef_server_url(url) ⇒ Object
- #cpus(count) ⇒ Object
- #default_run_list(list) ⇒ Object
- #dev_domain(dev_domain) ⇒ Object
- #get_node(node_name) ⇒ Object
-
#initialize(pauperfile) ⇒ Config
constructor
A new instance of Config.
- #node(name, &block) ⇒ Object
- #node_suffix(suffix) ⇒ Object
- #ram(megabytes) ⇒ Object
- #share(share_name, guest_path, host_path, options = {}) ⇒ Object
- #ssh_password(pass) ⇒ Object
- #ssh_user(user) ⇒ Object
- #subnet(net) ⇒ Object
- #validation_client_name(name) ⇒ Object
- #validation_key_path(path) ⇒ Object
- #vmx(vmx_file) ⇒ Object
Constructor Details
#initialize(pauperfile) ⇒ Config
Returns a new instance of Config.
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 |
# File 'lib/pauper.rb', line 1191 def initialize(pauperfile) @config = { :nodes => [], :ssh_user => 'dev', :ssh_password => 'password', :run_list => [], :shares => [], :subnet => '172.16.254', :chef_options => {}, :dev_domain => nil } if File.exists? pauperfile pauperpath = File.dirname(pauperfile) instance_eval File.read(pauperfile) else abort "!! Could not find Pauperfile at #{pauperfile} !!" end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
1189 1190 1191 |
# File 'lib/pauper.rb', line 1189 def config @config end |
Instance Method Details
#bootstrap_ssh_key(key_path) ⇒ Object
1246 1247 1248 |
# File 'lib/pauper.rb', line 1246 def bootstrap_ssh_key(key_path) @config[:bootstrap_ssh_key] = key_path end |
#chef_deb_name(name) ⇒ Object
1258 1259 1260 |
# File 'lib/pauper.rb', line 1258 def chef_deb_name(name) @config[:chef_deb_name] = name end |
#chef_download_url(url) ⇒ Object
1254 1255 1256 |
# File 'lib/pauper.rb', line 1254 def chef_download_url(url) @config[:chef_download_url] = url end |
#chef_environment(env) ⇒ Object
1270 1271 1272 |
# File 'lib/pauper.rb', line 1270 def chef_environment(env) @config[:chef_environment] = env end |
#chef_options(opts) ⇒ Object
1274 1275 1276 |
# File 'lib/pauper.rb', line 1274 def (opts) @config[:chef_options] = opts end |
#chef_server_url(url) ⇒ Object
1250 1251 1252 |
# File 'lib/pauper.rb', line 1250 def chef_server_url(url) @config[:chef_server_url] = url end |
#cpus(count) ⇒ Object
1242 1243 1244 |
# File 'lib/pauper.rb', line 1242 def cpus(count) @config[:default_cpus] = count end |
#default_run_list(list) ⇒ Object
1278 1279 1280 |
# File 'lib/pauper.rb', line 1278 def default_run_list(list) @config[:default_run_list] = list end |
#dev_domain(dev_domain) ⇒ Object
1222 1223 1224 |
# File 'lib/pauper.rb', line 1222 def dev_domain(dev_domain) @config[:dev_domain] = dev_domain end |
#get_node(node_name) ⇒ Object
1210 1211 1212 |
# File 'lib/pauper.rb', line 1210 def get_node(node_name) @config[:nodes].detect { |n| n.name == node_name } end |
#node(name, &block) ⇒ Object
1234 1235 1236 |
# File 'lib/pauper.rb', line 1234 def node(name, &block) @config[:nodes] << Node.new(name, name, &block) end |
#node_suffix(suffix) ⇒ Object
1286 1287 1288 |
# File 'lib/pauper.rb', line 1286 def node_suffix(suffix) @config[:node_suffix] = suffix end |
#ram(megabytes) ⇒ Object
1238 1239 1240 |
# File 'lib/pauper.rb', line 1238 def ram(megabytes) @config[:default_ram] = megabytes end |
#share(share_name, guest_path, host_path, options = {}) ⇒ Object
1282 1283 1284 |
# File 'lib/pauper.rb', line 1282 def share(share_name, guest_path, host_path, ={}) @config[:shares] << [share_name, guest_path, host_path, ] end |
#ssh_password(pass) ⇒ Object
1218 1219 1220 |
# File 'lib/pauper.rb', line 1218 def ssh_password(pass) @config[:ssh_password] = pass end |
#ssh_user(user) ⇒ Object
1214 1215 1216 |
# File 'lib/pauper.rb', line 1214 def ssh_user(user) @config[:ssh_user] = user end |
#subnet(net) ⇒ Object
1226 1227 1228 |
# File 'lib/pauper.rb', line 1226 def subnet(net) @config[:subnet] = net end |
#validation_client_name(name) ⇒ Object
1266 1267 1268 |
# File 'lib/pauper.rb', line 1266 def validation_client_name(name) @config[:validation_client_name] = name end |
#validation_key_path(path) ⇒ Object
1262 1263 1264 |
# File 'lib/pauper.rb', line 1262 def validation_key_path(path) @config[:validation_key_path] = File.(path) end |
#vmx(vmx_file) ⇒ Object
1230 1231 1232 |
# File 'lib/pauper.rb', line 1230 def vmx(vmx_file) @config[:vmx] = File.(vmx_file) end |