Module: CORL::Facade

Defined in:
lib/core/facade.rb

Constant Summary collapse

@@facts =

Facter lookup

{}
@@vagrant_config_loaded =

false

Instance Method Summary collapse

Instance Method Details

#builder(data, build_hash = false, keep_array = false) ⇒ Object




104
105
106
# File 'lib/core/facade.rb', line 104

def builder(options, provider = nil)
  plugin(:CORL, :builder, provider, options)
end

#configuration(options, provider = nil) ⇒ Object


Core plugin type facade



73
74
75
# File 'lib/core/facade.rb', line 73

def configuration(options, provider = nil)
  plugin(:CORL, :configuration, provider, options)
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, options = {}, provider = nil)
  plugin(:CORL, :network, provider, Config.ensure(options).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, options = {}, provider = nil)
  plugin(:CORL, :node, provider, Config.ensure(options).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(options, provider = nil)
  plugin(:CORL, :provisioner, provider, options)
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_ipObject


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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


61
62
63
# File 'lib/core/facade.rb', line 61

def vagrant_config_loaded?
  @@vagrant_config_loaded
end