Module: CORL::Facade
- Defined in:
- lib/core/facade.rb
Constant Summary collapse
- @@facts =
Facter lookup
{}
- @@vagrant_config_loaded =
false
Instance Method Summary collapse
-
#builder(data, build_hash = false, keep_array = false) ⇒ Object
—.
-
#configuration(options, provider = nil) ⇒ Object
—————————————————————————– Core plugin type facade.
- #configurations(data, build_hash = false, keep_array = false) ⇒ Object
-
#create_fact(name, value, weight = 1000) ⇒ Object
—.
-
#fact(name) ⇒ Object
—.
- #facts(reset = false) ⇒ Object
-
#network(name, options = {}, provider = nil) ⇒ Object
—————————————————————————– Cluster plugin type facade.
- #networks(data, build_hash = false, keep_array = false) ⇒ Object
-
#node(name, options = {}, provider = nil) ⇒ Object
—.
- #nodes(data, build_hash = false, keep_array = false) ⇒ Object
-
#provisioner(options, provider = nil) ⇒ Object
—.
- #provisioners(data, build_hash = false, keep_array = false) ⇒ Object
-
#public_ip ⇒ Object
—————————————————————————– Local identification.
-
#vagrant? ⇒ Boolean
—————————————————————————– Vagrant related.
- #vagrant_config(directory, config, &code) ⇒ Object
- #vagrant_config_loaded? ⇒ Boolean
Instance Method Details
#builder(data, build_hash = false, keep_array = false) ⇒ Object
104 105 106 |
# File 'lib/core/facade.rb', line 104 def builder(, provider = nil) plugin(:CORL, :builder, provider, ) end |
#configuration(options, provider = nil) ⇒ Object
Core plugin type facade
73 74 75 |
# File 'lib/core/facade.rb', line 73 def configuration(, provider = nil) plugin(:CORL, :configuration, provider, ) end |
#configurations(data, build_hash = false, keep_array = false) ⇒ Object
77 78 79 |
# File 'lib/core/facade.rb', line 77 def configurations(data, build_hash = false, keep_array = false) plugins(:CORL, :configuration, data, build_hash, keep_array) end |
#create_fact(name, value, weight = 1000) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/core/facade.rb', line 24 def create_fact(name, value, weight = 1000) Facter.collection.add(name.to_sym, { :value => value, :weight => weight }) end |
#fact(name) ⇒ Object
33 34 35 36 37 |
# File 'lib/core/facade.rb', line 33 def fact(name) silence do Facter.value(name) end end |
#facts(reset = false) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/core/facade.rb', line 10 def facts(reset = false) if reset || @@facts.empty? @@facts = {} if reset silence do Facter.list.each do |name| @@facts[name] = Facter.value(name) end end end @@facts end |
#network(name, options = {}, provider = nil) ⇒ Object
Cluster plugin type facade
84 85 86 |
# File 'lib/core/facade.rb', line 84 def network(name, = {}, provider = nil) plugin(:CORL, :network, provider, Config.ensure().import({ :name => name })) end |
#networks(data, build_hash = false, keep_array = false) ⇒ Object
88 89 90 |
# File 'lib/core/facade.rb', line 88 def networks(data, build_hash = false, keep_array = false) plugins(:CORL, :network, data, build_hash, keep_array) end |
#node(name, options = {}, provider = nil) ⇒ Object
94 95 96 |
# File 'lib/core/facade.rb', line 94 def node(name, = {}, provider = nil) plugin(:CORL, :node, provider, Config.ensure().import({ :name => name })) end |
#nodes(data, build_hash = false, keep_array = false) ⇒ Object
98 99 100 |
# File 'lib/core/facade.rb', line 98 def nodes(data, build_hash = false, keep_array = false) plugins(:CORL, :node, data, build_hash, keep_array) end |
#provisioner(options, provider = nil) ⇒ Object
114 115 116 |
# File 'lib/core/facade.rb', line 114 def provisioner(, provider = nil) plugin(:CORL, :provisioner, provider, ) end |
#provisioners(data, build_hash = false, keep_array = false) ⇒ Object
118 119 120 |
# File 'lib/core/facade.rb', line 118 def provisioners(data, build_hash = false, keep_array = false) plugins(:CORL, :provisioner, data, build_hash, keep_array) end |
#public_ip ⇒ Object
Local identification
42 43 44 45 46 47 48 |
# File 'lib/core/facade.rb', line 42 def public_ip if Config.fact(:vagrant_exists) Config.fact(:ipaddress_eth1) else CORL.ip_address end end |
#vagrant? ⇒ Boolean
Vagrant related
53 54 55 |
# File 'lib/core/facade.rb', line 53 def vagrant? Vagrant.command ? true : false end |
#vagrant_config(directory, config, &code) ⇒ Object
65 66 67 68 |
# File 'lib/core/facade.rb', line 65 def vagrant_config(directory, config, &code) Vagrant::Config.register(directory, config, &code) @@vagrant_config_loaded = true end |
#vagrant_config_loaded? ⇒ Boolean
61 62 63 |
# File 'lib/core/facade.rb', line 61 def vagrant_config_loaded? @@vagrant_config_loaded end |