boxgrinder-build 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/bin/boxgrinder-build CHANGED
@@ -26,7 +26,7 @@ require 'boxgrinder-core/helpers/log-helper'
26
26
  require 'boxgrinder-build/helpers/plugin-helper'
27
27
  require 'boxgrinder-build/appliance'
28
28
 
29
- gem 'boxgrinder-core', '>= 0.0.10'
29
+ gem 'boxgrinder-core', '>= 0.0.11'
30
30
  gem 'aws-s3', '>= 0.6.2'
31
31
  gem 'amazon-ec2', '>= 0.9.6'
32
32
  gem 'net-sftp', '>= 2.0.4'
@@ -40,7 +40,7 @@ gem 'commander', '>= 4.0.3'
40
40
  #$stderr.reopen('/dev/null')
41
41
 
42
42
  program :name, 'BoxGrinder Build'
43
- program :version, '0.3.7'
43
+ program :version, '0.3.8'
44
44
  program :description, 'A tool for building VM images from simple definition files.'
45
45
  default_command :build
46
46
 
@@ -98,7 +98,7 @@ module BoxGrinder
98
98
  when :cloudfront
99
99
  upload_to_bucket(deliverables, :public_read)
100
100
  when :ami
101
- validate_plugin_config(['cert_file', 'key_file'])
101
+ validate_plugin_config(['cert_file', 'key_file', 'account_number'])
102
102
 
103
103
  unless AMI_OSES[@appliance_config.os.name].include?(@appliance_config.os.version)
104
104
  @log.error "You cannot convert selected image to AMI because of unsupported operating system: #{@appliance_config.os.name} #{@appliance_config.os.version}. Supported systems: #{supported_os}."
@@ -47,10 +47,15 @@ module BoxGrinder
47
47
  @exec_helper.execute "sudo chmod 666 #{@deliverables[:metadata][:descriptor]}"
48
48
 
49
49
  customize( @deliverables[:disk] ) do |guestfs, guestfs_helper|
50
+ # TODO is this really needed?
51
+ @log.debug "Uploading '/etc/resolv.conf'..."
52
+ guestfs.upload( "/etc/resolv.conf", "/etc/resolv.conf" )
53
+ @log.debug "'/etc/resolv.conf' uploaded."
54
+
50
55
  @log.info "Executing post operations after build..."
51
56
 
52
- if @appliance_config.post.base.size > 0
53
- @appliance_config.post.base.each do |cmd|
57
+ unless @appliance_config.post['base'].nil?
58
+ @appliance_config.post['base'].each do |cmd|
54
59
  @log.debug "Executing #{cmd}"
55
60
  guestfs.sh( cmd )
56
61
  end
@@ -112,6 +112,11 @@ module BoxGrinder
112
112
  umount_image(@deliverables[:disk], ec2_disk_mount_dir, ec2_mounts)
113
113
 
114
114
  customize(@deliverables[:disk]) do |guestfs, guestfs_helper|
115
+ # TODO is this really needed?
116
+ @log.debug "Uploading '/etc/resolv.conf'..."
117
+ guestfs.upload( "/etc/resolv.conf", "/etc/resolv.conf" )
118
+ @log.debug "'/etc/resolv.conf' uploaded."
119
+
115
120
  create_devices(guestfs)
116
121
  upload_fstab(guestfs)
117
122
 
@@ -125,6 +130,16 @@ module BoxGrinder
125
130
  install_additional_packages(guestfs)
126
131
  change_configuration(guestfs)
127
132
 
133
+ unless @appliance_config.post['ec2'].nil?
134
+ @appliance_config.post['ec2'].each do |cmd|
135
+ @log.debug "Executing #{cmd}"
136
+ guestfs.sh( cmd )
137
+ end
138
+ @log.debug "Post commands from appliance definition file executed."
139
+ else
140
+ @log.debug "No commands specified, skipping."
141
+ end
142
+
128
143
  # if @appliance_config.os.name.eql?("fedora") and @appliance_config.os.version.to_s.eql?("12")
129
144
  # @log.debug "Downgrading udev package to use in EC2 environment..."
130
145
  #
@@ -190,7 +205,7 @@ module BoxGrinder
190
205
  offsets.each do |offset|
191
206
  loop_device = get_loop_device
192
207
  @exec_helper.execute("sudo losetup -o #{offset.to_s} #{loop_device} #{disk}")
193
- label = @exec_helper.execute("e2label #{loop_device}").strip.chomp
208
+ label = @exec_helper.execute("sudo e2label #{loop_device}").strip.chomp
194
209
  label = '/' if label == ''
195
210
  mounts[label] = loop_device
196
211
  end
@@ -56,9 +56,9 @@ module BoxGrinder
56
56
 
57
57
  @log.debug "VMware image copied."
58
58
 
59
- if @appliance_config.post.vmware.size > 0
59
+ unless @appliance_config.post['vmware'].nil?
60
60
  customize( @deliverables[:disk] ) do |guestfs, guestfs_helper|
61
- @appliance_config.post.vmware.each do |cmd|
61
+ @appliance_config.post['vmware'].each do |cmd|
62
62
  @log.debug "Executing #{cmd}"
63
63
  guestfs.sh( cmd )
64
64
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 7
9
- version: 0.3.7
8
+ - 8
9
+ version: 0.3.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - BoxGrinder Project
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-30 00:00:00 +02:00
17
+ date: 2010-06-08 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -27,8 +27,8 @@ dependencies:
27
27
  segments:
28
28
  - 0
29
29
  - 0
30
- - 10
31
- version: 0.0.10
30
+ - 11
31
+ version: 0.0.11
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency