boxgrinder-build 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ v0.9.5
2
+
3
+ * [BGBUILD-294] Package aws-sdk 1.1.1 and update dependency
4
+ * [BGBUILD-277] When delivering as AMI, the EC2 region should match S3 bucket's region (location constraint)
5
+ * [BGBUILD-297] Cannot create EBS appliances when using overwrite parameter
6
+ * [BGBUILD-280] Add support for GRUB2
7
+ * [BGBUILD-279] Add support for Fedora 16
8
+ * [BGBUILD-293] Check certificate and key paths are valid before building AMIs
9
+
1
10
  v0.9.4
2
11
 
3
12
  * [BGBUILD-263] NoMethodError: undefined method `item' for nil:NilClass while creating EBS appliance
data/Manifest CHANGED
@@ -19,6 +19,7 @@ integ/appliances/_repos_testlocal_ephemeral_noarch.appl
19
19
  integ/appliances/_test_base.appl
20
20
  integ/appliances/gnome-fedora.appl
21
21
  integ/appliances/jeos-centos.appl
22
+ integ/appliances/jeos-f16.appl
22
23
  integ/appliances/jeos-fedora.appl
23
24
  integ/appliances/modular.appl
24
25
  integ/packages/ephemeral-repo-test-0.1-1.noarch.rpm
@@ -90,4 +91,4 @@ spec/plugins/os/centos/centos-plugin-spec.rb
90
91
  spec/plugins/os/fedora/fedora-plugin-spec.rb
91
92
  spec/plugins/os/rhel/rhel-plugin-spec.rb
92
93
  spec/plugins/os/rpm-based/kickstart-spec.rb
93
- spec/plugins/os/rpm-based/rpm-based-os-plugin-spec.rb
94
+ spec/plugins/os/rpm-ba
data/Rakefile CHANGED
@@ -28,7 +28,7 @@ Echoe.new("boxgrinder-build") do |p|
28
28
  p.email = "info@boxgrinder.org"
29
29
  p.runtime_dependencies = [
30
30
  "boxgrinder-core ~>0.3.0",
31
- 'aws-sdk', # EBS and S3
31
+ 'aws-sdk >=1.1.1', # EBS and S3
32
32
  'net-sftp', 'net-ssh', 'progressbar', # SFTP
33
33
  'rest-client' # ElasticHosts
34
34
  ]
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{boxgrinder-build}
5
- s.version = "0.9.4"
5
+ s.version = "0.9.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Marek Goldmann"]
9
- s.date = %q{2011-08-17}
9
+ s.date = %q{2011-08-26}
10
10
  s.default_executable = %q{boxgrinder-build}
11
11
  s.description = %q{A tool for creating appliances from simple plain text files for various virtual environments.}
12
12
  s.email = %q{info@boxgrinder.org}
13
13
  s.executables = ["boxgrinder-build"]
14
14
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.md", "bin/boxgrinder-build", "lib/boxgrinder-build.rb", "lib/boxgrinder-build/appliance.rb", "lib/boxgrinder-build/helpers/augeas-helper.rb", "lib/boxgrinder-build/helpers/aws-helper.rb", "lib/boxgrinder-build/helpers/ec2-helper.rb", "lib/boxgrinder-build/helpers/guestfs-helper.rb", "lib/boxgrinder-build/helpers/image-helper.rb", "lib/boxgrinder-build/helpers/linux-helper.rb", "lib/boxgrinder-build/helpers/package-helper.rb", "lib/boxgrinder-build/helpers/plugin-helper.rb", "lib/boxgrinder-build/helpers/qemu.wrapper", "lib/boxgrinder-build/helpers/s3-helper.rb", "lib/boxgrinder-build/managers/plugin-manager.rb", "lib/boxgrinder-build/plugins/base-plugin.rb", "lib/boxgrinder-build/plugins/delivery/ebs/ebs-plugin.rb", "lib/boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin.rb", "lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb", "lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb", "lib/boxgrinder-build/plugins/delivery/s3/src/cert-ec2.pem", "lib/boxgrinder-build/plugins/delivery/sftp/sftp-plugin.rb", "lib/boxgrinder-build/plugins/delivery/usb/usb-plugin.rb", "lib/boxgrinder-build/plugins/os/centos/centos-plugin.rb", "lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb", "lib/boxgrinder-build/plugins/os/rhel/rhel-plugin.rb", "lib/boxgrinder-build/plugins/os/rpm-based/kickstart.rb", "lib/boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin.rb", "lib/boxgrinder-build/plugins/os/rpm-based/rpm-dependency-validator.rb", "lib/boxgrinder-build/plugins/os/rpm-based/src/appliance.ks.erb", "lib/boxgrinder-build/plugins/os/rpm-based/src/base.repo", "lib/boxgrinder-build/plugins/os/rpm-based/src/motd.init", "lib/boxgrinder-build/plugins/os/sl/sl-plugin.rb", "lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb", "lib/boxgrinder-build/plugins/platform/ec2/src/fstab_32bit", "lib/boxgrinder-build/plugins/platform/ec2/src/fstab_64bit", "lib/boxgrinder-build/plugins/platform/ec2/src/ifcfg-eth0", "lib/boxgrinder-build/plugins/platform/ec2/src/menu.lst", "lib/boxgrinder-build/plugins/platform/ec2/src/rc_local", "lib/boxgrinder-build/plugins/platform/virtualbox/virtualbox-plugin.rb", "lib/boxgrinder-build/plugins/platform/vmware/src/README-enterprise", "lib/boxgrinder-build/plugins/platform/vmware/src/README-personal", "lib/boxgrinder-build/plugins/platform/vmware/src/base.vmdk", "lib/boxgrinder-build/plugins/platform/vmware/src/base.vmx", "lib/boxgrinder-build/plugins/platform/vmware/vmware-plugin.rb"]
15
- s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.md", "Rakefile", "bin/boxgrinder-build", "boxgrinder-build.gemspec", "integ/appliances/_hardware_cpus.appl", "integ/appliances/_hardware_memory.appl", "integ/appliances/_hardware_partitions_home.appl", "integ/appliances/_hardware_partitions_root.appl", "integ/appliances/_os_password.appl", "integ/appliances/_packages_groups_base.appl", "integ/appliances/_packages_groups_core.appl", "integ/appliances/_packages_squid.appl", "integ/appliances/_packages_utils.appl", "integ/appliances/_repos_boxgrinder_permanent_noarch.appl", "integ/appliances/_repos_testlocal_ephemeral_noarch.appl", "integ/appliances/_test_base.appl", "integ/appliances/gnome-fedora.appl", "integ/appliances/jeos-centos.appl", "integ/appliances/jeos-fedora.appl", "integ/appliances/modular.appl", "integ/packages/ephemeral-repo-test-0.1-1.noarch.rpm", "integ/packages/local-repo-test.spec", "integ/spec/jeos-spec.rb", "integ/spec/modular-spec.rb", "lib/boxgrinder-build.rb", "lib/boxgrinder-build/appliance.rb", "lib/boxgrinder-build/helpers/augeas-helper.rb", "lib/boxgrinder-build/helpers/aws-helper.rb", "lib/boxgrinder-build/helpers/ec2-helper.rb", "lib/boxgrinder-build/helpers/guestfs-helper.rb", "lib/boxgrinder-build/helpers/image-helper.rb", "lib/boxgrinder-build/helpers/linux-helper.rb", "lib/boxgrinder-build/helpers/package-helper.rb", "lib/boxgrinder-build/helpers/plugin-helper.rb", "lib/boxgrinder-build/helpers/qemu.wrapper", "lib/boxgrinder-build/helpers/s3-helper.rb", "lib/boxgrinder-build/managers/plugin-manager.rb", "lib/boxgrinder-build/plugins/base-plugin.rb", "lib/boxgrinder-build/plugins/delivery/ebs/ebs-plugin.rb", "lib/boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin.rb", "lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb", "lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb", "lib/boxgrinder-build/plugins/delivery/s3/src/cert-ec2.pem", "lib/boxgrinder-build/plugins/delivery/sftp/sftp-plugin.rb", "lib/boxgrinder-build/plugins/delivery/usb/usb-plugin.rb", "lib/boxgrinder-build/plugins/os/centos/centos-plugin.rb", "lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb", "lib/boxgrinder-build/plugins/os/rhel/rhel-plugin.rb", "lib/boxgrinder-build/plugins/os/rpm-based/kickstart.rb", "lib/boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin.rb", "lib/boxgrinder-build/plugins/os/rpm-based/rpm-dependency-validator.rb", "lib/boxgrinder-build/plugins/os/rpm-based/src/appliance.ks.erb", "lib/boxgrinder-build/plugins/os/rpm-based/src/base.repo", "lib/boxgrinder-build/plugins/os/rpm-based/src/motd.init", "lib/boxgrinder-build/plugins/os/sl/sl-plugin.rb", "lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb", "lib/boxgrinder-build/plugins/platform/ec2/src/fstab_32bit", "lib/boxgrinder-build/plugins/platform/ec2/src/fstab_64bit", "lib/boxgrinder-build/plugins/platform/ec2/src/ifcfg-eth0", "lib/boxgrinder-build/plugins/platform/ec2/src/menu.lst", "lib/boxgrinder-build/plugins/platform/ec2/src/rc_local", "lib/boxgrinder-build/plugins/platform/virtualbox/virtualbox-plugin.rb", "lib/boxgrinder-build/plugins/platform/vmware/src/README-enterprise", "lib/boxgrinder-build/plugins/platform/vmware/src/README-personal", "lib/boxgrinder-build/plugins/platform/vmware/src/base.vmdk", "lib/boxgrinder-build/plugins/platform/vmware/src/base.vmx", "lib/boxgrinder-build/plugins/platform/vmware/vmware-plugin.rb", "rubygem-boxgrinder-build.spec", "spec/appliance-spec.rb", "spec/helpers/augeas-helper-spec.rb", "spec/helpers/ec2-helper-spec.rb", "spec/helpers/guestfs-helper-spec.rb", "spec/helpers/image-helper-spec.rb", "spec/helpers/linux-helper-spec.rb", "spec/helpers/package-helper-spec.rb", "spec/helpers/plugin-helper-spec.rb", "spec/helpers/s3-helper-spec.rb", "spec/managers/plugin-manager-spec.rb", "spec/plugins/base-plugin-spec.rb", "spec/plugins/delivery/ebs/ebs-plugin-spec.rb", "spec/plugins/delivery/ebs/ebs.yaml", "spec/plugins/delivery/elastichosts/elastichosts-plugin-spec.rb", "spec/plugins/delivery/local/local-plugin-spec.rb", "spec/plugins/delivery/s3/s3-plugin-spec.rb", "spec/plugins/delivery/sftp/sftp-plugin-spec.rb", "spec/plugins/os/centos/centos-plugin-spec.rb", "spec/plugins/os/fedora/fedora-plugin-spec.rb", "spec/plugins/os/rhel/rhel-plugin-spec.rb", "spec/plugins/os/rpm-based/kickstart-spec.rb", "spec/plugins/os/rpm-based/rpm-based-os-plugin-spec.rb", "spec/plugins/os/rpm-based/rpm-dependency-validator-spec.rb", "spec/plugins/os/rpm-based/src/jeos-f13-plain.ks", "spec/plugins/os/rpm-based/src/jeos-f13-without-version.ks", "spec/plugins/os/rpm-based/src/jeos-f13.ks", "spec/plugins/os/sl/sl-plugin-spec.rb", "spec/plugins/platform/ec2/ec2-plugin-spec.rb", "spec/plugins/platform/virtualbox/virtualbox-plugin-spec.rb", "spec/plugins/platform/vmware/vmware-plugin-spec.rb"]
15
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.md", "Rakefile", "bin/boxgrinder-build", "boxgrinder-build.gemspec", "integ/appliances/_hardware_cpus.appl", "integ/appliances/_hardware_memory.appl", "integ/appliances/_hardware_partitions_home.appl", "integ/appliances/_hardware_partitions_root.appl", "integ/appliances/_os_password.appl", "integ/appliances/_packages_groups_base.appl", "integ/appliances/_packages_groups_core.appl", "integ/appliances/_packages_squid.appl", "integ/appliances/_packages_utils.appl", "integ/appliances/_repos_boxgrinder_permanent_noarch.appl", "integ/appliances/_repos_testlocal_ephemeral_noarch.appl", "integ/appliances/_test_base.appl", "integ/appliances/gnome-fedora.appl", "integ/appliances/jeos-centos.appl", "integ/appliances/jeos-f16.appl", "integ/appliances/jeos-fedora.appl", "integ/appliances/modular.appl", "integ/packages/ephemeral-repo-test-0.1-1.noarch.rpm", "integ/packages/local-repo-test.spec", "integ/spec/jeos-spec.rb", "integ/spec/modular-spec.rb", "lib/boxgrinder-build.rb", "lib/boxgrinder-build/appliance.rb", "lib/boxgrinder-build/helpers/augeas-helper.rb", "lib/boxgrinder-build/helpers/aws-helper.rb", "lib/boxgrinder-build/helpers/ec2-helper.rb", "lib/boxgrinder-build/helpers/guestfs-helper.rb", "lib/boxgrinder-build/helpers/image-helper.rb", "lib/boxgrinder-build/helpers/linux-helper.rb", "lib/boxgrinder-build/helpers/package-helper.rb", "lib/boxgrinder-build/helpers/plugin-helper.rb", "lib/boxgrinder-build/helpers/qemu.wrapper", "lib/boxgrinder-build/helpers/s3-helper.rb", "lib/boxgrinder-build/managers/plugin-manager.rb", "lib/boxgrinder-build/plugins/base-plugin.rb", "lib/boxgrinder-build/plugins/delivery/ebs/ebs-plugin.rb", "lib/boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin.rb", "lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb", "lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb", "lib/boxgrinder-build/plugins/delivery/s3/src/cert-ec2.pem", "lib/boxgrinder-build/plugins/delivery/sftp/sftp-plugin.rb", "lib/boxgrinder-build/plugins/delivery/usb/usb-plugin.rb", "lib/boxgrinder-build/plugins/os/centos/centos-plugin.rb", "lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb", "lib/boxgrinder-build/plugins/os/rhel/rhel-plugin.rb", "lib/boxgrinder-build/plugins/os/rpm-based/kickstart.rb", "lib/boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin.rb", "lib/boxgrinder-build/plugins/os/rpm-based/rpm-dependency-validator.rb", "lib/boxgrinder-build/plugins/os/rpm-based/src/appliance.ks.erb", "lib/boxgrinder-build/plugins/os/rpm-based/src/base.repo", "lib/boxgrinder-build/plugins/os/rpm-based/src/motd.init", "lib/boxgrinder-build/plugins/os/sl/sl-plugin.rb", "lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb", "lib/boxgrinder-build/plugins/platform/ec2/src/fstab_32bit", "lib/boxgrinder-build/plugins/platform/ec2/src/fstab_64bit", "lib/boxgrinder-build/plugins/platform/ec2/src/ifcfg-eth0", "lib/boxgrinder-build/plugins/platform/ec2/src/menu.lst", "lib/boxgrinder-build/plugins/platform/ec2/src/rc_local", "lib/boxgrinder-build/plugins/platform/virtualbox/virtualbox-plugin.rb", "lib/boxgrinder-build/plugins/platform/vmware/src/README-enterprise", "lib/boxgrinder-build/plugins/platform/vmware/src/README-personal", "lib/boxgrinder-build/plugins/platform/vmware/src/base.vmdk", "lib/boxgrinder-build/plugins/platform/vmware/src/base.vmx", "lib/boxgrinder-build/plugins/platform/vmware/vmware-plugin.rb", "rubygem-boxgrinder-build.spec", "spec/appliance-spec.rb", "spec/helpers/augeas-helper-spec.rb", "spec/helpers/ec2-helper-spec.rb", "spec/helpers/guestfs-helper-spec.rb", "spec/helpers/image-helper-spec.rb", "spec/helpers/linux-helper-spec.rb", "spec/helpers/package-helper-spec.rb", "spec/helpers/plugin-helper-spec.rb", "spec/helpers/s3-helper-spec.rb", "spec/managers/plugin-manager-spec.rb", "spec/plugins/base-plugin-spec.rb", "spec/plugins/delivery/ebs/ebs-plugin-spec.rb", "spec/plugins/delivery/ebs/ebs.yaml", "spec/plugins/delivery/elastichosts/elastichosts-plugin-spec.rb", "spec/plugins/delivery/local/local-plugin-spec.rb", "spec/plugins/delivery/s3/s3-plugin-spec.rb", "spec/plugins/delivery/sftp/sftp-plugin-spec.rb", "spec/plugins/os/centos/centos-plugin-spec.rb", "spec/plugins/os/fedora/fedora-plugin-spec.rb", "spec/plugins/os/rhel/rhel-plugin-spec.rb", "spec/plugins/os/rpm-based/kickstart-spec.rb", "spec/plugins/os/rpm-based/rpm-based-os-plugin-spec.rb", "spec/plugins/os/rpm-based/rpm-dependency-validator-spec.rb", "spec/plugins/os/rpm-based/src/jeos-f13-plain.ks", "spec/plugins/os/rpm-based/src/jeos-f13-without-version.ks", "spec/plugins/os/rpm-based/src/jeos-f13.ks", "spec/plugins/os/sl/sl-plugin-spec.rb", "spec/plugins/platform/ec2/ec2-plugin-spec.rb", "spec/plugins/platform/virtualbox/virtualbox-plugin-spec.rb", "spec/plugins/platform/vmware/vmware-plugin-spec.rb"]
16
16
  s.homepage = %q{http://boxgrinder.org/}
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Boxgrinder-build", "--main", "README.md"]
18
18
  s.require_paths = ["lib"]
@@ -26,14 +26,14 @@ Gem::Specification.new do |s|
26
26
 
27
27
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
28
  s.add_runtime_dependency(%q<boxgrinder-core>, ["~> 0.3.0"])
29
- s.add_runtime_dependency(%q<aws-sdk>, [">= 0"])
29
+ s.add_runtime_dependency(%q<aws-sdk>, [">= 1.1.1"])
30
30
  s.add_runtime_dependency(%q<net-sftp>, [">= 0"])
31
31
  s.add_runtime_dependency(%q<net-ssh>, [">= 0"])
32
32
  s.add_runtime_dependency(%q<progressbar>, [">= 0"])
33
33
  s.add_runtime_dependency(%q<rest-client>, [">= 0"])
34
34
  else
35
35
  s.add_dependency(%q<boxgrinder-core>, ["~> 0.3.0"])
36
- s.add_dependency(%q<aws-sdk>, [">= 0"])
36
+ s.add_dependency(%q<aws-sdk>, [">= 1.1.1"])
37
37
  s.add_dependency(%q<net-sftp>, [">= 0"])
38
38
  s.add_dependency(%q<net-ssh>, [">= 0"])
39
39
  s.add_dependency(%q<progressbar>, [">= 0"])
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
41
41
  end
42
42
  else
43
43
  s.add_dependency(%q<boxgrinder-core>, ["~> 0.3.0"])
44
- s.add_dependency(%q<aws-sdk>, [">= 0"])
44
+ s.add_dependency(%q<aws-sdk>, [">= 1.1.1"])
45
45
  s.add_dependency(%q<net-sftp>, [">= 0"])
46
46
  s.add_dependency(%q<net-ssh>, [">= 0"])
47
47
  s.add_dependency(%q<progressbar>, [">= 0"])
@@ -0,0 +1,9 @@
1
+ name: jeos-f16
2
+ os:
3
+ name: fedora
4
+ version: 16
5
+ repos:
6
+ - name: "temp-fedora-updates-testing"
7
+ mirrorlist: "https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f#OS_VERSION#&arch=#BASE_ARCH#"
8
+ ephemeral: true
9
+
@@ -53,6 +53,11 @@ module BoxGrinder
53
53
  @appliance = Appliance.new("#{File.dirname(__FILE__)}/../appliances/jeos-fedora.appl", @config, :log => @log).create
54
54
  end
55
55
 
56
+ it "should build Fedora 16 JEOS and create an AMI" do
57
+ @config.merge!(:platform => :ec2, :delivery => :ami)
58
+ @appliance = Appliance.new("#{File.dirname(__FILE__)}/../appliances/jeos-f16.appl", @config, :log => @log).create
59
+ end
60
+
56
61
  it "should build CentOS JEOS" do
57
62
  @appliance = Appliance.new("#{File.dirname(__FILE__)}/../appliances/jeos-centos.appl", @config, :log => @log).create
58
63
  end
@@ -171,7 +171,7 @@ module BoxGrinder
171
171
 
172
172
  'us-east-1' => {
173
173
  :endpoint => 'ec2.amazonaws.com',
174
- :location => '',
174
+ :location => nil,
175
175
  :kernel => {
176
176
  :i386 => {:aki => 'aki-407d9529'},
177
177
  :x86_64 => {:aki => 'aki-427d952b'}
@@ -32,7 +32,7 @@ module BoxGrinder
32
32
  end
33
33
 
34
34
  def bucket(options={})
35
- defaults = {:bucket => nil, :acl => :private, :location_constraint => 'us-east-1', :create_if_missing => false}.merge!(options)
35
+ defaults = {:bucket => nil, :acl => :private, :location_constraint => 'us-east-1', :create_if_missing => false}
36
36
  options = parse_opts(options, defaults)
37
37
 
38
38
  s3b = @s3.buckets[options[:bucket]]
@@ -43,11 +43,6 @@ module BoxGrinder
43
43
  nil
44
44
  end
45
45
 
46
- #aws-sdk 1.0.3 added .exists?
47
- def object_exists?(s3_object)
48
- s3_object.exists?
49
- end
50
-
51
46
  def delete_folder(bucket, path)
52
47
  bucket.objects.with_prefix(deslash(path)).map(&:delete)
53
48
  end
@@ -112,7 +107,7 @@ module BoxGrinder
112
107
 
113
108
  'us-east-1' => {
114
109
  :endpoint => 's3.amazonaws.com',
115
- :location => '',
110
+ :location => nil,
116
111
  :kernel => {
117
112
  :i386 => {:aki => 'aki-407d9529'},
118
113
  :x86_64 => {:aki => 'aki-427d952b'}
@@ -74,7 +74,7 @@ module BoxGrinder
74
74
  ebs_appliance_description = "#{@appliance_config.summary} | Appliance version #{@appliance_config.version}.#{@appliance_config.release} | #{@appliance_config.hardware.arch} architecture"
75
75
 
76
76
  @log.debug "Checking if appliance is already registered..."
77
- ami = @ec2helper.ami_by_name(ebs_appliance_name)
77
+ ami = ami_by_name(ebs_appliance_name)
78
78
 
79
79
  if ami and @plugin_config['overwrite']
80
80
  @log.info "Overwrite is enabled. Stomping existing assets."
@@ -172,8 +172,6 @@ module BoxGrinder
172
172
  @ec2helper.ami_by_name(name, @plugin_config['account_number'])
173
173
  end
174
174
 
175
- alias :already_registered? :ami_by_name
176
-
177
175
  def terminate_instances(instances)
178
176
  instances.map(&:terminate)
179
177
  instances.each do |i|
@@ -213,7 +211,7 @@ module BoxGrinder
213
211
 
214
212
  snapshot = 1
215
213
 
216
- while @ec2helper.already_registered?("#{base_path}-SNAPSHOT-#{snapshot}/#{@appliance_config.hardware.arch}")
214
+ while ami_by_name("#{base_path}-SNAPSHOT-#{snapshot}/#{@appliance_config.hardware.arch}")
217
215
  snapshot += 1
218
216
  end
219
217
  # Reuse the last key (if there was one)
@@ -260,4 +258,4 @@ module BoxGrinder
260
258
  end
261
259
  end
262
260
 
263
- plugin :class => BoxGrinder::EBSPlugin, :type => :delivery, :name => :ebs, :full_name => "Elastic Block Storage"
261
+ plugin :class => BoxGrinder::EBSPlugin, :type => :delivery, :name => :ebs, :full_name => "Elastic Block Storage"
@@ -27,7 +27,7 @@ module BoxGrinder
27
27
  class S3Plugin < BasePlugin
28
28
 
29
29
  def after_init
30
- register_supported_os("fedora", ['13', '14', '15'])
30
+ register_supported_os("fedora", ['13', '14', '15', '16'])
31
31
  register_supported_os("centos", ['5'])
32
32
  register_supported_os("rhel", ['5', '6'])
33
33
  register_supported_os("sl", ['5', '6'])
@@ -45,10 +45,13 @@ module BoxGrinder
45
45
  subtype(:ami) do
46
46
  set_default_config_value('snapshot', false)
47
47
  validate_plugin_config(['cert_file', 'key_file', 'account_number'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
48
+
49
+ raise PluginValidationError, "AWS certificate file doesn't exists, please check the path: '#{@plugin_config['cert_file']}'." unless File.exists?(File.expand_path(@plugin_config['cert_file']))
50
+ raise PluginValidationError, "AWS key file doesn't exists, please check the path: '#{@plugin_config['key_file']}'." unless File.exists?(File.expand_path(@plugin_config['key_file']))
48
51
  end
49
52
 
50
53
  @s3_endpoints = S3Helper::endpoints
51
- raise PluginValidationError, "Invalid region specified: #{@plugin_config['region']}. This plugin is only aware of the following regions: #{@s3_endpoints.keys.join(", ")}" unless @s3_endpoints.has_key?(@plugin_config['region'])
54
+ raise PluginValidationError, "Invalid region specified: #{@plugin_config['region']}. This plugin is only aware of the following regions: #{@s3_endpoints.keys.join(", ")}." unless @s3_endpoints.has_key?(@plugin_config['region'])
52
55
 
53
56
  @plugin_config['account_number'] = @plugin_config['account_number'].to_s.gsub(/-/, '')
54
57
 
@@ -59,12 +62,21 @@ module BoxGrinder
59
62
  :s3_endpoint => @s3_endpoints[@plugin_config['region']][:endpoint],
60
63
  :max_retries => 5,
61
64
  :use_ssl => @plugin_config['use_ssl'])
62
- #:logger => @log) need to modify our logger to accept blah.log(:level, 'message')
63
65
 
64
66
  @ec2 = AWS::EC2.new
65
67
  @s3 = AWS::S3.new
66
68
  @s3helper = S3Helper.new(@ec2, @s3, :log => @log)
67
69
  @ec2helper = EC2Helper.new(@ec2, :log => @log)
70
+
71
+ subtype(:ami) do
72
+ # If there is an existing bucket, determine whether its location_constraint matches the region selected
73
+ if existing_bucket = asset_bucket(false)
74
+ raise PluginValidationError, "Existing bucket #{@plugin_config['bucket']} has a location constraint that does not match the region selected. " <<
75
+ "AMI region and bucket location constraint must match." unless constraint_equal?(@s3_endpoints[@plugin_config['region']][:location], existing_bucket.location_constraint)
76
+ end
77
+ end
78
+
79
+ @bucket = asset_bucket(true)
68
80
  end
69
81
 
70
82
  def execute
@@ -75,34 +87,25 @@ module BoxGrinder
75
87
  upload_to_bucket(@previous_deliverables, :public_read)
76
88
  when :ami
77
89
  ami_dir = ami_key(@appliance_config.name, @plugin_config['path'])
78
- ami_manifest_key = @s3helper.stub_s3obj(asset_bucket, "#{ami_dir}/#{@appliance_config.name}.ec2.manifest.xml")
90
+ ami_manifest_key = @s3helper.stub_s3obj(@bucket, "#{ami_dir}/#{@appliance_config.name}.ec2.manifest.xml")
79
91
 
80
92
  @log.debug "Going to check whether s3 object exists"
81
93
 
82
- if @s3helper.object_exists?(ami_manifest_key) and @plugin_config['overwrite']
94
+ if ami_manifest_key.exists? and @plugin_config['overwrite']
83
95
  @log.info "Object exists, attempting to deregister an existing image"
84
96
  deregister_image(ami_manifest_key) # Remove existing image
85
- @s3helper.delete_folder(asset_bucket, ami_dir) # Avoid triggering dupe detection
97
+ @s3helper.delete_folder(@bucket, ami_dir) # Avoid triggering dupe detection
86
98
  end
87
99
 
88
- if !@s3helper.object_exists?(ami_manifest_key) or @plugin_config['snapshot']
100
+ if !ami_manifest_key.exists? or @plugin_config['snapshot']
89
101
  @log.info "Doing bundle/snapshot"
90
102
  bundle_image(@previous_deliverables)
91
- fix_sha1_sum
92
103
  upload_image(ami_dir)
93
104
  end
94
105
  register_image(ami_manifest_key)
95
106
  end
96
107
  end
97
108
 
98
- # https://jira.jboss.org/browse/BGBUILD-34
99
- def fix_sha1_sum
100
- ami_manifest = File.open(@ami_manifest).read
101
- ami_manifest.gsub!('(stdin)= ', '')
102
-
103
- File.open(@ami_manifest, "w") { |f| f.write(ami_manifest) }
104
- end
105
-
106
109
  def upload_to_bucket(previous_deliverables, permissions = :private)
107
110
  register_deliverable(
108
111
  :package => "#{@appliance_config.name}-#{@appliance_config.version}.#{@appliance_config.release}-#{@appliance_config.os.name}-#{@appliance_config.os.version}-#{@appliance_config.hardware.arch}-#{current_platform}.tgz"
@@ -115,9 +118,9 @@ module BoxGrinder
115
118
 
116
119
  remote_path = "#{@s3helper.parse_path(@plugin_config['path'])}#{File.basename(@deliverables[:package])}"
117
120
  size_m = File.size(@deliverables[:package])/1024**2
118
- s3_obj = @s3helper.stub_s3obj(asset_bucket,remote_path.gsub(/^\//, '').gsub(/\/\//, ''))
121
+ s3_obj = @s3helper.stub_s3obj(@bucket,remote_path.gsub(/^\//, '').gsub(/\/\//, ''))
119
122
  # Does it really exist?
120
- obj_exists = @s3helper.object_exists?(s3_obj)
123
+ obj_exists = s3_obj.exists?
121
124
 
122
125
  if !obj_exists or @plugin_config['overwrite']
123
126
  @log.info "Will overwrite existing file #{remote_path}" if obj_exists and @plugin_config['overwrite']
@@ -132,8 +135,8 @@ module BoxGrinder
132
135
 
133
136
  def asset_bucket(create_if_missing = true, permissions = :private)
134
137
  @s3helper.bucket(:bucket => @plugin_config['bucket'],
138
+ :create_if_missing => create_if_missing,
135
139
  :acl => permissions,
136
- :create_of_missing => create_if_missing,
137
140
  :location_constraint => @s3_endpoints[@plugin_config['region']][:location]
138
141
  )
139
142
  end
@@ -156,7 +159,6 @@ module BoxGrinder
156
159
  end
157
160
 
158
161
  def upload_image(ami_dir)
159
- asset_bucket(true,:private) # this will create the bucket if needed
160
162
  @log.info "Uploading #{@appliance_config.name} AMI to bucket '#{@plugin_config['bucket']}'..."
161
163
 
162
164
  @exec_helper.execute("euca-upload-bundle -U #{@plugin_config['url'].nil? ? "http://#{@s3_endpoints[@plugin_config['region']][:endpoint]}" : @plugin_config['url']} -b #{@plugin_config['bucket']}/#{ami_dir} -m #{@ami_manifest} -a #{@plugin_config['access_key']} -s #{@plugin_config['secret_access_key']}", :redacted => [@plugin_config['access_key'], @plugin_config['secret_access_key']])
@@ -196,9 +198,7 @@ module BoxGrinder
196
198
 
197
199
  @log.info "Determining snapshot name"
198
200
  snapshot = 1
199
- while @s3helper.object_exists?(
200
- @s3helper.stub_s3obj(asset_bucket, "#{base_path}-SNAPSHOT-#{snapshot}/#{@appliance_config.hardware.arch}/")
201
- )
201
+ while @s3helper.stub_s3obj(@bucket, "#{base_path}-SNAPSHOT-#{snapshot}/#{@appliance_config.hardware.arch}/").exists?
202
202
  snapshot += 1
203
203
  end
204
204
  # Reuse the last key (if there was one)
@@ -207,6 +207,12 @@ module BoxGrinder
207
207
  "#{base_path}-SNAPSHOT-#{snapshot}/#{@appliance_config.hardware.arch}"
208
208
  end
209
209
 
210
+ #US constraint is often represented as '' or nil
211
+ def constraint_equal?(a, b)
212
+ [a, b].collect!{|c| c.nil? ? '': c}
213
+ a == b
214
+ end
215
+
210
216
  end
211
217
  end
212
218
 
@@ -22,7 +22,7 @@ module BoxGrinder
22
22
  class FedoraPlugin < RPMBasedOSPlugin
23
23
  def after_init
24
24
  super
25
- register_supported_os('fedora', ["13", "14", "15", "rawhide"])
25
+ register_supported_os('fedora', ["13", "14", "15", "16", "rawhide"])
26
26
  set_default_config_value('PAE',true)
27
27
  end
28
28
 
@@ -42,7 +42,16 @@ module BoxGrinder
42
42
  end
43
43
  end
44
44
 
45
- build_with_appliance_creator(appliance_definition_file, @repos)
45
+ build_with_appliance_creator(appliance_definition_file, @repos) do |guestfs, guestfs_helper|
46
+ if @appliance_config.os.version >= "15"
47
+ disable_biosdevname(guestfs)
48
+ change_runlevel(guestfs)
49
+ disable_netfs(guestfs)
50
+ link_mtab(guestfs)
51
+ end
52
+
53
+ switch_to_grub2(guestfs, guestfs_helper) if @appliance_config.os.version >= "16"
54
+ end
46
55
  end
47
56
 
48
57
  def normalize_packages(packages)
@@ -60,7 +69,49 @@ module BoxGrinder
60
69
  @plugin_config['PAE'] ? packages << "kernel-PAE" : packages << "kernel"
61
70
  end
62
71
  end
72
+
73
+ # Since Fedora 16 by default GRUB2 is used - we remove Legacy GRUB
74
+ # and use GRUB2 instead
75
+ #
76
+ # https://issues.jboss.org/browse/BGBUILD-280
77
+ def switch_to_grub2(guestfs, guestfs_helper)
78
+ @log.debug "Switching to GRUB2..."
79
+ guestfs_helper.sh("yum -y remove grub")
80
+ # We are using only one disk, so this is save
81
+ guestfs.sh("cd / && grub2-install --force #{guestfs.list_devices.first}")
82
+ guestfs.sh("cd / && grub2-mkconfig -o /boot/grub2/grub.cfg")
83
+ @log.debug "Using GRUB2 from now."
84
+ end
85
+
86
+ def disable_biosdevname(guestfs)
87
+ @log.debug "Disabling biosdevname..."
88
+ guestfs.write("/etc/default/grub", "GRUB_CMDLINE_LINUX=\"quiet rhgb biosdevname=0\"\n") if guestfs.exists("/boot/grub2/grub.cfg") != 0
89
+ guestfs.sh('sed -i "s/kernel\(.*\)/kernel\1 biosdevname=0/g" /boot/grub/grub.conf') if guestfs.exists("/boot/grub/grub.cfg") != 0
90
+ @log.debug "Biosdevname disabled."
91
+ end
92
+
93
+ # https://issues.jboss.org/browse/BGBUILD-204
94
+ def change_runlevel(guestfs)
95
+ @log.debug "Changing runlevel to multi-user non-graphical..."
96
+ guestfs.rm("/etc/systemd/system/default.target")
97
+ guestfs.ln_sf("/lib/systemd/system/multi-user.target", "/etc/systemd/system/default.target")
98
+ @log.debug "Runlevel changed."
99
+ end
100
+
101
+ # https://issues.jboss.org/browse/BGBUILD-204
102
+ def disable_netfs(guestfs)
103
+ @log.debug "Disabling network filesystem mounting..."
104
+ guestfs.sh("chkconfig netfs off")
105
+ @log.debug "Network filesystem mounting disabled."
106
+ end
107
+
108
+ # https://issues.jboss.org/browse/BGBUILD-209
109
+ def link_mtab(guestfs)
110
+ @log.debug "Linking /etc/mtab to /proc/self/mounts..."
111
+ guestfs.ln_sf("/proc/self/mounts", "/etc/mtab")
112
+ @log.debug "/etc/mtab linked."
113
+ end
63
114
  end
64
115
  end
65
116
 
66
- plugin :class => BoxGrinder::FedoraPlugin, :type => :os, :name => :fedora, :full_name => "Fedora", :versions => ["13", "14", "15", "rawhide"]
117
+ plugin :class => BoxGrinder::FedoraPlugin, :type => :os, :name => :fedora, :full_name => "Fedora", :versions => ["13", "14", "15", "16", "rawhide"]
@@ -142,13 +142,6 @@ module BoxGrinder
142
142
  set_motd(guestfs)
143
143
  install_repos(guestfs)
144
144
 
145
- if @appliance_config.os.name == 'fedora' and @appliance_config.os.version == '15'
146
- disable_biosdevname(guestfs)
147
- change_runlevel(guestfs)
148
- disable_netfs(guestfs)
149
- link_mtab(guestfs)
150
- end
151
-
152
145
  guestfs.sh("chkconfig firstboot off") if guestfs.exists('/etc/init.d/firstboot') != 0
153
146
 
154
147
  # https://issues.jboss.org/browse/BGBUILD-148
@@ -183,35 +176,6 @@ module BoxGrinder
183
176
  end
184
177
  end
185
178
 
186
- # https://issues.jboss.org/browse/BGBUILD-204
187
- def disable_biosdevname(guestfs)
188
- @log.debug "Disabling biosdevname for Fedora 15..."
189
- guestfs.sh('sed -i "s/kernel\(.*\)/kernel\1 biosdevname=0/g" /boot/grub/grub.conf')
190
- @log.debug "Biosdevname disabled."
191
- end
192
-
193
- # https://issues.jboss.org/browse/BGBUILD-204
194
- def change_runlevel(guestfs)
195
- @log.debug "Changing runlevel to multi-user non-graphical..."
196
- guestfs.rm("/etc/systemd/system/default.target")
197
- guestfs.ln_sf("/lib/systemd/system/multi-user.target", "/etc/systemd/system/default.target")
198
- @log.debug "Runlevel changed."
199
- end
200
-
201
- # https://issues.jboss.org/browse/BGBUILD-204
202
- def disable_netfs(guestfs)
203
- @log.debug "Disabling network filesystem mounting..."
204
- guestfs.sh("chkconfig netfs off")
205
- @log.debug "Network filesystem mounting disabled."
206
- end
207
-
208
- # https://issues.jboss.org/browse/BGBUILD-209
209
- def link_mtab(guestfs)
210
- @log.debug "Linking /etc/mtab to /proc/self/mounts for Fedora 15..."
211
- guestfs.ln_sf("/proc/self/mounts", "/etc/mtab")
212
- @log.debug "/etc/mtab linked."
213
- end
214
-
215
179
  # https://issues.jboss.org/browse/BGBUILD-148
216
180
  def recreate_rpm_database(guestfs, guestfs_helper)
217
181
  @log.debug "Recreating RPM database..."
@@ -6,7 +6,8 @@
6
6
  # description: Prepares /etc/motd file
7
7
  #
8
8
  ### BEGIN INIT INFO
9
- # Provides: ec2
9
+ # Provides: motd
10
+ # Required-Start: network
10
11
  # Default-Start: 2345
11
12
  # Default-Stop: 0 1 6
12
13
  # Short-Description: Prepares /etc/motd file
@@ -14,7 +15,7 @@
14
15
  ### END INIT INFO
15
16
 
16
17
  HOSTNAME=`/bin/uname -a | awk '{print $2}'`
17
- IP_ADDRESS=`ip addr list eth0 | grep "inet " | cut -d' ' -f6 | cut -d/ -f1`
18
+ IP_ADDRESS=`ip addr list eth0 | grep "inet " | cut -d' ' -f6 | cut -d/ -f1 | head -1`
18
19
 
19
20
  echo -e "\nAppliance:\t#APPLIANCE# #VERSION#\nHostname:\t$HOSTNAME\nIP Address:\t$IP_ADDRESS\n" > /etc/motd
20
21
 
@@ -25,7 +25,7 @@ module BoxGrinder
25
25
  def after_init
26
26
  register_deliverable(:disk => "#{@appliance_config.name}.ec2")
27
27
 
28
- register_supported_os('fedora', ['13', '14', '15'])
28
+ register_supported_os('fedora', ['13', '14', '15', '16'])
29
29
  register_supported_os('centos', ['5'])
30
30
  register_supported_os('sl', ['5', '6'])
31
31
  register_supported_os('rhel', ['5', '6'])
@@ -173,6 +173,13 @@ module BoxGrinder
173
173
  guestfs.upload(rc_local.path, "/etc/rc.local")
174
174
 
175
175
  rc_local.close
176
+
177
+ # We need to make sure that network is available when executing rc.local
178
+ if (@appliance_config.os.name == 'fedora' and @appliance_config.os.version >= '16')
179
+ guestfs.cp("/lib/systemd/system/rc-local.service", "/etc/systemd/system/")
180
+ guestfs.sh("sed -i '/^ConditionFileIsExecutable/a After=network.target' /etc/systemd/system/rc-local.service")
181
+ end
182
+
176
183
  @log.debug "'/etc/rc.local' file uploaded."
177
184
  end
178
185
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Summary: A tool for creating appliances from simple plain text files
7
7
  Name: rubygem-%{gemname}
8
- Version: 0.9.4
8
+ Version: 0.9.5
9
9
  Release: 1%{?dist}
10
10
  Group: Development/Languages
11
11
  License: LGPLv3+
@@ -29,9 +29,9 @@ BuildRequires: rubygem(rspec-core)
29
29
 
30
30
  # AWS
31
31
  Requires: euca2ools >= 1.3.1-4
32
- Requires: rubygem(aws-sdk) >= 1.0.4
32
+ Requires: rubygem(aws-sdk) >= 1.1.1
33
33
 
34
- BuildRequires: rubygem(aws-sdk) >= 1.0.4
34
+ BuildRequires: rubygem(aws-sdk) >= 1.1.1
35
35
 
36
36
  # SFTP
37
37
  Requires: rubygem(net-sftp)
@@ -130,6 +130,14 @@ popd
130
130
  %{gemdir}/doc/%{gemname}-%{version}
131
131
 
132
132
  %changelog
133
+ * Thu Aug 23 2011 Marek Goldmann <mgoldman@redhat.com> - 0.9.5-1
134
+ - Upstream release: 0.9.
135
+ - [BGBUILD-294] Package aws-sdk 1.1.1 and update dependency
136
+ - [BGBUILD-277] When delivering as AMI, the EC2 region should match S3 bucket's region (location constraint)
137
+ - [BGBUILD-297] Cannot create EBS appliances when using overwrite parameter
138
+ - [BGBUILD-280] Add support for GRUB2
139
+ - [BGBUILD-279] Add support for Fedora 16
140
+ - [BGBUILD-293] Check certificate and key paths are valid before building AMIs
133
141
 
134
142
  * Fri Aug 12 2011 Marc Savy <msavy@redhat.com> - 0.9.4-1
135
143
  - Upstream release: 0.9.4
@@ -30,7 +30,7 @@ module BoxGrinder
30
30
  AWS.stub!
31
31
  AWS.config({:access_key_id => '', :secret_access_key => ''})
32
32
  @ec2 = AWS::EC2.new()
33
- @ec2helper = EC2Helper.new(@ec2)
33
+ @ec2helper = EC2Helper.new(@ec2, :log => LogHelper.new(:level => :trace, :type => :stdout))
34
34
  @ami = mock(AWS::EC2::Image)
35
35
  @instance = mock(AWS::EC2::Instance)
36
36
  @snapshot = mock(AWS::EC2::Snapshot)
@@ -257,4 +257,4 @@ module BoxGrinder
257
257
  end
258
258
 
259
259
  end
260
- end
260
+ end
@@ -290,12 +290,14 @@ module BoxGrinder
290
290
  it "should return false if we're on EC2" do
291
291
  URI.should_receive(:parse).with('http://169.254.169.254/latest/meta-data/ami-id').and_return('parsed')
292
292
  Net::HTTP.should_receive(:get_response).with("parsed").and_return(OpenCascade.new(:code => '200'))
293
+ @helper.should_receive(:`).with("egrep '^flags.*(vmx|svm)' /proc/cpuinfo | wc -l").and_return("0")
293
294
  @helper.hw_virtualization_available?.should == false
294
295
  end
295
296
 
296
297
  it "should return false if we're NOT on EC2 and AMI id retrieval raised an exception" do
297
298
  URI.should_receive(:parse).with('http://169.254.169.254/latest/meta-data/ami-id').and_return('parsed')
298
299
  Net::HTTP.should_receive(:get_response).with("parsed").and_raise "Boom"
300
+ @helper.should_receive(:`).with("egrep '^flags.*(vmx|svm)' /proc/cpuinfo | wc -l").and_return("0")
299
301
  @helper.hw_virtualization_available?.should == false
300
302
  end
301
303
  end
@@ -397,4 +399,4 @@ module BoxGrinder
397
399
  end
398
400
  end
399
401
  end
400
- end
402
+ end
@@ -29,8 +29,7 @@ module BoxGrinder
29
29
  AWS.config({:access_key_id => '', :secret_access_key => ''})
30
30
  @ec2 = AWS::EC2.new
31
31
  @s3 = AWS::S3.new
32
- @ec2helper = EC2Helper.new(@ec2)
33
- @s3helper = S3Helper.new(@ec2, @s3)
32
+ @s3helper = S3Helper.new(@ec2, @s3, :log => LogHelper.new(:level => :trace, :type => :stdout))
34
33
  @s3obj = mock(AWS::S3::S3Object)
35
34
  @bucket = mock(AWS::S3::Bucket)
36
35
  end
@@ -98,22 +97,6 @@ module BoxGrinder
98
97
  end
99
98
  end
100
99
 
101
- describe ".object_exists?" do
102
-
103
- it "should return true if the object exists" do
104
- @s3obj.stub!(:exists?).and_return(true)
105
- @s3obj.should_receive(:exists?).and_return(true)
106
- @s3helper.object_exists?(@s3obj).should == true
107
- end
108
-
109
- it "should return false if the object does not exist" do
110
- @s3obj.stub!(:exists?).and_return(false)
111
- @s3obj.should_receive(:exists?).and_return(false)
112
- @s3helper.object_exists?(@s3obj).should == false
113
- end
114
-
115
- end
116
-
117
100
  describe ".delete_folder" do
118
101
 
119
102
  it "should delete a folder from a bucket" do
@@ -165,4 +148,4 @@ module BoxGrinder
165
148
 
166
149
 
167
150
  end
168
- end
151
+ end