vanagon 0.17.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/bin/build +3 -1
- data/bin/build_host_info +3 -1
- data/bin/build_requirements +3 -1
- data/bin/inspect +3 -1
- data/bin/render +3 -1
- data/bin/repo +3 -1
- data/bin/ship +3 -1
- data/bin/sign +3 -1
- data/extras/completions/vanagon.bash +38 -0
- data/extras/completions/vanagon.zsh +41 -0
- data/lib/vanagon/cli.rb +12 -2
- data/lib/vanagon/cli/build.rb +12 -3
- data/lib/vanagon/cli/build_host_info.rb +12 -3
- data/lib/vanagon/cli/build_requirements.rb +13 -5
- data/lib/vanagon/cli/completion.rb +44 -0
- data/lib/vanagon/cli/inspect.rb +12 -3
- data/lib/vanagon/cli/list.rb +74 -0
- data/lib/vanagon/cli/render.rb +11 -2
- data/lib/vanagon/cli/ship.rb +5 -4
- data/lib/vanagon/cli/sign.rb +3 -2
- data/lib/vanagon/component.rb +13 -10
- data/lib/vanagon/component/dsl.rb +27 -20
- data/lib/vanagon/component/source.rb +2 -1
- data/lib/vanagon/component/source/git.rb +35 -10
- data/lib/vanagon/component/source/http.rb +3 -2
- data/lib/vanagon/component/source/local.rb +2 -1
- data/lib/vanagon/component/source/rewrite.rb +3 -2
- data/lib/vanagon/driver.rb +35 -34
- data/lib/vanagon/engine/always_be_scheduling.rb +12 -11
- data/lib/vanagon/engine/docker.rb +2 -1
- data/lib/vanagon/engine/ec2.rb +5 -4
- data/lib/vanagon/engine/hardware.rb +4 -3
- data/lib/vanagon/engine/pooler.rb +6 -5
- data/lib/vanagon/environment.rb +3 -2
- data/lib/vanagon/logger.rb +31 -0
- data/lib/vanagon/platform.rb +38 -5
- data/lib/vanagon/platform/deb.rb +2 -0
- data/lib/vanagon/platform/dsl.rb +23 -6
- data/lib/vanagon/platform/windows.rb +3 -1
- data/lib/vanagon/project.rb +25 -15
- data/lib/vanagon/project/dsl.rb +6 -5
- data/lib/vanagon/utilities.rb +5 -4
- data/resources/deb/control.erb +1 -1
- data/resources/deb/postinst.erb +24 -13
- data/resources/deb/postrm.erb +9 -6
- data/resources/deb/prerm.erb +18 -8
- data/resources/osx/postinstall.erb +5 -1
- data/resources/rpm/project.spec.erb +12 -12
- data/resources/solaris/10/depend.erb +2 -2
- data/resources/solaris/10/postinstall.erb +10 -2
- data/resources/solaris/11/p5m.erb +2 -2
- data/spec/lib/vanagon/cli_spec.rb +143 -0
- data/spec/lib/vanagon/component/dsl_spec.rb +54 -10
- data/spec/lib/vanagon/component/source/git_spec.rb +4 -4
- data/spec/lib/vanagon/component_spec.rb +15 -2
- data/spec/lib/vanagon/driver_spec.rb +1 -1
- data/spec/lib/vanagon/engine/always_be_scheduling_spec.rb +4 -4
- data/spec/lib/vanagon/platform_spec.rb +80 -0
- data/spec/lib/vanagon/utilities_spec.rb +4 -1
- metadata +37 -32
@@ -5,8 +5,9 @@ describe "Vanagon::Component" do
|
|
5
5
|
describe "#get_environment" do
|
6
6
|
subject { Vanagon::Component.new('env-test', {}, {}) }
|
7
7
|
|
8
|
-
it "
|
9
|
-
expect
|
8
|
+
it "logs a deprecation warning with VanagonLogger.info" do
|
9
|
+
expect(VanagonLogger).to receive(:info).with(/deprecated/)
|
10
|
+
subject.get_environment
|
10
11
|
end
|
11
12
|
|
12
13
|
it "returns a makefile compatible environment" do
|
@@ -107,6 +108,18 @@ describe "Vanagon::Component" do
|
|
107
108
|
expect(subject).to receive(:fetch_url)
|
108
109
|
subject.get_source(@workdir)
|
109
110
|
end
|
111
|
+
|
112
|
+
it 'retrieves from a canonical URI if VANAGON_USE_MIRRORS is set to "false"' do
|
113
|
+
allow(ENV).to receive(:[]).with('VANAGON_USE_MIRRORS').and_return('false')
|
114
|
+
allow(subject)
|
115
|
+
.to receive(:fetch_url)
|
116
|
+
.and_return(true)
|
117
|
+
|
118
|
+
# We expect #get_source to skip mirrors
|
119
|
+
expect(subject).not_to receive(:fetch_mirrors)
|
120
|
+
expect(subject).to receive(:fetch_url)
|
121
|
+
subject.get_source(@workdir)
|
122
|
+
end
|
110
123
|
end
|
111
124
|
|
112
125
|
describe "#get_sources" do
|
@@ -50,7 +50,7 @@ describe 'Vanagon::Driver' do
|
|
50
50
|
info = create_driver(redhat).build_host_info
|
51
51
|
|
52
52
|
expect(info).to match({ 'name' => 'centos-7-x86_64',
|
53
|
-
'engine' => '
|
53
|
+
'engine' => 'always_be_scheduling' })
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'returns the vmpooler template with an explicit engine' do
|
@@ -174,8 +174,8 @@ describe 'Vanagon::Engine::AlwaysBeScheduling' do
|
|
174
174
|
hostname = 'fainter-whirlwind.puppet.com'
|
175
175
|
stub_request(:post, "https://foobar/request").
|
176
176
|
to_return({status: 404, body: "", headers: {}},{status: 200, body: '[{"hostname":"'+hostname+'","type":"aix-6.1-ppc","engine":"nspooler"}]', headers: {}})
|
177
|
-
allow_any_instance_of(
|
178
|
-
expect_any_instance_of(
|
177
|
+
allow_any_instance_of(VanagonLogger).to receive(:info)
|
178
|
+
expect_any_instance_of(VanagonLogger).to receive(:info).with("failed to request ABS with code 404")
|
179
179
|
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
180
180
|
pooler = abs_service.select_target_from("https://foobar")
|
181
181
|
expect(pooler).to eq('')
|
@@ -186,8 +186,8 @@ describe 'Vanagon::Engine::AlwaysBeScheduling' do
|
|
186
186
|
to_return({status: 202, body: "", headers: {}},
|
187
187
|
{status: 503, body: "", headers: {}},
|
188
188
|
{status: 200, body: '[{"hostname":"'+hostname+'","type":"aix-6.1-ppc","engine":"nspooler"}]', headers: {}})
|
189
|
-
allow_any_instance_of(
|
190
|
-
expect_any_instance_of(
|
189
|
+
allow_any_instance_of(VanagonLogger).to receive(:info)
|
190
|
+
expect_any_instance_of(VanagonLogger).to receive(:info).with(/Waiting 1 seconds to check if ABS request has been filled/)
|
191
191
|
abs_service = Vanagon::Engine::AlwaysBeScheduling.new(platform, nil)
|
192
192
|
abs_service.select_target_from("https://foobar")
|
193
193
|
expect(abs_service.target).to eq(hostname)
|
@@ -1,6 +1,33 @@
|
|
1
1
|
require 'vanagon/platform'
|
2
2
|
|
3
3
|
describe "Vanagon::Platform" do
|
4
|
+
let(:deb_platform_just_servicedir) { "platform 'debian-test-fixture' do |plat|
|
5
|
+
plat.servicedir '/etc/init.d'
|
6
|
+
end
|
7
|
+
"}
|
8
|
+
let(:deb_platform_just_servicetype) { "platform 'debian-test-fixture' do |plat|
|
9
|
+
plat.servicetype 'sysv'
|
10
|
+
end
|
11
|
+
"}
|
12
|
+
let(:deb_platform_multi_servicetypes) { "platform 'debian-test-fixture' do |plat|
|
13
|
+
plat.servicetype 'sysv', servicedir: '/etc/init.d'
|
14
|
+
plat.servicetype 'systemd', servicedir: '/lib/systemd/system'
|
15
|
+
end
|
16
|
+
"}
|
17
|
+
let(:deb_platform_no_service) { "platform 'debian-test-fixture' do |plat|
|
18
|
+
end
|
19
|
+
"}
|
20
|
+
let(:deb_platform_servicetype) { "platform 'debian-test-fixture' do |plat|
|
21
|
+
plat.servicetype 'sysv'
|
22
|
+
plat.servicedir '/etc/init.d'
|
23
|
+
end
|
24
|
+
"}
|
25
|
+
let(:deb_platform_bad_servicedir_block) { "platform 'debian-test-fixture' do |plat|
|
26
|
+
plat.servicetype 'sysv', servicedir: '/etc/init.d'
|
27
|
+
plat.servicetype 'sysv', servicedir: '/etc/rc.d'
|
28
|
+
end
|
29
|
+
"}
|
30
|
+
|
4
31
|
let(:platforms) do
|
5
32
|
[
|
6
33
|
{
|
@@ -172,4 +199,57 @@ describe "Vanagon::Platform" do
|
|
172
199
|
end
|
173
200
|
end
|
174
201
|
end
|
202
|
+
|
203
|
+
describe "#get_service_type" do
|
204
|
+
it "returns plat.servicetype if that's the only thing set" do
|
205
|
+
plat = Vanagon::Platform::DSL.new('debian-8-x86_64')
|
206
|
+
plat.instance_eval(deb_platform_just_servicetype)
|
207
|
+
expect(plat._platform.get_service_types).to include('sysv')
|
208
|
+
end
|
209
|
+
|
210
|
+
it "returns from servicetypes if that's set" do
|
211
|
+
plat = Vanagon::Platform::DSL.new('debian-8-x86_64')
|
212
|
+
plat.instance_eval(deb_platform_servicetype)
|
213
|
+
expect(plat._platform.get_service_types).to include('sysv')
|
214
|
+
end
|
215
|
+
|
216
|
+
it "returns multiples if there's more than one" do
|
217
|
+
plat = Vanagon::Platform::DSL.new('debian-8-x86_64')
|
218
|
+
plat.instance_eval(deb_platform_multi_servicetypes)
|
219
|
+
expect(plat._platform.get_service_types).to include('sysv')
|
220
|
+
expect(plat._platform.get_service_types).to include('systemd')
|
221
|
+
end
|
222
|
+
|
223
|
+
it "returns an empty array if nothing is set" do
|
224
|
+
plat = Vanagon::Platform::DSL.new('debian-8-x86_64')
|
225
|
+
plat.instance_eval(deb_platform_no_service)
|
226
|
+
expect(plat._platform.get_service_types.size).to eq(0)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
describe "#get_service_dir" do
|
231
|
+
it "returns plat.servicedir if that's the only thing set" do
|
232
|
+
plat = Vanagon::Platform::DSL.new('debian-8-x86_64')
|
233
|
+
plat.instance_eval(deb_platform_just_servicedir)
|
234
|
+
expect(plat._platform.get_service_dir).to eq('/etc/init.d')
|
235
|
+
end
|
236
|
+
|
237
|
+
it "returns servicedirs set via servicetype" do
|
238
|
+
plat = Vanagon::Platform::DSL.new('debian-8-x86_64')
|
239
|
+
plat.instance_eval(deb_platform_servicetype)
|
240
|
+
expect(plat._platform.get_service_dir).to eq('/etc/init.d')
|
241
|
+
end
|
242
|
+
|
243
|
+
it "returns the servicedir based on servicetype" do
|
244
|
+
plat = Vanagon::Platform::DSL.new('debian-8-x86_64')
|
245
|
+
plat.instance_eval(deb_platform_multi_servicetypes)
|
246
|
+
expect(plat._platform.get_service_dir('systemd')).to eq('/lib/systemd/system')
|
247
|
+
end
|
248
|
+
|
249
|
+
it "fails if there are >1 servicedir for a service type" do
|
250
|
+
plat = Vanagon::Platform::DSL.new('debian-8-x86_64')
|
251
|
+
plat.instance_eval(deb_platform_bad_servicedir_block)
|
252
|
+
expect { plat._platform.get_service_dir('sysv') }.to raise_error(Vanagon::Error)
|
253
|
+
end
|
254
|
+
end
|
175
255
|
end
|
@@ -72,12 +72,15 @@ describe "Vanagon::Utilities" do
|
|
72
72
|
describe '#local_command' do
|
73
73
|
it 'runs commands in an unpolluted environment' do
|
74
74
|
cmd = lambda { |arg| %(echo 'if [ "$#{arg}" = "" ]; then exit 0; else exit 1; fi' | /bin/sh) }
|
75
|
-
vars = %w
|
75
|
+
vars = %w[BUNDLE_BIN_PATH BUNDLE_GEMFILE]
|
76
76
|
vars.each do |var|
|
77
77
|
Vanagon::Utilities.local_command(cmd.call(var))
|
78
78
|
expect($?.exitstatus).to eq(0)
|
79
79
|
end
|
80
80
|
end
|
81
|
+
it 'raises a RuntimeError when given a bad thing' do
|
82
|
+
expect { Vanagon::Utilities.local_command('__bogus__comand__') }.to raise_error(RuntimeError)
|
83
|
+
end
|
81
84
|
end
|
82
85
|
|
83
86
|
describe '#ssh_command' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanagon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.8.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.8.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: fustigit
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,6 +107,8 @@ files:
|
|
107
107
|
- bin/ship
|
108
108
|
- bin/sign
|
109
109
|
- bin/vanagon
|
110
|
+
- extras/completions/vanagon.bash
|
111
|
+
- extras/completions/vanagon.zsh
|
110
112
|
- lib/git/basic_submodules.rb
|
111
113
|
- lib/git/rev_list.rb
|
112
114
|
- lib/makefile.rb
|
@@ -115,7 +117,9 @@ files:
|
|
115
117
|
- lib/vanagon/cli/build.rb
|
116
118
|
- lib/vanagon/cli/build_host_info.rb
|
117
119
|
- lib/vanagon/cli/build_requirements.rb
|
120
|
+
- lib/vanagon/cli/completion.rb
|
118
121
|
- lib/vanagon/cli/inspect.rb
|
122
|
+
- lib/vanagon/cli/list.rb
|
119
123
|
- lib/vanagon/cli/render.rb
|
120
124
|
- lib/vanagon/cli/ship.rb
|
121
125
|
- lib/vanagon/cli/sign.rb
|
@@ -144,6 +148,7 @@ files:
|
|
144
148
|
- lib/vanagon/extensions/ostruct/json.rb
|
145
149
|
- lib/vanagon/extensions/set/json.rb
|
146
150
|
- lib/vanagon/extensions/string.rb
|
151
|
+
- lib/vanagon/logger.rb
|
147
152
|
- lib/vanagon/patch.rb
|
148
153
|
- lib/vanagon/platform.rb
|
149
154
|
- lib/vanagon/platform/deb.rb
|
@@ -288,41 +293,41 @@ signing_key:
|
|
288
293
|
specification_version: 3
|
289
294
|
summary: All of your packages will fit into this van with this one simple trick.
|
290
295
|
test_files:
|
291
|
-
- spec/lib/
|
292
|
-
- spec/lib/vanagon/extensions/string_spec.rb
|
293
|
-
- spec/lib/vanagon/extensions/ostruct/json_spec.rb
|
294
|
-
- spec/lib/vanagon/extensions/set/json_spec.rb
|
295
|
-
- spec/lib/vanagon/platform/solaris_11_spec.rb
|
296
|
-
- spec/lib/vanagon/platform/dsl_spec.rb
|
297
|
-
- spec/lib/vanagon/platform/rpm/aix_spec.rb
|
298
|
-
- spec/lib/vanagon/platform/windows_spec.rb
|
299
|
-
- spec/lib/vanagon/platform/osx_spec.rb
|
300
|
-
- spec/lib/vanagon/platform/solaris_10_spec.rb
|
301
|
-
- spec/lib/vanagon/platform/rpm_spec.rb
|
302
|
-
- spec/lib/vanagon/platform/deb_spec.rb
|
303
|
-
- spec/lib/vanagon/project_spec.rb
|
304
|
-
- spec/lib/vanagon/component/source/rewrite_spec.rb
|
305
|
-
- spec/lib/vanagon/component/source/git_spec.rb
|
306
|
-
- spec/lib/vanagon/component/source/local_spec.rb
|
307
|
-
- spec/lib/vanagon/component/source/http_spec.rb
|
308
|
-
- spec/lib/vanagon/component/rules_spec.rb
|
309
|
-
- spec/lib/vanagon/component/dsl_spec.rb
|
310
|
-
- spec/lib/vanagon/component/source_spec.rb
|
311
|
-
- spec/lib/vanagon/common/user_spec.rb
|
312
|
-
- spec/lib/vanagon/common/pathname_spec.rb
|
296
|
+
- spec/lib/makefile_spec.rb
|
313
297
|
- spec/lib/vanagon/component_spec.rb
|
314
|
-
- spec/lib/vanagon/
|
298
|
+
- spec/lib/vanagon/cli_spec.rb
|
299
|
+
- spec/lib/vanagon/engine/base_spec.rb
|
315
300
|
- spec/lib/vanagon/engine/ec2_spec.rb
|
316
|
-
- spec/lib/vanagon/engine/local_spec.rb
|
317
301
|
- spec/lib/vanagon/engine/docker_spec.rb
|
302
|
+
- spec/lib/vanagon/engine/hardware_spec.rb
|
318
303
|
- spec/lib/vanagon/engine/pooler_spec.rb
|
319
|
-
- spec/lib/vanagon/engine/base_spec.rb
|
320
304
|
- spec/lib/vanagon/engine/always_be_scheduling_spec.rb
|
305
|
+
- spec/lib/vanagon/engine/local_spec.rb
|
306
|
+
- spec/lib/vanagon/common/user_spec.rb
|
307
|
+
- spec/lib/vanagon/common/pathname_spec.rb
|
308
|
+
- spec/lib/vanagon/platform/osx_spec.rb
|
309
|
+
- spec/lib/vanagon/platform/rpm_spec.rb
|
310
|
+
- spec/lib/vanagon/platform/solaris_11_spec.rb
|
311
|
+
- spec/lib/vanagon/platform/deb_spec.rb
|
312
|
+
- spec/lib/vanagon/platform/windows_spec.rb
|
313
|
+
- spec/lib/vanagon/platform/solaris_10_spec.rb
|
314
|
+
- spec/lib/vanagon/platform/rpm/aix_spec.rb
|
315
|
+
- spec/lib/vanagon/platform/dsl_spec.rb
|
316
|
+
- spec/lib/vanagon/project/dsl_spec.rb
|
317
|
+
- spec/lib/vanagon/extensions/set/json_spec.rb
|
318
|
+
- spec/lib/vanagon/extensions/ostruct/json_spec.rb
|
319
|
+
- spec/lib/vanagon/extensions/string_spec.rb
|
321
320
|
- spec/lib/vanagon/environment_spec.rb
|
322
|
-
- spec/lib/vanagon/
|
321
|
+
- spec/lib/vanagon/project_spec.rb
|
323
322
|
- spec/lib/vanagon/driver_spec.rb
|
324
|
-
- spec/lib/vanagon/
|
323
|
+
- spec/lib/vanagon/component/rules_spec.rb
|
324
|
+
- spec/lib/vanagon/component/source_spec.rb
|
325
|
+
- spec/lib/vanagon/component/source/git_spec.rb
|
326
|
+
- spec/lib/vanagon/component/source/rewrite_spec.rb
|
327
|
+
- spec/lib/vanagon/component/source/http_spec.rb
|
328
|
+
- spec/lib/vanagon/component/source/local_spec.rb
|
329
|
+
- spec/lib/vanagon/component/dsl_spec.rb
|
325
330
|
- spec/lib/vanagon/platform_spec.rb
|
331
|
+
- spec/lib/vanagon/utilities_spec.rb
|
326
332
|
- spec/lib/vanagon/utilities/shell_utilities_spec.rb
|
327
|
-
- spec/lib/makefile_spec.rb
|
328
333
|
- spec/lib/git/rev_list_spec.rb
|