Class: VagrantPlugins::Compose::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/compose/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



11
12
13
14
# File 'lib/vagrant/compose/config.rb', line 11

def initialize
		@nodes = {}
		@ansible_groups = {}
end

Instance Attribute Details

#ansible_groupsObject (readonly)

Returns the value of attribute ansible_groups.



9
10
11
# File 'lib/vagrant/compose/config.rb', line 9

def ansible_groups
  @ansible_groups
end

#nodesObject (readonly)

Returns the value of attribute nodes.



9
10
11
# File 'lib/vagrant/compose/config.rb', line 9

def nodes
  @nodes
end

Instance Method Details

#compose(name, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vagrant/compose/config.rb', line 16

def compose (name, &block)
 # implementa la creazione di un cluster, l'esecuzione di un blocco di codice
# per la configurazione del cluster stesso, e l'esecuzione della sequenza di compose.
		@cluster = Cluster.new(name)
		begin
    	block.call(@cluster)
		rescue Exception => e
   raise VagrantPlugins::Compose::Errors::ClusterInitializeError, :message => e.message, :cluster_name => name
 end
		@nodes, @ansible_groups = @cluster.compose
end

#debugObject



28
29
30
31
32
33
34
# File 'lib/vagrant/compose/config.rb', line 28

def debug
	puts "==> cluster #{@cluster.name} with #{nodes.size} nodes" 
	@nodes.each do |node|
 puts "        #{node.boxname} accessible as #{node.fqdn} #{node.aliases} #{node.ip} => [#{node.box}, #{node.cpus} cpus, #{node.memory} memory]"       
	end
	puts "    ansible_groups filtered by #{@cluster.multimachine_filter}" if not @cluster.multimachine_filter.empty?
end