boxgrinder-build 0.9.8 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/CHANGELOG +15 -0
  2. data/Manifest +7 -22
  3. data/Rakefile +3 -1
  4. data/bin/boxgrinder-build +1 -1
  5. data/boxgrinder-build.gemspec +17 -13
  6. data/integ/appliances/jeos-centos6.appl +4 -0
  7. data/lib/boxgrinder-build/appliance.rb +61 -23
  8. data/lib/boxgrinder-build/helpers/ec2-helper.rb +18 -0
  9. data/lib/boxgrinder-build/helpers/linux-helper.rb +41 -2
  10. data/lib/boxgrinder-build/helpers/plugin-helper.rb +3 -0
  11. data/lib/boxgrinder-build/helpers/s3-helper.rb +18 -0
  12. data/lib/boxgrinder-build/helpers/sftp-helper.rb +124 -0
  13. data/lib/boxgrinder-build/managers/plugin-manager.rb +5 -3
  14. data/lib/boxgrinder-build/plugins/base-plugin.rb +2 -22
  15. data/lib/boxgrinder-build/plugins/delivery/ebs/ebs-plugin.rb +26 -15
  16. data/lib/boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin.rb +2 -1
  17. data/lib/boxgrinder-build/plugins/delivery/libvirt/libvirt-capabilities.rb +164 -0
  18. data/lib/boxgrinder-build/plugins/delivery/libvirt/libvirt-plugin.rb +313 -0
  19. data/lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb +2 -1
  20. data/lib/boxgrinder-build/plugins/delivery/openstack/openstack-plugin.rb +133 -0
  21. data/lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb +15 -2
  22. data/lib/boxgrinder-build/plugins/delivery/sftp/sftp-plugin.rb +20 -106
  23. data/lib/boxgrinder-build/plugins/os/centos/centos-plugin.rb +3 -3
  24. data/lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb +2 -1
  25. data/lib/boxgrinder-build/plugins/os/rhel/rhel-plugin.rb +2 -1
  26. data/lib/boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin.rb +6 -64
  27. data/lib/boxgrinder-build/plugins/os/rpm-based/rpm-dependency-validator.rb +2 -1
  28. data/lib/boxgrinder-build/plugins/os/sl/sl-plugin.rb +1 -2
  29. data/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb +15 -1
  30. data/lib/boxgrinder-build/plugins/platform/virtualbox/virtualbox-plugin.rb +2 -1
  31. data/lib/boxgrinder-build/plugins/platform/virtualpc/virtualpc-plugin.rb +58 -0
  32. data/lib/boxgrinder-build/plugins/platform/vmware/vmware-plugin.rb +2 -1
  33. data/rubygem-boxgrinder-build.spec +25 -1
  34. data/spec/appliance-spec.rb +1 -58
  35. data/spec/helpers/linux-helper-spec.rb +70 -0
  36. data/spec/managers/plugin-manager-spec.rb +4 -13
  37. data/spec/plugins/delivery/ebs/ebs-plugin-spec.rb +6 -14
  38. data/spec/plugins/delivery/elastichosts/elastichosts-plugin-spec.rb +5 -6
  39. data/spec/plugins/delivery/libvirt/libvirt-plugin-spec.rb +300 -0
  40. data/spec/plugins/delivery/libvirt/libvirt_modified.xml +25 -0
  41. data/spec/plugins/delivery/libvirt/libvirt_modify.sh +18 -0
  42. data/spec/plugins/delivery/libvirt/libvirt_test.xml +24 -0
  43. data/spec/plugins/delivery/local/local-plugin-spec.rb +3 -6
  44. data/spec/plugins/delivery/openstack/openstack-plugin-spec.rb +103 -0
  45. data/spec/plugins/delivery/s3/s3-plugin-spec.rb +16 -5
  46. data/spec/plugins/os/rpm-based/rpm-based-os-plugin-spec.rb +2 -80
  47. data/spec/plugins/platform/ec2/ec2-plugin-spec.rb +15 -1
  48. data/spec/plugins/platform/virtualbox/virtualbox-plugin-spec.rb +6 -6
  49. data/spec/plugins/platform/virtualpc/virtualpc-plugin-spec.rb +90 -0
  50. data/spec/plugins/platform/vmware/vmware-plugin-spec.rb +5 -9
  51. data/spec/rspec-plugin-helper.rb +47 -0
  52. metadata +54 -10
@@ -22,6 +22,8 @@ require 'boxgrinder-build/plugins/base-plugin'
22
22
 
23
23
  module BoxGrinder
24
24
  class LocalPlugin < BasePlugin
25
+ plugin :type => :delivery, :name => :local, :full_name => "Local file system"
26
+
25
27
  def after_init
26
28
  @package_name = "#{@appliance_config.name}-#{@appliance_config.version}.#{@appliance_config.release}-#{@appliance_config.os.name}-#{@appliance_config.os.version}-#{@appliance_config.hardware.arch}-#{current_platform}.tgz"
27
29
  end
@@ -67,4 +69,3 @@ module BoxGrinder
67
69
  end
68
70
  end
69
71
 
70
- plugin :class => BoxGrinder::LocalPlugin, :type => :delivery, :name => :local, :full_name => "Local file system"
@@ -0,0 +1,133 @@
1
+ #
2
+ # Copyright 2010 Red Hat, Inc.
3
+ #
4
+ # This is free software; you can redistribute it and/or modify it
5
+ # under the terms of the GNU Lesser General Public License as
6
+ # published by the Free Software Foundation; either version 3 of
7
+ # the License, or (at your option) any later version.
8
+ #
9
+ # This software is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this software; if not, write to the Free
16
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17
+ # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18
+
19
+ require 'rubygems'
20
+ require 'boxgrinder-build/plugins/base-plugin'
21
+ require 'rest_client'
22
+ require 'json'
23
+
24
+ module BoxGrinder
25
+ class OpenStackPlugin < BasePlugin
26
+ plugin :type => :delivery, :name => :openstack, :full_name => "OpenStack"
27
+
28
+ def after_init
29
+ set_default_config_value('host', 'localhost')
30
+ set_default_config_value('port', '9292')
31
+ set_default_config_value('schema', 'http')
32
+ set_default_config_value('overwrite', false)
33
+ set_default_config_value('public', false)
34
+
35
+ register_supported_platform(:ec2)
36
+ register_supported_platform(:vmware)
37
+ register_supported_platform(:virtualbox)
38
+
39
+ @disk_format, @container_format = disk_and_container_format
40
+ @appliance_name = "#{@appliance_config.name}-#{@appliance_config.version}.#{@appliance_config.release}-#{@disk_format}"
41
+ end
42
+
43
+ def execute
44
+ @log.debug "Checking if '#{@appliance_name}' appliance is already registered..."
45
+ images = get_images(:name => @appliance_name)
46
+
47
+ unless images.empty?
48
+ @log.debug "We found one or more appliances with the name '#{@appliance_name}'."
49
+
50
+ unless @plugin_config['overwrite']
51
+ @log.error "One or more appliances are already registered with the name '#{@appliance_name}'. You can specify 'overwrite' parameter to remove them."
52
+ return
53
+ end
54
+
55
+ @log.info "Removing all images with name '#{@appliance_name}' because 'overwrite' parameter is set to true..."
56
+ images.each {|i| delete_image(i['id']) }
57
+ @log.info "Images removed."
58
+ end
59
+
60
+ disk_format, container_format = disk_and_container_format
61
+
62
+ post_image(:disk_format => disk_format, :container_format => container_format, :public => @plugin_config['public'])
63
+ end
64
+
65
+ def disk_and_container_format
66
+ disk_format = :raw
67
+ container_format = :bare
68
+
69
+ if @previous_plugin_info[:type] == :platform
70
+ case @previous_plugin_info[:name]
71
+ when :ec2:
72
+ disk_format = :ami
73
+ container_format = :ami
74
+ when :vmware:
75
+ disk_format = :vmdk
76
+ when :virtualbox:
77
+ disk_format = :vmdk
78
+ end
79
+ end
80
+
81
+ [disk_format, container_format]
82
+ end
83
+
84
+ def post_image(options = {})
85
+ options = {
86
+ :disk_format => :raw, # raw, vhd, vmdk, vdi, qcow2, aki, ari, ami
87
+ :container_format => :bare, # ovf, bare, aki, ari, ami
88
+ :public => true
89
+ }.merge(options)
90
+
91
+ @log.info "Uploading and registering '#{@appliance_name}' appliance in OpenStack..."
92
+
93
+ file_size = File.size(@previous_deliverables.disk)
94
+
95
+ @log.trace "Disk format: #{options[:disk_format]}, container format: #{options[:container_format]}, public: #{options[:public]}, size: #{file_size}."
96
+
97
+ image = JSON.parse(RestClient.post("#{url}/v1/images",
98
+ File.new(@previous_deliverables.disk, 'rb'),
99
+ :content_type => 'application/octet-stream',
100
+ 'x-image-meta-size' => file_size,
101
+ 'x-image-meta-name' => @appliance_name,
102
+ 'x-image-meta-disk-format' => options[:disk_format],
103
+ 'x-image-meta-container-format' => options[:container_format],
104
+ 'x-image-meta-is-public' => options[:public] ? "true" : false,
105
+ 'x-image-meta-property-distro' => "#{@appliance_config.os.name.capitalize} #{@appliance_config.os.version}"
106
+ ))['image']
107
+
108
+ @log.info "Appliance registered under id = #{image['id']}."
109
+ end
110
+
111
+ # Removes image from the server for specified id.
112
+ #
113
+ def delete_image(id)
114
+ @log.trace "Removing image with id = #{id}..."
115
+ RestClient.delete("#{url}/v1/images/#{id}")
116
+ @log.trace "Image removed."
117
+ end
118
+
119
+ # Retrieves a list of public images with specified filter. If no filter is specified - all images are returned.
120
+ #
121
+ def get_images(params = {})
122
+ @log.trace "Listing images with params = #{params.to_json}..."
123
+ data = JSON.parse(RestClient.get("#{url}/v1/images", :params => params))['images']
124
+ @log.trace "Listing done."
125
+ data
126
+ end
127
+
128
+ def url
129
+ "#{@plugin_config['schema']}://#{@plugin_config['host']}:#{@plugin_config['port']}"
130
+ end
131
+ end
132
+ end
133
+
@@ -25,6 +25,7 @@ require 'boxgrinder-build/helpers/ec2-helper'
25
25
 
26
26
  module BoxGrinder
27
27
  class S3Plugin < BasePlugin
28
+ plugin :type => :delivery, :name => :s3, :full_name => "Amazon Simple Storage Service (Amazon S3)", :types => [:s3, :cloudfront, :ami]
28
29
 
29
30
  def after_init
30
31
  register_supported_os("fedora", ['13', '14', '15', '16'])
@@ -38,6 +39,8 @@ module BoxGrinder
38
39
 
39
40
  def validate
40
41
  set_default_config_value('overwrite', false)
42
+ set_default_config_value('kernel', false)
43
+ set_default_config_value('ramdisk', false)
41
44
  set_default_config_value('path', '/')
42
45
  set_default_config_value('region', 'us-east-1')
43
46
  validate_plugin_config(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
@@ -153,7 +156,18 @@ module BoxGrinder
153
156
 
154
157
  FileUtils.mkdir_p(@ami_build_dir)
155
158
 
156
- @exec_helper.execute("euca-bundle-image --ec2cert #{File.dirname(__FILE__)}/src/cert-ec2.pem -i #{deliverables[:disk]} --kernel #{@s3_endpoints[@plugin_config['region']][:kernel][@appliance_config.hardware.base_arch.intern][:aki]} -c #{@plugin_config['cert_file']} -k #{@plugin_config['key_file']} -u #{@plugin_config['account_number']} -r #{@appliance_config.hardware.base_arch} -d #{@ami_build_dir}", :redacted => [@plugin_config['account_number'], @plugin_config['key_file'], @plugin_config['cert_file']])
159
+ cmd_str = "euca-bundle-image --ec2cert #{File.dirname(__FILE__)}/src/cert-ec2.pem " <<
160
+ "-i #{deliverables[:disk]} " <<
161
+ "--kernel #{@plugin_config['kernel'] || @s3_endpoints[@plugin_config['region']][:kernel][@appliance_config.hardware.base_arch.intern][:aki]} " <<
162
+ "-c #{@plugin_config['cert_file']} "<<
163
+ "-k #{@plugin_config['key_file']} " <<
164
+ "-u #{@plugin_config['account_number']} " <<
165
+ "-r #{@appliance_config.hardware.base_arch} " <<
166
+ "-d #{@ami_build_dir} "
167
+
168
+ cmd_str << "--ramdisk #{@plugin_config['ramdisk']}" if @plugin_config['ramdisk']
169
+
170
+ @exec_helper.execute(cmd_str, :redacted => [@plugin_config['account_number'], @plugin_config['key_file'], @plugin_config['cert_file']])
157
171
 
158
172
  @log.info "Bundling AMI finished."
159
173
  end
@@ -216,4 +230,3 @@ module BoxGrinder
216
230
  end
217
231
  end
218
232
 
219
- plugin :class => BoxGrinder::S3Plugin, :type => :delivery, :name => :s3, :full_name => "Amazon Simple Storage Service (Amazon S3)", :types => [:s3, :cloudfront, :ami]
@@ -22,14 +22,21 @@ require 'net/sftp'
22
22
  require 'progressbar'
23
23
  require 'boxgrinder-build/plugins/base-plugin'
24
24
  require 'boxgrinder-build/helpers/package-helper'
25
+ require 'boxgrinder-build/helpers/sftp-helper'
25
26
 
26
27
  module BoxGrinder
27
28
  class SFTPPlugin < BasePlugin
29
+ plugin :type => :delivery, :name => :sftp, :full_name => "SSH File Transfer Protocol"
30
+
28
31
  def validate
29
32
  set_default_config_value('overwrite', false)
30
33
  set_default_config_value('default_permissions', 0644)
34
+ set_default_config_value('identity', false)
31
35
 
32
36
  validate_plugin_config(['path', 'username', 'host'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#SFTP_Delivery_Plugin')
37
+
38
+ @identity = (@plugin_config['identity'] || @plugin_config['i'])
39
+ @sftp_helper = SFTPHelper.new(:log => @log)
33
40
  end
34
41
 
35
42
  def after_init
@@ -41,114 +48,21 @@ module BoxGrinder
41
48
 
42
49
  @log.info "Uploading #{@appliance_config.name} appliance via SSH..."
43
50
 
44
- begin
45
- #TODO move to a block
46
- connect
47
- upload_files(@plugin_config['path'], File.basename(@deliverables[:package]) => @deliverables[:package])
48
- disconnect
49
-
50
- @log.info "Appliance #{@appliance_config.name} uploaded."
51
- rescue => e
52
- @log.error e
53
- @log.error "An error occurred while uploading files."
54
- end
55
- end
51
+ sftp_opts={}
52
+ sftp_opts.merge!(:password => @plugin_config['password']) if @plugin_config['password']
53
+ sftp_opts.merge!(:keys => @identity.to_a) if @identity
56
54
 
57
- def connect
58
- @log.info "Connecting to #{@plugin_config['host']}..."
59
- @ssh = Net::SSH.start(@plugin_config['host'], @plugin_config['username'], {:password => @plugin_config['password']})
60
- end
61
-
62
- def connected?
63
- return true if !@ssh.nil? and !@ssh.closed?
64
- false
65
- end
55
+ @sftp_helper.connect(@plugin_config['host'], @plugin_config['username'], sftp_opts)
56
+ @sftp_helper.upload_files(@plugin_config['path'], @plugin_config['default_permissions'], @plugin_config['overwrite'], File.basename(@deliverables[:package]) => @deliverables[:package])
66
57
 
67
- def disconnect
68
- @log.info "Disconnecting from #{@plugin_config['host']}..."
69
- @ssh.close if connected?
70
- @ssh = nil
58
+ @log.info "Appliance #{@appliance_config.name} uploaded."
59
+ rescue => e
60
+ @log.error e
61
+ @log.error "An error occurred while uploading files."
62
+ raise
63
+ ensure
64
+ @sftp_helper.disconnect
71
65
  end
72
66
 
73
- def upload_files(path, files = {})
74
- return if files.size == 0
75
-
76
- raise "You're not connected to server" unless connected?
77
-
78
- @log.debug "Files to upload:"
79
-
80
- files.each do |remote, local|
81
- @log.debug "#{File.basename(local)} => #{path}/#{remote}"
82
- end
83
-
84
- global_size = 0
85
-
86
- files.each_value do |file|
87
- global_size += File.size(file)
88
- end
89
-
90
- global_size_kb = global_size / 1024
91
- global_size_mb = global_size_kb / 1024
92
-
93
- @log.info "#{files.size} files to upload (#{global_size_mb > 0 ? global_size_mb.to_s + "MB" : global_size_kb > 0 ? global_size_kb.to_s + "kB" : global_size.to_s})"
94
-
95
- @ssh.sftp.connect do |sftp|
96
- begin
97
- sftp.stat!(path)
98
- rescue Net::SFTP::StatusException => e
99
- raise unless e.code == 2
100
- @ssh.exec!("mkdir -p #{path}")
101
- end
102
-
103
- nb = 0
104
-
105
- files.each do |key, local|
106
- name = File.basename(local)
107
- remote = "#{path}/#{key}"
108
- size_b = File.size(local)
109
- size_kb = size_b / 1024
110
- nb_of = "#{nb += 1}/#{files.size}"
111
-
112
- begin
113
- sftp.stat!(remote)
114
-
115
- unless @plugin_config['overwrite']
116
-
117
- local_md5_sum = `md5sum #{local} | awk '{ print $1 }'`.strip
118
- remote_md5_sum = @ssh.exec!("md5sum #{remote} | awk '{ print $1 }'").strip
119
-
120
- if (local_md5_sum.eql?(remote_md5_sum))
121
- @log.info "#{nb_of} #{name}: files are identical (md5sum: #{local_md5_sum}), skipping..."
122
- next
123
- end
124
- end
125
-
126
- rescue Net::SFTP::StatusException => e
127
- raise unless e.code == 2
128
- end
129
-
130
- @ssh.exec!("mkdir -p #{File.dirname(remote) }")
131
-
132
- pbar = ProgressBar.new("#{nb_of} #{name}", size_b)
133
- pbar.file_transfer_mode
134
-
135
- sftp.upload!(local, remote) do |event, uploader, * args|
136
- case event
137
- when :open then
138
- when :put then
139
- pbar.set(args[1])
140
- when :close then
141
- when :mkdir then
142
- when :finish then
143
- pbar.finish
144
- end
145
- end
146
-
147
- sftp.setstat(remote, :permissions => @plugin_config['default_permissions'])
148
- end
149
- end
150
- end
151
67
  end
152
- end
153
-
154
- plugin :class => BoxGrinder::SFTPPlugin, :type => :delivery, :name => :sftp, :full_name => "SSH File Transfer Protocol"
68
+ end
@@ -20,6 +20,7 @@ require 'boxgrinder-build/plugins/os/rhel/rhel-plugin'
20
20
 
21
21
  module BoxGrinder
22
22
  class CentOSPlugin < RHELPlugin
23
+ plugin :type => :os, :name => :centos, :full_name => "CentOS", :versions => ["5", "6"]
23
24
 
24
25
  def after_init
25
26
  super
@@ -29,8 +30,8 @@ module BoxGrinder
29
30
  def execute(appliance_definition_file)
30
31
  repos = {}
31
32
 
32
- @plugin_info[:versions].each do |version|
33
- repos[version] = {
33
+ @plugin_info[:versions].each do |version|
34
+ repos[version] = {
34
35
  "base" => {
35
36
  "mirrorlist" => "http://mirrorlist.centos.org/?release=#OS_VERSION#&arch=#BASE_ARCH#&repo=os"
36
37
  },
@@ -45,4 +46,3 @@ module BoxGrinder
45
46
  end
46
47
  end
47
48
 
48
- plugin :class => BoxGrinder::CentOSPlugin, :type => :os, :name => :centos, :full_name => "CentOS", :versions => ["5", "6"]
@@ -20,6 +20,8 @@ require 'boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin'
20
20
 
21
21
  module BoxGrinder
22
22
  class FedoraPlugin < RPMBasedOSPlugin
23
+ plugin :type => :os, :name => :fedora, :full_name => "Fedora", :versions => ["13", "14", "15", "16", "rawhide"]
24
+
23
25
  def after_init
24
26
  super
25
27
  register_supported_os('fedora', ["13", "14", "15", "16", "rawhide"])
@@ -108,4 +110,3 @@ module BoxGrinder
108
110
  end
109
111
  end
110
112
 
111
- plugin :class => BoxGrinder::FedoraPlugin, :type => :os, :name => :fedora, :full_name => "Fedora", :versions => ["13", "14", "15", "16", "rawhide"]
@@ -20,6 +20,8 @@ require 'boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin'
20
20
 
21
21
  module BoxGrinder
22
22
  class RHELPlugin < RPMBasedOSPlugin
23
+ plugin :type => :os, :name => :rhel, :full_name => "Red Hat Enterprise Linux", :versions => ['5', '6']
24
+
23
25
  def after_init
24
26
  super
25
27
  register_supported_os('rhel', ['5', '6'])
@@ -57,4 +59,3 @@ module BoxGrinder
57
59
  end
58
60
  end
59
61
 
60
- plugin :class => BoxGrinder::RHELPlugin, :type => :os, :name => :rhel, :full_name => "Red Hat Enterprise Linux", :versions => ['5', '6']
@@ -26,6 +26,8 @@ require 'boxgrinder-core/errors'
26
26
  module BoxGrinder
27
27
  class RPMBasedOSPlugin < BasePlugin
28
28
  def after_init
29
+ set_default_config_value('format', 'raw')
30
+
29
31
  register_deliverable(
30
32
  :disk => "#{@appliance_config.name}-sda.#{@plugin_config['format']}",
31
33
  :descriptor => "#{@appliance_config.name}.xml"
@@ -34,63 +36,6 @@ module BoxGrinder
34
36
  @linux_helper = LinuxHelper.new(:log => @log)
35
37
  end
36
38
 
37
- def validate
38
- set_default_config_value('format', 'raw')
39
- end
40
-
41
- def read_file(file)
42
- read_kickstart(file) if File.extname(file).eql?('.ks')
43
- end
44
-
45
- def read_kickstart(file)
46
- appliance_config = ApplianceConfig.new
47
- appliance_config.name = File.basename(file, '.ks')
48
-
49
- name = nil
50
- version = nil
51
-
52
- kickstart = File.read(file)
53
-
54
- kickstart.each do |line|
55
- n = line.scan(/^# bg_os_name: (.*)/).flatten.first
56
- v = line.scan(/^# bg_os_version: (.*)/).flatten.first
57
-
58
- name = n unless n.nil?
59
- version = v unless v.nil?
60
- end
61
-
62
- raise "No operating system name specified, please add comment to you kickstrt file like this: # bg_os_name: fedora" if name.nil?
63
- raise "No operating system version specified, please add comment to you kickstrt file like this: # bg_os_version: 14" if version.nil?
64
-
65
- appliance_config.os.name = name
66
- appliance_config.os.version = version
67
-
68
- partitions = {}
69
-
70
- kickstart.each do |line|
71
- # Parse also the partition scheme
72
- if line =~ /^part ([\/\w]+)/
73
- root = $1
74
- partitions[root] = {}
75
-
76
- # size
77
- partitions[root]['size'] = $1.to_f / 1024 if line =~ /--size[=\s]*(\d+)/
78
- # fs type
79
- partitions[root]['type'] = $1 if line =~ /--fstype[=\s]*(\w+)/
80
- # fs options
81
- partitions[root]['options'] = $1 if line =~ /--fsoptions[=\s]*([,\w]+)/
82
-
83
- raise "Partition size not specified for #{root} partition in #{file}" if partitions[root]['size'].nil?
84
- end
85
- end
86
-
87
- raise "No partitions specified in your kickstart file #{file}" if partitions.empty?
88
-
89
- appliance_config.hardware.partitions = partitions
90
-
91
- appliance_config
92
- end
93
-
94
39
  # Add default repos (if present) to the list of additional repositories specified in appliance definition.
95
40
  def add_repos(repos)
96
41
  return if repos.empty?
@@ -116,13 +61,10 @@ module BoxGrinder
116
61
  def build_with_appliance_creator(appliance_definition_file, repos = {})
117
62
  @appliance_definition_file = appliance_definition_file
118
63
 
119
- if File.extname(appliance_definition_file).eql?('.ks')
120
- kickstart_file = appliance_definition_file
121
- else
122
- add_repos(repos) if @appliance_config.default_repos
123
- kickstart_file = Kickstart.new(@config, @appliance_config, @dir, :log => @log).create
124
- RPMDependencyValidator.new(@config, @appliance_config, @dir, :log => @log).resolve_packages
125
- end
64
+ add_repos(repos) if @appliance_config.default_repos
65
+
66
+ kickstart_file = Kickstart.new(@config, @appliance_config, @dir, :log => @log).create
67
+ RPMDependencyValidator.new(@config, @appliance_config, @dir, :log => @log).resolve_packages
126
68
 
127
69
  @log.info "Building #{@appliance_config.name} appliance..."
128
70