Class: Convection::Model::Cloudfile

Inherits:
Object
  • Object
show all
Includes:
DSL::Cloudfile
Defined in:
lib/convection/model/cloudfile.rb

Overview

Define your Clouds

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DSL::Cloudfile

#attribute, #stack, #stack_group, #template

Methods included from DSL::Helpers

#camel_case, included, method_name, #screaming_snake_case, #snake_case

Methods included from DSL::IntrinsicFunctions

#base64, #find_in_map, #fn_and, #fn_equals, #fn_if, #fn_import_value, #fn_not, #fn_or, #fn_ref, #fn_sub, #get_att, #get_azs, included, #join, mixers, #select

Constructor Details

#initialize(cloudfile) ⇒ Cloudfile

Returns a new instance of Cloudfile.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/convection/model/cloudfile.rb', line 63

def initialize(cloudfile)
  @attributes = Model::Attributes.new
  @stacks = {}
  @deck = []
  @stack_groups = {}
  @thread_count ||= 2

  instance_eval(IO.read(cloudfile), cloudfile, 1)

  work_q = Queue.new
  @deck.each { |stack| work_q.push(stack) }
  workers = (0...@thread_count).map do
    Thread.new do
      until work_q.empty?
        stack = work_q.pop(true)
        stack.template_status
        stack.load_template_info if stack.exist?
      end
    end
  end
  workers.each(&:join)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



58
59
60
# File 'lib/convection/model/cloudfile.rb', line 58

def attributes
  @attributes
end

#deckObject (readonly)

Returns the value of attribute deck.



60
61
62
# File 'lib/convection/model/cloudfile.rb', line 60

def deck
  @deck
end

#stack_groupsObject (readonly)

Returns the value of attribute stack_groups.



61
62
63
# File 'lib/convection/model/cloudfile.rb', line 61

def stack_groups
  @stack_groups
end

#stacksObject (readonly)

Returns the value of attribute stacks.



59
60
61
# File 'lib/convection/model/cloudfile.rb', line 59

def stacks
  @stacks
end