boxgrinder-build 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/Manifest +0 -31
- data/README +2 -2
- data/Rakefile +1 -1
- data/bin/boxgrinder +11 -4
- data/boxgrinder-build.gemspec +5 -5
- data/lib/boxgrinder-build/appliance.rb +6 -2
- data/lib/boxgrinder-build/helpers/guestfs-helper.rb +3 -6
- data/lib/boxgrinder-build/helpers/thor-helper.rb +4 -1
- data/lib/boxgrinder-build/plugins/base-plugin.rb +0 -3
- data/rubygem-boxgrinder-build.spec +12 -4
- data/spec/appliance-spec.rb +9 -8
- data/spec/helpers/guestfs-helper-spec.rb +3 -9
- metadata +7 -7
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
v0.8.1
|
2
|
+
|
3
|
+
* [BGBUILD-141] Long delay after "Preparing guestfs" message when creating new image
|
4
|
+
* [BGBUILD-150] Cyclical inclusion dependencies in appliance definition files are not detected/handled
|
5
|
+
* [BGBUILD-165] Use version in dependencies in gem and in RPM only where necessary
|
6
|
+
|
1
7
|
v0.8.0
|
2
8
|
|
3
9
|
* [BGBUILD-138] enablerepo path is not escaped when calling repoquery
|
data/Manifest
CHANGED
@@ -1,31 +0,0 @@
|
|
1
|
-
CHANGELOG
|
2
|
-
LICENSE
|
3
|
-
Manifest
|
4
|
-
README
|
5
|
-
Rakefile
|
6
|
-
bin/boxgrinder
|
7
|
-
boxgrinder-build.gemspec
|
8
|
-
lib/boxgrinder-build.rb
|
9
|
-
lib/boxgrinder-build/appliance.rb
|
10
|
-
lib/boxgrinder-build/helpers/appliance-customize-helper.rb
|
11
|
-
lib/boxgrinder-build/helpers/augeas-helper.rb
|
12
|
-
lib/boxgrinder-build/helpers/guestfs-helper.rb
|
13
|
-
lib/boxgrinder-build/helpers/image-helper.rb
|
14
|
-
lib/boxgrinder-build/helpers/linux-helper.rb
|
15
|
-
lib/boxgrinder-build/helpers/package-helper.rb
|
16
|
-
lib/boxgrinder-build/helpers/plugin-helper.rb
|
17
|
-
lib/boxgrinder-build/helpers/thor-helper.rb
|
18
|
-
lib/boxgrinder-build/managers/plugin-manager.rb
|
19
|
-
lib/boxgrinder-build/plugins/base-plugin.rb
|
20
|
-
rubygem-boxgrinder-build.spec
|
21
|
-
spec/Rakefile
|
22
|
-
spec/appliance-spec.rb
|
23
|
-
spec/helpers/appliance-customize-helper-spec.rb
|
24
|
-
spec/helpers/augeas-helper-spec.rb
|
25
|
-
spec/helpers/guestfs-helper-spec.rb
|
26
|
-
spec/helpers/image-helper-spec.rb
|
27
|
-
spec/helpers/linux-helper-spec.rb
|
28
|
-
spec/helpers/package-helper-spec.rb
|
29
|
-
spec/helpers/plugin-helper-spec.rb
|
30
|
-
spec/managers/plugin-manager-spec.rb
|
31
|
-
spec/plugins/base-plugin-spec.rb
|
data/README
CHANGED
data/Rakefile
CHANGED
@@ -26,7 +26,7 @@ Echoe.new("boxgrinder-build") do |p|
|
|
26
26
|
p.summary = "A tool for creating appliances from simple plain text files for various virtual environments."
|
27
27
|
p.url = "http://www.jboss.org/boxgrinder"
|
28
28
|
p.email = "info@boxgrinder.org"
|
29
|
-
p.runtime_dependencies = ["thor >=0.13", "boxgrinder-core ~>0.2.
|
29
|
+
p.runtime_dependencies = ["thor >=0.13", "boxgrinder-core ~>0.2.1"]
|
30
30
|
end
|
31
31
|
|
32
32
|
desc "Run all tests"
|
data/bin/boxgrinder
CHANGED
@@ -25,7 +25,7 @@ require 'boxgrinder-build/helpers/thor-helper'
|
|
25
25
|
#$stderr.reopen($stdout)
|
26
26
|
|
27
27
|
if Process.uid != 0
|
28
|
-
puts "This program must be executed with root privileges. Try 'sudo boxgrinder
|
28
|
+
puts "This program must be executed with root privileges. Try 'sudo boxgrinder'"
|
29
29
|
abort
|
30
30
|
end
|
31
31
|
|
@@ -41,10 +41,13 @@ module BoxGrinder
|
|
41
41
|
method_option :force, :type => :boolean, :default => false, :aliases => '-f', :desc => "Force image creation - removes all previous builds for selected appliance. Default: false."
|
42
42
|
method_option :debug, :type => :boolean, :default => false, :desc => "Prints debug information while building. Default: false."
|
43
43
|
method_option :trace, :type => :boolean, :default => false, :desc => "Prints trace information while building. Default: false."
|
44
|
+
method_option :backtrace, :type => :boolean, :default => false, :aliases => '-b', :desc => "Prints full backtrace if errors occur whilst building. Default: true if -debug or -trace, else false."
|
44
45
|
|
45
46
|
def build(appliance_definition_file)
|
46
47
|
log_level = :debug if options.debug?
|
47
48
|
log_level = :trace if options.trace?
|
49
|
+
#TODO want to be able to compare log levels like Logger::LVL_X<=>Logger::LVL_Y (as with inbuilt logger CONST values)
|
50
|
+
backtrace = options.backtrace || !log_level.nil?
|
48
51
|
|
49
52
|
config = Config.new(options.merge(:platform => options.platform.to_sym, :delivery => options.delivery.to_sym))
|
50
53
|
config.merge!(:log_level => log_level) unless log_level.nil?
|
@@ -59,7 +62,12 @@ module BoxGrinder
|
|
59
62
|
begin
|
60
63
|
Appliance.new(appliance_definition_file, config, :log => log).create
|
61
64
|
rescue Exception => e
|
62
|
-
|
65
|
+
if backtrace
|
66
|
+
log.fatal e
|
67
|
+
else #demote backtrace to debug so that it is in file log only
|
68
|
+
log.fatal e.message
|
69
|
+
log.debug e.backtrace.join($/)
|
70
|
+
end
|
63
71
|
end
|
64
72
|
end
|
65
73
|
|
@@ -117,5 +125,4 @@ begin
|
|
117
125
|
BoxGrinder::App.start
|
118
126
|
rescue Thor::Error => e
|
119
127
|
puts e.message
|
120
|
-
end
|
121
|
-
|
128
|
+
end
|
data/boxgrinder-build.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{boxgrinder-build}
|
5
|
-
s.version = "0.8.
|
5
|
+
s.version = "0.8.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 = %q{2011-02-
|
9
|
+
s.date = %q{2011-02-22}
|
10
10
|
s.default_executable = %q{boxgrinder}
|
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}
|
@@ -26,13 +26,13 @@ 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<thor>, [">= 0.13"])
|
29
|
-
s.add_runtime_dependency(%q<boxgrinder-core>, ["~> 0.2.
|
29
|
+
s.add_runtime_dependency(%q<boxgrinder-core>, ["~> 0.2.1"])
|
30
30
|
else
|
31
31
|
s.add_dependency(%q<thor>, [">= 0.13"])
|
32
|
-
s.add_dependency(%q<boxgrinder-core>, ["~> 0.2.
|
32
|
+
s.add_dependency(%q<boxgrinder-core>, ["~> 0.2.1"])
|
33
33
|
end
|
34
34
|
else
|
35
35
|
s.add_dependency(%q<thor>, [">= 0.13"])
|
36
|
-
s.add_dependency(%q<boxgrinder-core>, ["~> 0.2.
|
36
|
+
s.add_dependency(%q<boxgrinder-core>, ["~> 0.2.1"])
|
37
37
|
end
|
38
38
|
end
|
@@ -21,7 +21,7 @@ require 'hashery/opencascade'
|
|
21
21
|
require 'boxgrinder-core/helpers/log-helper'
|
22
22
|
require 'boxgrinder-core/models/appliance-config'
|
23
23
|
require 'boxgrinder-core/models/config'
|
24
|
-
require 'boxgrinder-core/helpers/appliance-helper'
|
24
|
+
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'
|
@@ -38,7 +38,11 @@ module BoxGrinder
|
|
38
38
|
def read_definition
|
39
39
|
begin
|
40
40
|
# first try to read as appliance definition file
|
41
|
-
|
41
|
+
appliance_helper = ApplianceDefinitionHelper.new(:log => @log)
|
42
|
+
appliance_helper.read_definitions(@appliance_definition)
|
43
|
+
|
44
|
+
appliance_configs = appliance_helper.appliance_configs
|
45
|
+
appliance_config = appliance_configs.first
|
42
46
|
rescue
|
43
47
|
# then try to read OS plugin specific format
|
44
48
|
PluginManager.instance.plugins[:os].each_value do |info|
|
@@ -19,9 +19,8 @@
|
|
19
19
|
require 'boxgrinder-build/helpers/augeas-helper'
|
20
20
|
require 'boxgrinder-core/helpers/log-helper'
|
21
21
|
require 'guestfs'
|
22
|
-
require 'open-uri'
|
23
|
-
require 'timeout'
|
24
22
|
require 'rbconfig'
|
23
|
+
require 'resolv'
|
25
24
|
|
26
25
|
module BoxGrinder
|
27
26
|
class SilencerProxy
|
@@ -94,10 +93,8 @@ module BoxGrinder
|
|
94
93
|
@log.trace "Checking if HW virtualization is available..."
|
95
94
|
|
96
95
|
begin
|
97
|
-
|
98
|
-
|
99
|
-
ec2 = true
|
100
|
-
rescue Exception
|
96
|
+
ec2 = Resolv.getname("169.254.169.254").include?(".ec2.internal")
|
97
|
+
rescue Resolv::ResolvError
|
101
98
|
ec2 = false
|
102
99
|
end
|
103
100
|
|
@@ -73,8 +73,11 @@ module BoxGrinder
|
|
73
73
|
shell.say "BoxGrinder Build:"
|
74
74
|
shell.say " A tool for building VM images from simple definition files."
|
75
75
|
shell.say
|
76
|
+
shell.say "Homepage:"
|
77
|
+
shell.say " http://boxgrinder.org/"
|
78
|
+
shell.say
|
76
79
|
shell.say "Documentation:"
|
77
|
-
shell.say " http://
|
80
|
+
shell.say " http://boxgrinder.org/tutorials/"
|
78
81
|
shell.say
|
79
82
|
end
|
80
83
|
end
|
@@ -171,9 +171,6 @@ module BoxGrinder
|
|
171
171
|
# This reads the plugin config from file
|
172
172
|
def read_plugin_config
|
173
173
|
return if @config[:plugins].nil? or @config[:plugins][@plugin_info[:name].to_s].nil?
|
174
|
-
|
175
|
-
@log.debug "Reading configuration for #{@plugin_info[:full_name]} plugin."
|
176
|
-
|
177
174
|
@plugin_config = @config[:plugins][@plugin_info[:name].to_s]
|
178
175
|
end
|
179
176
|
|
@@ -5,24 +5,26 @@
|
|
5
5
|
|
6
6
|
Summary: A tool for creating appliances from simple plain text files
|
7
7
|
Name: rubygem-%{gemname}
|
8
|
-
Version: 0.8.
|
8
|
+
Version: 0.8.1
|
9
9
|
Release: 1%{?dist}
|
10
10
|
Group: Development/Languages
|
11
11
|
License: LGPLv3+
|
12
|
-
URL: http://
|
12
|
+
URL: http://boxgrinder.org/
|
13
13
|
Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem
|
14
14
|
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
15
15
|
|
16
16
|
Requires: ruby(abi) = %{rubyabi}
|
17
17
|
Requires: rubygem(thor)
|
18
|
-
Requires: rubygem(boxgrinder-core) >= 0.2.
|
18
|
+
Requires: rubygem(boxgrinder-core) >= 0.2.1
|
19
|
+
Requires: rubygem(boxgrinder-core) < 0.3.0
|
19
20
|
Requires: ruby-libguestfs
|
20
21
|
Requires: parted
|
21
22
|
Requires: e2fsprogs
|
22
23
|
|
23
24
|
BuildRequires: rubygem(rake)
|
24
25
|
BuildRequires: rubygem(rspec)
|
25
|
-
BuildRequires: rubygem(boxgrinder-core) >= 0.2.
|
26
|
+
BuildRequires: rubygem(boxgrinder-core) >= 0.2.1
|
27
|
+
BuildRequires: rubygem(boxgrinder-core) < 0.3.0
|
26
28
|
BuildRequires: rubygem(echoe)
|
27
29
|
BuildRequires: ruby-libguestfs
|
28
30
|
|
@@ -86,6 +88,12 @@ popd
|
|
86
88
|
%{gemdir}/doc/%{gemname}-%{version}
|
87
89
|
|
88
90
|
%changelog
|
91
|
+
* Tue Feb 16 2011 <mgoldman@redhat.com> - 0.8.1-1
|
92
|
+
- Upstream release: 0.8.1
|
93
|
+
- [BGBUILD-141] Long delay after "Preparing guestfs" message when creating new image
|
94
|
+
- [BGBUILD-150] Cyclical inclusion dependencies in appliance definition files are not detected/handled
|
95
|
+
- [BGBUILD-165] Use version in dependencies in gem and in RPM only where necessary
|
96
|
+
|
89
97
|
* Tue Jan 04 2011 <mgoldman@redhat.com> - 0.8.0-1
|
90
98
|
- Upstream release: 0.8.0
|
91
99
|
- Added BuildRoot tag to build for EPEL 5
|
data/spec/appliance-spec.rb
CHANGED
@@ -120,10 +120,11 @@ module BoxGrinder
|
|
120
120
|
|
121
121
|
appliance_config = ApplianceConfig.new
|
122
122
|
|
123
|
-
appliance_helper = mock(
|
124
|
-
appliance_helper.should_receive(:read_definitions).with("#{File.dirname(__FILE__)}/rspec/src/appliances/jeos-f13.appl")
|
123
|
+
appliance_helper = mock(ApplianceDefinitionHelper)
|
124
|
+
appliance_helper.should_receive(:read_definitions).with("#{File.dirname(__FILE__)}/rspec/src/appliances/jeos-f13.appl")
|
125
|
+
appliance_helper.should_receive(:appliance_configs).and_return([appliance_config])
|
125
126
|
|
126
|
-
|
127
|
+
ApplianceDefinitionHelper.should_receive(:new).with(:log => @log).and_return(appliance_helper)
|
127
128
|
|
128
129
|
appliance_config_helper = mock(ApplianceConfigHelper)
|
129
130
|
|
@@ -133,7 +134,7 @@ module BoxGrinder
|
|
133
134
|
|
134
135
|
appliance_config_helper.should_receive(:merge).with(appliance_config).and_return(appliance_config)
|
135
136
|
|
136
|
-
ApplianceConfigHelper.should_receive(:new).with(
|
137
|
+
ApplianceConfigHelper.should_receive(:new).with([appliance_config]).and_return(appliance_config_helper)
|
137
138
|
|
138
139
|
@appliance.read_definition
|
139
140
|
end
|
@@ -143,7 +144,7 @@ module BoxGrinder
|
|
143
144
|
|
144
145
|
appliance_config = ApplianceConfig.new
|
145
146
|
|
146
|
-
appliance_helper = mock(
|
147
|
+
appliance_helper = mock(ApplianceDefinitionHelper)
|
147
148
|
appliance_helper.should_receive(:read_definitions).with("#{File.dirname(__FILE__)}/rspec/src/appliances/jeos-f13.ks").and_raise("Unknown format")
|
148
149
|
|
149
150
|
clazz = mock('PluginClass')
|
@@ -159,7 +160,7 @@ module BoxGrinder
|
|
159
160
|
|
160
161
|
PluginManager.should_receive(:instance).and_return(plugin_manager)
|
161
162
|
|
162
|
-
|
163
|
+
ApplianceDefinitionHelper.should_receive(:new).with(:log => @log).and_return(appliance_helper)
|
163
164
|
|
164
165
|
appliance_config_helper = mock(ApplianceConfigHelper)
|
165
166
|
|
@@ -177,7 +178,7 @@ module BoxGrinder
|
|
177
178
|
it "should read definition with kickstart appliance definition file and fail because there was no plugin able to read .ks" do
|
178
179
|
prepare_appliance({}, "#{File.dirname(__FILE__)}/rspec/src/appliances/jeos-f13.ks")
|
179
180
|
|
180
|
-
appliance_helper = mock(
|
181
|
+
appliance_helper = mock(ApplianceDefinitionHelper)
|
181
182
|
appliance_helper.should_receive(:read_definitions).with("#{File.dirname(__FILE__)}/rspec/src/appliances/jeos-f13.ks").and_raise("Unknown format")
|
182
183
|
|
183
184
|
plugin_manager = mock(PluginManager)
|
@@ -186,7 +187,7 @@ module BoxGrinder
|
|
186
187
|
|
187
188
|
PluginManager.should_receive(:instance).and_return(plugin_manager)
|
188
189
|
|
189
|
-
|
190
|
+
ApplianceDefinitionHelper.should_receive(:new).with(:log => @log).and_return(appliance_helper)
|
190
191
|
|
191
192
|
lambda {
|
192
193
|
@appliance.read_definition
|
@@ -265,25 +265,19 @@ module BoxGrinder
|
|
265
265
|
|
266
266
|
describe ".hw_virtualization_available?" do
|
267
267
|
it "should return true if HW acceleration is available" do
|
268
|
-
|
268
|
+
Resolv.should_receive(:getname).with("169.254.169.254").and_return("blah")
|
269
269
|
@helper.should_receive(:`).with('cat /proc/cpuinfo | grep flags | grep vmx | wc -l').and_return("2")
|
270
270
|
@helper.hw_virtualization_available?.should == true
|
271
271
|
end
|
272
272
|
|
273
273
|
it "should return false if no vmx flag is present" do
|
274
|
-
|
274
|
+
Resolv.should_receive(:getname).with("169.254.169.254").and_return("blah")
|
275
275
|
@helper.should_receive(:`).with('cat /proc/cpuinfo | grep flags | grep vmx | wc -l').and_return("0")
|
276
276
|
@helper.hw_virtualization_available?.should == false
|
277
277
|
end
|
278
278
|
|
279
279
|
it "should return false if we're on EC2" do
|
280
|
-
|
281
|
-
@helper.hw_virtualization_available?.should == false
|
282
|
-
end
|
283
|
-
|
284
|
-
it "should return false if timeout exception is thrown" do
|
285
|
-
@helper.should_receive(:open).with('http://169.254.169.254/1.0/meta-data/local-ipv4').and_raise(Timeout::Error.new('something'))
|
286
|
-
@helper.should_receive(:`).with('cat /proc/cpuinfo | grep flags | grep vmx | wc -l').and_return("0")
|
280
|
+
Resolv.should_receive(:getname).with("169.254.169.254").and_return("instance-data.ec2.internal")
|
287
281
|
@helper.hw_virtualization_available?.should == false
|
288
282
|
end
|
289
283
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boxgrinder-build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 1
|
10
|
+
version: 0.8.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marek Goldmann
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-22 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -41,12 +41,12 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
44
|
+
hash: 21
|
45
45
|
segments:
|
46
46
|
- 0
|
47
47
|
- 2
|
48
|
-
-
|
49
|
-
version: 0.2.
|
48
|
+
- 1
|
49
|
+
version: 0.2.1
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id002
|
52
52
|
description: A tool for creating appliances from simple plain text files for various virtual environments.
|