boxgrinder-build 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/CHANGELOG +11 -0
  2. data/Manifest +6 -7
  3. data/Rakefile +11 -6
  4. data/bash_completion +37 -0
  5. data/bin/boxgrinder-build +20 -5
  6. data/boxgrinder-build.gemspec +4 -4
  7. data/lib/boxgrinder-build.rb +2 -1
  8. data/lib/boxgrinder-build/appliance.rb +26 -24
  9. data/lib/boxgrinder-build/helpers/augeas-helper.rb +1 -1
  10. data/lib/boxgrinder-build/helpers/ec2-helper.rb +2 -2
  11. data/lib/boxgrinder-build/helpers/guestfs-helper.rb +1 -1
  12. data/lib/boxgrinder-build/helpers/s3-helper.rb +2 -2
  13. data/lib/boxgrinder-build/managers/plugin-manager.rb +1 -1
  14. data/lib/boxgrinder-build/plugins/delivery/ebs/ebs-plugin.rb +1 -1
  15. data/lib/boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin.rb +2 -2
  16. data/lib/boxgrinder-build/plugins/delivery/openstack/openstack-plugin.rb +3 -3
  17. data/lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb +16 -10
  18. data/lib/boxgrinder-build/plugins/os/centos/centos-plugin.rb +1 -1
  19. data/lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb +1 -1
  20. data/lib/boxgrinder-build/plugins/os/rhel/rhel-plugin.rb +1 -1
  21. data/lib/boxgrinder-build/plugins/os/rpm-based/kickstart.rb +5 -1
  22. data/lib/boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin.rb +8 -3
  23. data/lib/boxgrinder-build/plugins/os/rpm-based/rpm-dependency-validator.rb +1 -1
  24. data/lib/boxgrinder-build/plugins/os/sl/sl-plugin.rb +1 -1
  25. data/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb +1 -1
  26. data/lib/boxgrinder-build/util/concurrent/get_set.rb +46 -0
  27. data/lib/boxgrinder-build/util/permissions/fs-monitor.rb +182 -0
  28. data/lib/boxgrinder-build/util/permissions/fs-observer.rb +82 -0
  29. data/lib/boxgrinder-build/util/permissions/user-switcher.rb +42 -0
  30. data/rubygem-boxgrinder-build.spec +25 -3
  31. data/spec/appliance-spec.rb +69 -82
  32. data/spec/helpers/augeas-helper-spec.rb +0 -2
  33. data/spec/helpers/guestfs-helper-spec.rb +1 -3
  34. data/spec/helpers/image-helper-spec.rb +0 -2
  35. data/spec/helpers/linux-helper-spec.rb +0 -2
  36. data/spec/helpers/package-helper-spec.rb +0 -2
  37. data/spec/helpers/plugin-helper-spec.rb +0 -2
  38. data/spec/helpers/s3-helper-spec.rb +0 -2
  39. data/spec/managers/plugin-manager-spec.rb +0 -2
  40. data/spec/plugins/base-plugin-spec.rb +0 -2
  41. data/spec/plugins/delivery/ebs/ebs-plugin-spec.rb +0 -2
  42. data/spec/plugins/delivery/elastichosts/elastichosts-plugin-spec.rb +3 -5
  43. data/spec/plugins/delivery/libvirt/libvirt-plugin-spec.rb +19 -17
  44. data/spec/plugins/delivery/local/local-plugin-spec.rb +0 -2
  45. data/spec/plugins/delivery/s3/s3-plugin-spec.rb +6 -8
  46. data/spec/plugins/delivery/sftp/sftp-plugin-spec.rb +0 -2
  47. data/spec/plugins/os/centos/centos-plugin-spec.rb +0 -2
  48. data/spec/plugins/os/fedora/fedora-plugin-spec.rb +0 -2
  49. data/spec/plugins/os/rhel/rhel-plugin-spec.rb +0 -2
  50. data/spec/plugins/os/rpm-based/kickstart-spec.rb +0 -2
  51. data/spec/plugins/os/rpm-based/rpm-based-os-plugin-spec.rb +16 -4
  52. data/spec/plugins/os/rpm-based/rpm-dependency-validator-spec.rb +0 -2
  53. data/spec/plugins/platform/ec2/ec2-plugin-spec.rb +0 -2
  54. data/spec/plugins/platform/virtualbox/virtualbox-plugin-spec.rb +1 -3
  55. data/spec/plugins/platform/virtualpc/virtualpc-plugin-spec.rb +0 -1
  56. data/spec/plugins/platform/vmware/vmware-plugin-spec.rb +25 -24
  57. data/spec/rcov_helper.rb +2 -0
  58. data/spec/spec_helper.rb +9 -0
  59. data/spec/util/concurrent/get-set-spec.rb +43 -0
  60. data/spec/util/permissions/fs-monitor-spec.rb +233 -0
  61. data/spec/util/permissions/fs-observer-spec.rb +141 -0
  62. data/spec/util/permissions/user-switcher-spec.rb +69 -0
  63. metadata +20 -5
data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ v0.10.1
2
+
3
+ * [BGBUILD-332] Add support for bash completion
4
+ * [BGBUILD-338] Weed out non-deterministic tests
5
+ * [BGBUILD-337] In SL if default repos are disabled, /etc/yum.repos.d folder is not created
6
+ * [BGBUILD-344] New filesystem monitoring improvements (Fixes: Shifting failed. Permission denied issues)
7
+ * [BGBUILD-345] Change sudo/chown magic so it only occurs when running without explicit sudo/su (or --change-to-user)
8
+ * [BGBUILD-346] Confirm Ruby 1.9.3 support
9
+ * [BGBUILD-348] Simplecov coverage testing for Ruby >=1.9
10
+ * [BGBUILD-349] Use RbConfig instead of obsolete and deprecated Config deprecation warning with Ruby 1.9.3
11
+
1
12
  v0.10.0
2
13
 
3
14
  * [BGBUILD-313] boxgrinder build fails to build ec2 image if ec2-user already exists
data/Manifest CHANGED
@@ -3,6 +3,7 @@ LICENSE
3
3
  Manifest
4
4
  README.md
5
5
  Rakefile
6
+ bash_completion
6
7
  bin/boxgrinder-build
7
8
  boxgrinder-build.gemspec
8
9
  integ/appliances/gnome-fedora.appl
@@ -78,13 +79,11 @@ lib/boxgrinder-build/plugins/platform/vmware/src/README-personal
78
79
  lib/boxgrinder-build/plugins/platform/vmware/src/base.vmdk
79
80
  lib/boxgrinder-build/plugins/platform/vmware/src/base.vmx
80
81
  lib/boxgrinder-build/plugins/platform/vmware/vmware-plugin.rb
82
+ lib/boxgrinder-build/util/concurrent/get_set.rb
83
+ lib/boxgrinder-build/util/permissions/fs-monitor.rb
84
+ lib/boxgrinder-build/util/permissions/fs-observer.rb
85
+ lib/boxgrinder-build/util/permissions/user-switcher.rb
81
86
  rubygem-boxgrinder-build.spec
82
87
  spec/appliance-spec.rb
83
88
  spec/helpers/augeas-helper-spec.rb
84
- spec/helpers/ec2-helper-spec.rb
85
- spec/helpers/guestfs-helper-spec.rb
86
- spec/helpers/image-helper-spec.rb
87
- spec/helpers/linux-helper-spec.rb
88
- spec/helpers/package-helper-spec.rb
89
- spec/helpers/plugin-helper-spec.rb
90
- spec/helpers/s3-helper-spe
89
+ spec/help
data/Rakefile CHANGED
@@ -40,7 +40,7 @@ desc "Run all integration tests"
40
40
  RSpec::Core::RakeTask.new('integ') do |t|
41
41
  t.rcov = false
42
42
  t.pattern = "integ/**/*-spec.rb"
43
- t.rspec_opts = ['--colour', '--format', 'doc', '-b']
43
+ t.rspec_opts = ['-r boxgrinder-core', '-r rubygems', '--colour', '--format', 'doc', '-b']
44
44
  t.verbose = true
45
45
  end
46
46
 
@@ -49,16 +49,21 @@ RSpec::Core::RakeTask.new('spec') do |t|
49
49
  t.ruby_opts = "-I ../boxgrinder-core/lib"
50
50
  t.rcov = false
51
51
  t.pattern = "spec/**/*-spec.rb"
52
- t.rspec_opts = ['--colour', '--format', 'doc', '-b']
52
+ t.rspec_opts = ['-r boxgrinder-core', '-r rubygems', '--colour', '--format', 'doc', '-b']
53
53
  t.verbose = true
54
54
  end
55
55
 
56
- desc "Run all tests and generate code coverage report"
57
56
  RSpec::Core::RakeTask.new('spec:coverage') do |t|
58
57
  t.ruby_opts = "-I ../boxgrinder-core/lib"
59
58
  t.pattern = "spec/**/*-spec.rb"
60
- t.rspec_opts = ['--colour', '--format', 'html', '--out', 'pkg/rspec_report.html', '-b']
61
- t.rcov = true
62
- t.rcov_opts = ['--exclude', 'spec,teamcity/*,/usr/lib/ruby/,.gem/ruby,/boxgrinder-core/,/gems/']
59
+ t.rspec_opts = ['-r spec_helper', '-r boxgrinder-core', '-r rubygems', '--colour',
60
+ '--format', 'html', '--out', 'pkg/rspec_report.html', '-b']
63
61
  t.verbose = true
62
+
63
+ if RUBY_VERSION =~ /^1.8/
64
+ t.rcov = true
65
+ t.rcov_opts = ["-Ispec:lib spec/rcov_helper.rb", '--exclude', 'spec,teamcity/*,/usr/lib/ruby/,.gem/ruby,/boxgrinder-build/,/gems/']
66
+ else
67
+ ENV['COVERAGE'] = 'true'
68
+ end
64
69
  end
data/bash_completion ADDED
@@ -0,0 +1,37 @@
1
+ _boxgrinder-build()
2
+ {
3
+ local cur prev opts
4
+ COMPREPLY=()
5
+ cur="${COMP_WORDS[COMP_CWORD]}"
6
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
7
+ opts="--help --version --platform --delivery --force --os-config --platform-config --delivery-config --plugins --debug --trace --backtrace"
8
+
9
+ if [[ ${cur} == -* ]] ; then
10
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
11
+ return 0
12
+ fi
13
+
14
+ case "${prev}" in
15
+ --os-config|--platform-config|--delivery-config|-l|--plugins)
16
+ return 0
17
+ ;;
18
+ -p|--platform)
19
+ local platform="ec2 virtualbox virtualpc vmware"
20
+ COMPREPLY=($(compgen -W "${platform}" -- ${cur}))
21
+ ;;
22
+ -d|--delivery)
23
+ local delivery="ami cloudfront ebs elastichosts libvirt local openstack s3 sftp"
24
+ COMPREPLY=($(compgen -W "${delivery}" -- ${cur}))
25
+ ;;
26
+ *)
27
+ if [[ ${COMP_CWORD} -eq 1 ]]; then
28
+ _filedir appl
29
+ else
30
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
31
+ fi
32
+ ;;
33
+ esac
34
+ }
35
+
36
+ complete -F _boxgrinder-build boxgrinder-build
37
+
data/bin/boxgrinder-build CHANGED
@@ -26,13 +26,17 @@ require 'boxgrinder-core/models/config'
26
26
  require 'boxgrinder-core/helpers/log-helper'
27
27
  require 'boxgrinder-build/appliance'
28
28
 
29
+ require 'boxgrinder-build/util/permissions/fs-observer'
30
+ require 'boxgrinder-build/util/permissions/fs-monitor'
31
+
29
32
  options = OpenCascade.new(
30
33
  :platform => :none,
31
34
  :delivery => :none,
32
35
  :os_config => {},
33
36
  :platform_config => {},
34
37
  :delivery_config => {},
35
- :additional_plugins => []
38
+ :additional_plugins => [],
39
+ :change_to_user => false
36
40
  )
37
41
 
38
42
  ARGV_DUP = ARGV.clone
@@ -135,6 +139,7 @@ EOB
135
139
  puts opts
136
140
  exit
137
141
  end
142
+
138
143
  opts.on_tail('--version', 'Print the version.') do
139
144
  puts "BoxGrinder Build #{File.read("#{File.dirname(__FILE__)}/../CHANGELOG").match(/^v(.*)/)[1]}"
140
145
 
@@ -148,16 +153,20 @@ EOB
148
153
 
149
154
  exit
150
155
  end
156
+
157
+ opts.on('--change-to-user', 'Change from root to local user after the OS plugin completes.') do
158
+ options[:change_to_user] = true
159
+ end
151
160
  end
152
161
  end
153
162
 
154
163
  def ensure_root
155
164
  unless Process.uid == 0
156
- puts("Currently running as non-root user, BoxGrinder will attempt to re-launch under 'sudo -E'")
165
+ puts("Currently running as non-root user, BoxGrinder will re-launch under `sudo -E` and change to your local user after the OS plugin.")
157
166
  # http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/151376
158
- ruby = File.join(Config::CONFIG["bindir"],
159
- Config::CONFIG["RUBY_INSTALL_NAME"] + Config::CONFIG["EXEEXT"])
160
- exec("sudo -E #{ruby} -I#{$:.join(':')} #{Pathname.new(__FILE__).realpath} #{ARGV_DUP.join(" ")}")
167
+ ruby = File.join(RbConfig::CONFIG["bindir"],
168
+ RbConfig::CONFIG["RUBY_INSTALL_NAME"] + RbConfig::CONFIG["EXEEXT"])
169
+ exec("sudo -E #{ruby} -I#{$:.join(':')} #{Pathname.new(__FILE__).realpath} #{ARGV_DUP.join(" ")} --change-to-user")
161
170
  end
162
171
  end
163
172
 
@@ -183,6 +192,10 @@ begin
183
192
  end
184
193
 
185
194
  config = BoxGrinder::Config.new(options)
195
+ # Begin monitoring.
196
+ observer = config.change_to_user ? BoxGrinder::FSObserver.new(config.uid, config.gid) : nil
197
+ BoxGrinder::FSMonitor.instance.capture(observer)
198
+
186
199
  log = BoxGrinder::LogHelper.new(:level => config.log_level)
187
200
 
188
201
  begin
@@ -201,4 +214,6 @@ rescue => e
201
214
  puts
202
215
  puts e.message
203
216
  abort
217
+ ensure
218
+ BoxGrinder::FSMonitor.instance.stop
204
219
  end
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "boxgrinder-build"
5
- s.version = "0.10.0"
5
+ s.version = "0.10.1"
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 = "2011-12-19"
9
+ s.date = "2012-03-19"
10
10
  s.description = "A tool for creating appliances from simple plain text files for various virtual environments."
11
11
  s.email = "info@boxgrinder.org"
12
12
  s.executables = ["boxgrinder-build"]
13
- 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/helpers/sftp-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/libvirt/libvirt-capabilities.rb", "lib/boxgrinder-build/plugins/delivery/libvirt/libvirt-plugin.rb", "lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb", "lib/boxgrinder-build/plugins/delivery/openstack/openstack-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/virtualpc/virtualpc-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"]
14
- s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.md", "Rakefile", "bin/boxgrinder-build", "integ/appliances/gnome-fedora.appl", "integ/appliances/jeos-centos5-files.appl", "integ/appliances/jeos-centos5.appl", "integ/appliances/jeos-centos6.appl", "integ/appliances/jeos-f15.appl", "integ/appliances/jeos-f16-files.appl", "integ/appliances/jeos-f16.appl", "integ/appliances/modular/_hardware_cpus.appl", "integ/appliances/modular/_hardware_memory.appl", "integ/appliances/modular/_hardware_partitions_home.appl", "integ/appliances/modular/_hardware_partitions_root.appl", "integ/appliances/modular/_os_password.appl", "integ/appliances/modular/_packages_groups_base.appl", "integ/appliances/modular/_packages_groups_core.appl", "integ/appliances/modular/_packages_squid.appl", "integ/appliances/modular/_packages_utils.appl", "integ/appliances/modular/_repos_boxgrinder_permanent_noarch.appl", "integ/appliances/modular/_repos_testlocal_ephemeral_noarch.appl", "integ/appliances/modular/_test_base.appl", "integ/appliances/modular/modular.appl", "integ/packages/ephemeral-repo-test-0.1-1.noarch.rpm", "integ/packages/local-repo-test.spec", "integ/spec/files-spec.rb", "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/helpers/sftp-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/libvirt/libvirt-capabilities.rb", "lib/boxgrinder-build/plugins/delivery/libvirt/libvirt-plugin.rb", "lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb", "lib/boxgrinder-build/plugins/delivery/openstack/openstack-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/virtualpc/virtualpc-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/libvirt/libvirt-plugin-spec.rb", "spec/plugins/delivery/libvirt/libvirt_modified.xml", "spec/plugins/delivery/libvirt/libvirt_modify.sh", "spec/plugins/delivery/libvirt/libvirt_test.xml", "spec/plugins/delivery/local/local-plugin-spec.rb", "spec/plugins/delivery/openstack/openstack-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/virtualpc/virtualpc-plugin-spec.rb", "spec/plugins/platform/vmware/vmware-plugin-spec.rb", "spec/rspec-plugin-helper.rb", "boxgrinder-build.gemspec"]
13
+ 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/helpers/sftp-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/libvirt/libvirt-capabilities.rb", "lib/boxgrinder-build/plugins/delivery/libvirt/libvirt-plugin.rb", "lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb", "lib/boxgrinder-build/plugins/delivery/openstack/openstack-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/virtualpc/virtualpc-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", "lib/boxgrinder-build/util/concurrent/get_set.rb", "lib/boxgrinder-build/util/permissions/fs-monitor.rb", "lib/boxgrinder-build/util/permissions/fs-observer.rb", "lib/boxgrinder-build/util/permissions/user-switcher.rb"]
14
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.md", "Rakefile", "bash_completion", "bin/boxgrinder-build", "boxgrinder-build.gemspec", "integ/appliances/gnome-fedora.appl", "integ/appliances/jeos-centos5-files.appl", "integ/appliances/jeos-centos5.appl", "integ/appliances/jeos-centos6.appl", "integ/appliances/jeos-f15.appl", "integ/appliances/jeos-f16-files.appl", "integ/appliances/jeos-f16.appl", "integ/appliances/modular/_hardware_cpus.appl", "integ/appliances/modular/_hardware_memory.appl", "integ/appliances/modular/_hardware_partitions_home.appl", "integ/appliances/modular/_hardware_partitions_root.appl", "integ/appliances/modular/_os_password.appl", "integ/appliances/modular/_packages_groups_base.appl", "integ/appliances/modular/_packages_groups_core.appl", "integ/appliances/modular/_packages_squid.appl", "integ/appliances/modular/_packages_utils.appl", "integ/appliances/modular/_repos_boxgrinder_permanent_noarch.appl", "integ/appliances/modular/_repos_testlocal_ephemeral_noarch.appl", "integ/appliances/modular/_test_base.appl", "integ/appliances/modular/modular.appl", "integ/packages/ephemeral-repo-test-0.1-1.noarch.rpm", "integ/packages/local-repo-test.spec", "integ/spec/files-spec.rb", "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/helpers/sftp-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/libvirt/libvirt-capabilities.rb", "lib/boxgrinder-build/plugins/delivery/libvirt/libvirt-plugin.rb", "lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb", "lib/boxgrinder-build/plugins/delivery/openstack/openstack-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/virtualpc/virtualpc-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", "lib/boxgrinder-build/util/concurrent/get_set.rb", "lib/boxgrinder-build/util/permissions/fs-monitor.rb", "lib/boxgrinder-build/util/permissions/fs-observer.rb", "lib/boxgrinder-build/util/permissions/user-switcher.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/libvirt/libvirt-plugin-spec.rb", "spec/plugins/delivery/libvirt/libvirt_modified.xml", "spec/plugins/delivery/libvirt/libvirt_modify.sh", "spec/plugins/delivery/libvirt/libvirt_test.xml", "spec/plugins/delivery/local/local-plugin-spec.rb", "spec/plugins/delivery/openstack/openstack-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/virtualpc/virtualpc-plugin-spec.rb", "spec/plugins/platform/vmware/vmware-plugin-spec.rb", "spec/rcov_helper.rb", "spec/rspec-plugin-helper.rb", "spec/spec_helper.rb", "spec/util/concurrent/get-set-spec.rb", "spec/util/permissions/fs-monitor-spec.rb", "spec/util/permissions/fs-observer-spec.rb", "spec/util/permissions/user-switcher-spec.rb"]
15
15
  s.homepage = "http://boxgrinder.org/"
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Boxgrinder-build", "--main", "README.md"]
17
17
  s.require_paths = ["lib"]
@@ -16,4 +16,5 @@
16
16
  # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17
17
  # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18
18
 
19
- require 'boxgrinder-build/appliance'
19
+ require 'boxgrinder-core'
20
+ require 'boxgrinder-build/appliance'
@@ -25,6 +25,9 @@ require 'boxgrinder-core/helpers/appliance-definition-helper'
25
25
  require 'boxgrinder-core/helpers/appliance-config-helper'
26
26
  require 'boxgrinder-build/helpers/plugin-helper'
27
27
  require 'boxgrinder-build/managers/plugin-manager'
28
+ require 'boxgrinder-build/util/permissions/fs-monitor'
29
+ require 'boxgrinder-build/util/permissions/fs-observer'
30
+ require 'boxgrinder-build/util/permissions/user-switcher'
28
31
 
29
32
  module BoxGrinder
30
33
  class Appliance
@@ -72,7 +75,7 @@ module BoxGrinder
72
75
 
73
76
  if delivery_selected?
74
77
  delivery_plugin, delivery_plugin_info = PluginManager.instance.initialize_plugin(:delivery, @config.delivery)
75
- # Here we need to specify additionaly the type of the plugin, as some delivery plugins
78
+ # Here we need to specify additionally the type of the plugin, as some delivery plugins
76
79
  # can have multiple types of delivery implemented. See s3-plugin.rb for example.
77
80
  initialize_plugin(delivery_plugin, delivery_plugin_info, :type => @config.delivery)
78
81
  end
@@ -118,7 +121,14 @@ module BoxGrinder
118
121
 
119
122
  def execute_plugin_chain
120
123
  @log.info "Building '#{@appliance_config.name}' appliance for #{@appliance_config.hardware.arch} architecture."
121
- @plugin_chain.each { |p| execute_plugin(p[:plugin], p[:param]) }
124
+
125
+ @plugin_chain.each do |p|
126
+ if @config.change_to_user
127
+ execute_with_userchange(p)
128
+ else
129
+ execute_without_userchange(p)
130
+ end
131
+ end
122
132
  end
123
133
 
124
134
  # This creates the appliance by executing the plugin chain.
@@ -127,7 +137,7 @@ module BoxGrinder
127
137
  # and every plugin in the chain is initialized and validated. The next step
128
138
  # is the execution of the plugin chain, step by step.
129
139
  #
130
- # Below you can find the whole process of bootstraping a plugin.
140
+ # Below you can find the whole process of bootstrapping a plugin.
131
141
  #
132
142
  # Call Scope
133
143
  # ------------------------------------------
@@ -178,31 +188,23 @@ module BoxGrinder
178
188
 
179
189
  @log.debug "#{plugin.plugin_info[:type].to_s.capitalize} plugin executed."
180
190
  end
181
- if plugin.plugin_info[:type] == :os
182
- FileUtils.chown_R(@config.uid, @config.gid, File.join(@config.dir.root, @config.dir.build))
183
- @log.debug "Lowering from root to user."
184
- change_user(@config.uid, @config.gid)
185
- end
186
191
  end
187
192
 
188
- def change_user(u, g)
189
- begin
190
- if Process::Sys.respond_to?(:setresgid) && Process::Sys.respond_to?(:setresuid)
191
- Process::Sys.setresgid(g, g, g)
192
- Process::Sys.setresuid(u, u, u)
193
- return
194
- end
195
- rescue NotImplementedError
196
- end
193
+ private
197
194
 
198
- begin
199
- # JRuby doesn't support saved ids, use this instead.
200
- Process.gid = g
201
- Process.egid = g
202
- Process.uid = u
203
- Process.euid = u
204
- rescue NotImplementedError
195
+ def execute_with_userchange(p)
196
+ # Set ids to root if the next plugin requires root permissions
197
+ uid, gid = p[:plugin].plugin_info[:require_root] ? [0, 0] : [@config.uid, @config.gid]
198
+
199
+ UserSwitcher.change_user(uid, gid) do
200
+ execute_plugin(p[:plugin], p[:param])
205
201
  end
202
+ # Trigger ownership change before next plugin
203
+ FSMonitor.instance.trigger
204
+ end
205
+
206
+ def execute_without_userchange(p)
207
+ execute_plugin(p[:plugin], p[:param])
206
208
  end
207
209
  end
208
210
  end
@@ -47,7 +47,7 @@ module BoxGrinder
47
47
 
48
48
  unload = []
49
49
 
50
- @files.keys.each do |file_name|
50
+ @files.keys.sort.each do |file_name|
51
51
  unload << ". != '#{file_name}'"
52
52
  end
53
53
 
@@ -191,8 +191,8 @@ module BoxGrinder
191
191
  :endpoint => 'ec2.sa-east-1.amazonaws.com',
192
192
  :location => 'sa-east-1',
193
193
  :kernel => {
194
- :i386 => {:aki => 'aki-803ce39d'},
195
- :x86_64 => {:aki => 'aki-d03ce3cd'}
194
+ :i386 => {:aki => 'aki-863ce39b'},
195
+ :x86_64 => {:aki => 'aki-d63ce3cb'}
196
196
  }
197
197
  }
198
198
  }
@@ -27,7 +27,7 @@ require 'timeout'
27
27
  module BoxGrinder
28
28
  class GuestFSHelper
29
29
  def initialize(disks, appliance_config, config, options = {})
30
- @disks = disks
30
+ @disks = Array(disks)
31
31
  @appliance_config = appliance_config
32
32
  @config = config
33
33
  @log = options[:log] || LogHelper.new
@@ -127,8 +127,8 @@ module BoxGrinder
127
127
  :endpoint => 's3-sa-east-1.amazonaws.com',
128
128
  :location => 'sa-east-1',
129
129
  :kernel => {
130
- :i386 => {:aki => 'aki-803ce39d'},
131
- :x86_64 => {:aki => 'aki-d03ce3cd'}
130
+ :i386 => {:aki => 'aki-863ce39b'},
131
+ :x86_64 => {:aki => 'aki-d63ce3cb'}
132
132
  }
133
133
  }
134
134
  }
@@ -38,7 +38,7 @@ module BoxGrinder
38
38
  end
39
39
 
40
40
  def register_plugin(clazz, info)
41
- info.merge!(:class => clazz)
41
+ info = {:class => clazz, :require_root => false}.merge(info)
42
42
 
43
43
  validate_plugin_info(info)
44
44
 
@@ -32,7 +32,7 @@ module BoxGrinder
32
32
  TIMEOUT = 1000 #seconds
33
33
  EC2_HOSTNAME_LOOKUP_TIMEOUT = 10
34
34
 
35
- plugin :type => :delivery, :name => :ebs, :full_name => "Elastic Block Storage"
35
+ plugin :type => :delivery, :name => :ebs, :full_name => "Elastic Block Storage", :require_root => true
36
36
 
37
37
  def validate
38
38
  @ec2_endpoints = EC2Helper::endpoints
@@ -52,7 +52,7 @@ module BoxGrinder
52
52
  def hash_to_request(h)
53
53
  body = ""
54
54
 
55
- h.each do |k, v|
55
+ h.sort.each do |k, v|
56
56
  body << "#{k} #{v.to_s}\n"
57
57
  end
58
58
 
@@ -205,7 +205,7 @@ module BoxGrinder
205
205
  @log.info "Server was registered with '#{ret['name']}' name as '#{ret['server']}' UUID. Use web UI or API tools to start your server."
206
206
  rescue => e
207
207
  @log.error e.info
208
- raise PluginError, "An error occured while creating the server, #{e.message}. See logs for more info."
208
+ raise PluginError, "An error occurred while creating the server, #{e.message}. See logs for more info."
209
209
  end
210
210
  end
211
211
  end
@@ -68,12 +68,12 @@ module BoxGrinder
68
68
 
69
69
  if @previous_plugin_info[:type] == :platform
70
70
  case @previous_plugin_info[:name]
71
- when :ec2:
71
+ when :ec2
72
72
  disk_format = :ami
73
73
  container_format = :ami
74
- when :vmware:
74
+ when :vmware
75
75
  disk_format = :vmdk
76
- when :virtualbox:
76
+ when :virtualbox
77
77
  disk_format = :vmdk
78
78
  end
79
79
  end
@@ -75,7 +75,7 @@ module BoxGrinder
75
75
  # If there is an existing bucket, determine whether its location_constraint matches the region selected
76
76
  if existing_bucket = asset_bucket(false)
77
77
  raise PluginValidationError, "Existing bucket #{@plugin_config['bucket']} has a location constraint that does not match the region selected. " <<
78
- "AMI region and bucket location constraint must match." unless constraint_equal?(@s3_endpoints[@plugin_config['region']][:location], existing_bucket.location_constraint)
78
+ "AMI region and bucket location constraint must match." unless constraint_equal?(@plugin_config['region'], existing_bucket.location_constraint)
79
79
  end
80
80
  end
81
81
 
@@ -175,7 +175,16 @@ module BoxGrinder
175
175
  def upload_image(ami_dir)
176
176
  @log.info "Uploading #{@appliance_config.name} AMI to bucket '#{@plugin_config['bucket']}'..."
177
177
 
178
- @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']])
178
+ endpoint = @plugin_config['url'] || "http://#{@s3_endpoints[@plugin_config['region']][:endpoint]}"
179
+
180
+ cmd_str = "euca-upload-bundle " <<
181
+ "-U #{endpoint} " <<
182
+ "-b #{@plugin_config['bucket']}/#{ami_dir} " <<
183
+ "-m #{@ami_manifest} " <<
184
+ "-a #{@plugin_config['access_key']} " <<
185
+ "-s #{@plugin_config['secret_access_key']}"
186
+
187
+ @exec_helper.execute(cmd_str, :redacted => [@plugin_config['access_key'], @plugin_config['secret_access_key']])
179
188
  end
180
189
 
181
190
  def register_image(ami_manifest_key)
@@ -212,21 +221,18 @@ module BoxGrinder
212
221
 
213
222
  @log.info "Determining snapshot name"
214
223
  snapshot = 1
215
- while @s3helper.stub_s3obj(@bucket, "#{base_path}-SNAPSHOT-#{snapshot}/#{@appliance_config.hardware.arch}/").exists?
224
+ while @s3helper.stub_s3obj(@bucket, "#{base_path}-snapshot-#{snapshot}/#{@appliance_config.hardware.arch}/").exists?
216
225
  snapshot += 1
217
226
  end
218
227
  # Reuse the last key (if there was one)
219
228
  snapshot -=1 if snapshot > 1 and @plugin_config['overwrite']
220
229
 
221
- "#{base_path}-SNAPSHOT-#{snapshot}/#{@appliance_config.hardware.arch}"
230
+ "#{base_path}-snapshot-#{snapshot}/#{@appliance_config.hardware.arch}"
222
231
  end
223
232
 
224
- #US constraint is often represented as '' or nil
225
- def constraint_equal?(a, b)
226
- [a, b].collect!{|c| c.nil? ? '': c}
227
- a == b
233
+ # US default constraint is often represented as '' or nil
234
+ def constraint_equal?(region, constraint)
235
+ [region, constraint].collect{ |v| v.nil? || v == '' ? 'us-east-1' : v }.reduce(:==)
228
236
  end
229
-
230
237
  end
231
238
  end
232
-