Class: Packer::Output::Build

Inherits:
MachineReadable show all
Defined in:
lib/packer/output/build.rb

Overview

Represents the output from packer build.

Instance Method Summary collapse

Methods inherited from MachineReadable

#ui_messages

Methods inherited from Base

#initialize, #stderr, #stdout

Constructor Details

This class inherits a constructor from Packer::Output::Base

Instance Method Details

#artifactsArray<Packer::Message::Artifact]

Information about an artifact of the targeted item.

Returns:



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/packer/output/build.rb', line 10

def artifacts
  afcts = []

  afct ||= Packer::Message::Artifact.new
  select_messages('artifact').each do |fields|
    afct.timestamp ||= fields[0]
    afct.target ||= fields[1]
    afct.type ||= 'artifact'
    afct.artifact_index ||= fields[3]

    case fields[4]
    when 'builder-id'
      afct.builder_id = fields[5]
    when 'end'
      afcts << afct
      afct = Packer::Message::Artifact.new
    when 'file'
      afct.files ||= []
      afct.files << Packer::Message::ArtifactFile.from_fields(fields)
    when 'files-count'
      next
    when 'id'
      afct.id = fields[5]
    when 'nil'
      afct.nil = true
    when 'string'
      afct.string = fields[5]
    end
  end

  afcts
end

#errorsArray<Packer::Message::Error]

Build errors that occurred

Returns:



46
47
48
# File 'lib/packer/output/build.rb', line 46

def errors
  select_messages('error').map { |fields| Packer::Message::Error.from_fields(fields) }
end