Method: Idlc::Build::Metadata#initialize

Defined in:
lib/iapi-idlc-sdk-build/metadata.rb

#initialize(name, file = 'metadata') ⇒ Metadata

Returns a new instance of Metadata.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/iapi-idlc-sdk-build/metadata.rb', line 27

def initialize(name, file = 'metadata')
  @name = name
  @file = file
  @attributes = {}

  # Required
  @attributes['build_stage'] = MetadataAttribute.new(nil, true)
  @attributes['chef_run_list'] = MetadataAttribute.new(nil, true)
  @attributes['instance_type'] = MetadataAttribute.new(nil, true)
  @attributes['os_type'] = MetadataAttribute.new(nil, true)
  @attributes['role'] = MetadataAttribute.new(nil, true)
  @attributes['source_ami_name'] = MetadataAttribute.new(nil, true)
  @attributes['source_ami_owner'] = MetadataAttribute.new(nil, true)
  @attributes['version'] = MetadataAttribute.new(REPO_VERSION, true)
  @attributes['security_group_id'] = MetadataAttribute.new(ENV['PACKER_BUILD_SG_ID'], true)
  @attributes['vpc_id'] = MetadataAttribute.new(ENV['PACKER_BUILD_VPC_ID'], true)
  @attributes['vpc_subnet'] = MetadataAttribute.new(ENV['PACKER_BUILD_SUBNET_ID'], true)
  @attributes['iam_instance_profile'] = MetadataAttribute.new(ENV['PACKER_BUILD_INSTANCE_PROFILE_NAME'], true)

  # Optional Defaults
  @attributes['block_device_mapping'] = MetadataAttribute.new('[]')
  @attributes['job_code'] = MetadataAttribute.new('988')
  @attributes['chef_dir'] = MetadataAttribute.new('c:/windows/temp/packer-chef-client')
end