Class: Covalence::PackerStackTasks
- Inherits:
-
Object
- Object
- Covalence::PackerStackTasks
- Defined in:
- lib/covalence/core/services/packer_stack_tasks.rb
Instance Method Summary collapse
- #context_build(*additional_args) ⇒ Object
- #context_inspect(*additional_args) ⇒ Object
- #context_validate(*additional_args) ⇒ Object
- #environment_name ⇒ Object
-
#initialize(stack) ⇒ PackerStackTasks
constructor
A new instance of PackerStackTasks.
-
#packer_stack_export ⇒ Object
:reek:TooManyStatements.
- #stack_name ⇒ Object
Constructor Details
#initialize(stack) ⇒ PackerStackTasks
8 9 10 11 12 |
# File 'lib/covalence/core/services/packer_stack_tasks.rb', line 8 def initialize(stack) @path = File.(File.join(Covalence::PACKER, stack.module_path)) @stack = stack @template = "#{@path}/#{stack.packer_template}" end |
Instance Method Details
#context_build(*additional_args) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/covalence/core/services/packer_stack_tasks.rb', line 22 def context_build(*additional_args) Dir.mktmpdir do |tmpdir| populate_workspace(tmpdir) Dir.chdir(tmpdir) do logger.info "In #{tmpdir}:" stack.materialize_cmd_inputs(tmpdir) args = collect_args(stack.args, additional_args, "-var-file=covalence-inputs.json") call_packer_cmd("packer_build", args) end end end |
#context_inspect(*additional_args) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/covalence/core/services/packer_stack_tasks.rb', line 38 def context_inspect(*additional_args) Dir.mktmpdir do |tmpdir| populate_workspace(tmpdir) Dir.chdir(tmpdir) do logger.info "In #{tmpdir}:" call_packer_cmd("packer_inspect", []) end end end |
#context_validate(*additional_args) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/covalence/core/services/packer_stack_tasks.rb', line 49 def context_validate(*additional_args) Dir.mktmpdir do |tmpdir| populate_workspace(tmpdir) Dir.chdir(tmpdir) do logger.info "In #{tmpdir}:" stack.materialize_cmd_inputs(tmpdir) args = collect_args(stack.args, additional_args, "-var-file=covalence-inputs.json") call_packer_cmd("packer_validate", args) end end end |
#environment_name ⇒ Object
18 19 20 |
# File 'lib/covalence/core/services/packer_stack_tasks.rb', line 18 def environment_name stack.environment_name end |
#packer_stack_export ⇒ Object
:reek:TooManyStatements
66 67 68 69 70 71 72 |
# File 'lib/covalence/core/services/packer_stack_tasks.rb', line 66 def packer_stack_export() packer_stack_export_init(File.(File.join(Covalence::STACK_EXPORT,'packer',stack.full_name))).each do |stackdir| populate_workspace(stackdir) stack.materialize_cmd_inputs(stackdir) logger.info "Exported to #{stackdir}:" end end |
#stack_name ⇒ Object
14 15 16 |
# File 'lib/covalence/core/services/packer_stack_tasks.rb', line 14 def stack_name stack.name end |