57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/hawser/baking-command.rb', line 57
def command
cmd("(ec2-bundle-vol --version | grep \"#{ec2_version_pattern}\")") &
(cmd("rm") {|rm|
rm.options = ["-f", File::join(ephemeral_dir.abspath, prefix || "no-such-file") ]
}) &
(cmd("ec2-bundle-vol") { |bundle|
bundle.options += ["-k", private_key.abspath ]
bundle.options += ["-c", certificate_file.abspath ]
bundle.options += ["--user", aws_account_id ]
bundle.options += ["--block-device-mapping", block_mappings.map do |name, dev|
"#{name}=#{dev}"
end.join(",")
]
bundle.options += ["--destination", ephemeral_dir.abspath ]
bundle.options += ["--prefix", prefix ]
bundle.options += ["--arch", arch ]
bundle.options += %w{-i /etc/ec2/amitools/cert-ec2.pem}
bundle.options += ["-i", '$(ls /etc/ssl/certs/*.pem | tr \\\\n ,)']
bundle.options += %w{--ec2cert /etc/ec2/amitools/cert-ec2.pem}
bundle.options += ["-e", keyfile_dir.abspath]
}) &
(cmd("ec2-upload-bundle") {|upload|
upload.options += ["-b", bucket ]
upload.options += ["-m", manifest_path]
upload.options += ["-a", access_key ]
upload.options += ["-s", secret_key ]
upload.options += ["--location", region ]
upload.options += ["--retry"]
}) &
(cmd("ec2-register") {|register|
register.options << "#{bucket}/#{manifest_name}"
register.options += ["-n", image_name]
register.options += ["--region", region]
register.options += ["--aws-access-key", access_key]
register.options += ["--aws-secret-key", secret_key]
}) &
(cmd("rm") {|rm|
rm.options = ["-rf", keyfile_dir.abspath]
}) &
(cmd("rm") {|rm|
rm.options = ["-f", File::join(ephemeral_dir.abspath, prefix || "no-such-file"), File::join(ephemeral_dir.abspath, prefix || "no-such-file") + ".part.*" ]
})
end
|