Module: CORL::Facade
- Defined in:
- lib/core/facade.rb
Constant Summary collapse
- @@facts =
Facter lookup
{}
- @@vagrant_config_loaded =
false
Instance Method Summary collapse
-
#builder(options, provider = nil) ⇒ Object
—.
- #builders(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(options, provider = nil) ⇒ Object
106 107 108 |
# File 'lib/core/facade.rb', line 106 def builder(, provider = nil) plugin(:CORL, :builder, provider, ) end |
#builders(data, build_hash = false, keep_array = false) ⇒ Object
110 111 112 |
# File 'lib/core/facade.rb', line 110 def builders(data, build_hash = false, keep_array = false) plugins(:CORL, :builder, data, build_hash, keep_array) end |
#configuration(options, provider = nil) ⇒ Object
Core plugin type facade
75 76 77 |
# File 'lib/core/facade.rb', line 75 def configuration(, provider = nil) plugin(:CORL, :configuration, provider, ) end |
#configurations(data, build_hash = false, keep_array = false) ⇒ Object
79 80 81 |
# File 'lib/core/facade.rb', line 79 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
86 87 88 |
# File 'lib/core/facade.rb', line 86 def network(name, = {}, provider = nil) plugin(:CORL, :network, provider, Config.ensure().import({ :name => name })) end |
#networks(data, build_hash = false, keep_array = false) ⇒ Object
90 91 92 |
# File 'lib/core/facade.rb', line 90 def networks(data, build_hash = false, keep_array = false) plugins(:CORL, :network, data, build_hash, keep_array) end |
#node(name, options = {}, provider = nil) ⇒ Object
96 97 98 |
# File 'lib/core/facade.rb', line 96 def node(name, = {}, provider = nil) plugin(:CORL, :node, provider, Config.ensure().import({ :name => name })) end |
#nodes(data, build_hash = false, keep_array = false) ⇒ Object
100 101 102 |
# File 'lib/core/facade.rb', line 100 def nodes(data, build_hash = false, keep_array = false) plugins(:CORL, :node, data, build_hash, keep_array) end |
#provisioner(options, provider = nil) ⇒ Object
116 117 118 |
# File 'lib/core/facade.rb', line 116 def provisioner(, provider = nil) plugin(:CORL, :provisioner, provider, ) end |
#provisioners(data, build_hash = false, keep_array = false) ⇒ Object
120 121 122 |
# File 'lib/core/facade.rb', line 120 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 49 50 |
# File 'lib/core/facade.rb', line 42 def public_ip if Config.fact(:vagrant_exists) ip_address = Config.fact(:ipaddress_eth1) ip_address = Config.fact(:ipaddress_eth0) unless ip_address ip_address else CORL.ip_address end end |
#vagrant? ⇒ Boolean
Vagrant related
55 56 57 |
# File 'lib/core/facade.rb', line 55 def vagrant? Vagrant.command ? true : false end |
#vagrant_config(directory, config, &code) ⇒ Object
67 68 69 70 |
# File 'lib/core/facade.rb', line 67 def vagrant_config(directory, config, &code) Vagrant::Config.register(directory, config, &code) @@vagrant_config_loaded = true end |
#vagrant_config_loaded? ⇒ Boolean
63 64 65 |
# File 'lib/core/facade.rb', line 63 def vagrant_config_loaded? @@vagrant_config_loaded end |