vanagon 0.18.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/lib/vanagon/cli.rb +4 -2
- data/lib/vanagon/cli/build.rb +2 -1
- data/lib/vanagon/cli/build_host_info.rb +3 -2
- data/lib/vanagon/cli/build_requirements.rb +4 -4
- data/lib/vanagon/cli/completion.rb +4 -3
- data/lib/vanagon/cli/inspect.rb +3 -2
- data/lib/vanagon/cli/list.rb +16 -6
- data/lib/vanagon/cli/render.rb +2 -1
- data/lib/vanagon/cli/ship.rb +4 -19
- 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 +20 -23
- 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/defaults/debian-10-amd64.rb +11 -0
- data/lib/vanagon/platform/defaults/debian-8-amd64.rb +12 -0
- data/lib/vanagon/platform/defaults/debian-8-i386.rb +12 -0
- data/lib/vanagon/platform/defaults/debian-9-amd64.rb +12 -0
- data/lib/vanagon/platform/defaults/debian-9-i386.rb +12 -0
- data/lib/vanagon/platform/defaults/el-6-i386.rb +11 -0
- data/lib/vanagon/platform/defaults/el-6-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/el-7-aarch64.rb +13 -0
- data/lib/vanagon/platform/defaults/el-7-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/el-8-aarch64.rb +10 -0
- data/lib/vanagon/platform/defaults/el-8-x86_64.rb +10 -0
- data/lib/vanagon/platform/defaults/fedora-30-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/fedora-31-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/fedora-32-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/osx-10.14-x86_64.rb +22 -0
- data/lib/vanagon/platform/defaults/osx-10.15-x86_64.rb +21 -0
- data/lib/vanagon/platform/defaults/redhatfips-7-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/sles-12-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/sles-15-x86_64.rb +10 -0
- data/lib/vanagon/platform/defaults/solaris-11-i386.rb +9 -0
- data/lib/vanagon/platform/defaults/solaris-11-sparc.rb +10 -0
- data/lib/vanagon/platform/defaults/ubuntu-16.04-amd64.rb +12 -0
- data/lib/vanagon/platform/defaults/ubuntu-16.04-i386.rb +12 -0
- data/lib/vanagon/platform/defaults/ubuntu-18.04-amd64.rb +12 -0
- data/lib/vanagon/platform/defaults/ubuntu-20.04-aarch64.rb +11 -0
- data/lib/vanagon/platform/defaults/ubuntu-20.04-amd64.rb +11 -0
- data/lib/vanagon/platform/dsl.rb +30 -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 +6 -2
- data/resources/rpm/project.spec.erb +12 -12
- data/resources/solaris/10/depend.erb +2 -2
- data/resources/solaris/10/postinstall.erb +11 -3
- data/resources/solaris/11/p5m.erb +2 -2
- data/spec/lib/vanagon/cli_spec.rb +57 -9
- 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/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 +58 -31
data/resources/deb/control.erb
CHANGED
@@ -18,7 +18,7 @@ Breaks: <%= get_replaces.map { |replace| "#{replace.replacement} #{replace.versi
|
|
18
18
|
Conflicts: <%= get_conflicts.map { |conflict| "#{conflict.pkgname} #{conflict.version ? "(#{conflict.version})" : ""}" }.join(", ") %>
|
19
19
|
<%- end -%>
|
20
20
|
<%- unless get_requires.empty? -%>
|
21
|
-
Depends: <%= get_requires.join(", ") %>
|
21
|
+
Depends: <%= get_requires.map { |req| "#{req.requirement} #{req.version ? "(#{req.version})" : ""}" }.join(", ") %>
|
22
22
|
<%- end -%>
|
23
23
|
<%- unless get_provides.empty? -%>
|
24
24
|
Provides: <%= get_provides.map { |prov| prov.provide }.join(", ") %>
|
data/resources/deb/postinst.erb
CHANGED
@@ -2,18 +2,29 @@
|
|
2
2
|
<%- get_services.each do |service| -%>
|
3
3
|
# switch based on systemd vs systemv
|
4
4
|
#
|
5
|
-
<%- if
|
6
|
-
if [ -
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
<%- if service.init_system.nil? || service.init_system.eql?('systemd') -%>
|
6
|
+
if [ -f '/proc/1/comm' ]; then
|
7
|
+
init_comm=`cat /proc/1/comm`
|
8
|
+
if [ "$init_comm" = "systemd" ]; then
|
9
|
+
if [ -z "$2" ]; then
|
10
|
+
systemctl enable <%= service.name %>.service >/dev/null || :
|
11
|
+
else
|
12
|
+
systemctl try-restart <%= service.name %>.service >/dev/null || :
|
13
|
+
fi
|
14
|
+
fi
|
10
15
|
fi
|
11
|
-
<%-
|
12
|
-
if
|
13
|
-
|
16
|
+
<%- end -%>
|
17
|
+
<%- if service.init_system.nil? || service.init_system.eql?('sysv') -%>
|
18
|
+
if [ -f '/proc/1/comm' ]; then
|
19
|
+
init_comm=`cat /proc/1/comm`
|
20
|
+
if [ "$init_comm" = "init" ]; then
|
21
|
+
if [ -x "<%= service.service_file %>" ]; then
|
22
|
+
update-rc.d <%= service.name %> defaults > /dev/null
|
14
23
|
|
15
|
-
|
16
|
-
|
24
|
+
if [ -n "$2" ]; then
|
25
|
+
invoke-rc.d <%= service.name %> condrestart || true
|
26
|
+
fi
|
27
|
+
fi
|
17
28
|
fi
|
18
29
|
fi
|
19
30
|
<%- end -%>
|
@@ -27,17 +38,17 @@ fi
|
|
27
38
|
|
28
39
|
# Set up any specific permissions needed...
|
29
40
|
<%- (get_directories + get_configfiles + get_files).select { |pathname| pathname.has_overrides? }.uniq.each do |file_or_directory| -%>
|
30
|
-
<%= "chmod '#{file_or_directory.mode}' '#{file_or_directory.path}'" if file_or_directory.mode %>
|
41
|
+
<%= "chmod '#{file_or_directory.mode}' '#{file_or_directory.path}' &>/dev/null ||:" if file_or_directory.mode %>
|
31
42
|
<%- if file_or_directory.owner -%>
|
32
43
|
if getent passwd '<%= file_or_directory.owner %>' &> /dev/null; then
|
33
|
-
chown '<%= file_or_directory.owner %>' '<%= file_or_directory.path %>'
|
44
|
+
chown '<%= file_or_directory.owner %>' '<%= file_or_directory.path %>' &>/dev/null ||:
|
34
45
|
else
|
35
46
|
echo "Error updating '<%= file_or_directory.path %>': user '<%= file_or_directory.owner %>' does not exist."
|
36
47
|
fi
|
37
48
|
<%- end -%>
|
38
49
|
<%- if file_or_directory.group -%>
|
39
50
|
if getent group '<%= file_or_directory.group %>' &> /dev/null; then
|
40
|
-
chgrp '<%= file_or_directory.group %>' '<%= file_or_directory.path %>'
|
51
|
+
chgrp '<%= file_or_directory.group %>' '<%= file_or_directory.path %>' &>/dev/null ||:
|
41
52
|
else
|
42
53
|
echo "Error updating '<%= file_or_directory.path %>': group '<%= file_or_directory.group %>' does not exist."
|
43
54
|
fi
|
data/resources/deb/postrm.erb
CHANGED
@@ -13,11 +13,14 @@ fi
|
|
13
13
|
<%- get_services.each do |service| -%>
|
14
14
|
# switch based on systemd vs systemv
|
15
15
|
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
if [ -f '/proc/1/comm' ]; then
|
17
|
+
init_comm=`cat /proc/1/comm`
|
18
|
+
if [ "$init_comm" = "systemd" ]; then
|
19
|
+
systemctl daemon-reload >/dev/null 2>&1 || :
|
20
|
+
else
|
21
|
+
if [ "$1" = "purge" ] ; then
|
22
|
+
update-rc.d <%= service.name %> remove > /dev/null
|
23
|
+
fi
|
24
|
+
fi
|
21
25
|
fi
|
22
|
-
<%- end -%>
|
23
26
|
<%- end -%>
|
data/resources/deb/prerm.erb
CHANGED
@@ -13,15 +13,25 @@ fi
|
|
13
13
|
<%- get_services.each do |service| -%>
|
14
14
|
# switch based on systemd vs systemv
|
15
15
|
#
|
16
|
-
<%- if
|
17
|
-
if [
|
18
|
-
|
19
|
-
|
16
|
+
<%- if service.init_system.nil? || service.init_system.eql?('systemd') -%>
|
17
|
+
if [ -f '/proc/1/comm' ]; then
|
18
|
+
init_comm=`cat /proc/1/comm`
|
19
|
+
if [ "$init_comm" = "systemd" ]; then
|
20
|
+
if [ "$1" = remove ]; then
|
21
|
+
systemctl --no-reload disable <%= service.name %>.service > /dev/null 2>&1 || :
|
22
|
+
systemctl stop <%= service.name %>.service > /dev/null 2>&1 || :
|
23
|
+
fi
|
24
|
+
fi
|
20
25
|
fi
|
21
|
-
|
22
|
-
<%-
|
23
|
-
if [ -
|
24
|
-
|
26
|
+
<%- end -%>
|
27
|
+
<%- if service.init_system.nil? || service.init_system.eql?('sysv') -%>
|
28
|
+
if [ -f '/proc/1/comm' ]; then
|
29
|
+
init_comm=`cat /proc/1/comm`
|
30
|
+
if [ "$init_comm" = "init" ]; then
|
31
|
+
if [ -x "<%= service.service_file %>" ] && [ "$1" = remove ]; then
|
32
|
+
invoke-rc.d <%= service.name %> stop || true
|
33
|
+
fi
|
34
|
+
fi
|
25
35
|
fi
|
26
36
|
<%- end -%>
|
27
37
|
<%- end -%>
|
@@ -5,8 +5,12 @@
|
|
5
5
|
<%- get_configfiles.each do |config|
|
6
6
|
dest_file = config.path.gsub(/\.pristine$/, '') -%>
|
7
7
|
|
8
|
-
if [ -f "<%= dest_file %>" ]
|
9
|
-
|
8
|
+
if [ -f "<%= dest_file %>" ]; then
|
9
|
+
if diff "<%= config.path %>" "<%= dest_file %>" > /dev/null; then
|
10
|
+
rm -f "<%= config.path %>"
|
11
|
+
else
|
12
|
+
echo "Detected file at '<%= dest_file %>'; updated file at '<%= config.path %>'."
|
13
|
+
fi
|
10
14
|
else
|
11
15
|
mv '<%= config.path %>' '<%= dest_file %>'
|
12
16
|
fi
|
@@ -77,7 +77,7 @@ Source1: file-list-for-rpm
|
|
77
77
|
Autoprov: 0
|
78
78
|
Autoreq: 0
|
79
79
|
<%- get_requires.each do |requires| -%>
|
80
|
-
Requires: <%= requires %>
|
80
|
+
Requires: <%= requires.requirement %><%= requires.version ? " #{requires.version}" : "" %>
|
81
81
|
<%- end -%>
|
82
82
|
|
83
83
|
# All rpm packages built by vanagon have the pre-/post-install script
|
@@ -98,7 +98,7 @@ Requires(post): /bin/touch
|
|
98
98
|
<%- end -%>
|
99
99
|
|
100
100
|
<%- if has_services? -%>
|
101
|
-
<%- if @platform.
|
101
|
+
<%- if @platform.get_service_types.include?("systemd") -%>
|
102
102
|
<%- if @platform.is_sles? -%>
|
103
103
|
BuildRequires: systemd
|
104
104
|
%{?systemd_requires}
|
@@ -108,7 +108,7 @@ Requires(post): systemd
|
|
108
108
|
Requires(preun): systemd
|
109
109
|
Requires(postun): systemd
|
110
110
|
<%- end -%>
|
111
|
-
<%- elsif @platform.
|
111
|
+
<%- elsif @platform.get_service_types.include?("sysv") -%>
|
112
112
|
<%- if @platform.is_sles? -%>
|
113
113
|
Requires: aaa_base
|
114
114
|
<%- elsif @platform.is_linux? -%>
|
@@ -256,15 +256,15 @@ fi
|
|
256
256
|
<%- get_services.each do |service| -%>
|
257
257
|
# switch based on systemd vs systemv vs smf vs aix
|
258
258
|
#
|
259
|
-
<%- if @platform.
|
259
|
+
<%- if @platform.get_service_types.include?("systemd") -%>
|
260
260
|
<%- if @platform.is_sles? -%>
|
261
261
|
%service_add_post <%= service.name %>.service
|
262
262
|
<%- else -%>
|
263
263
|
%systemd_post <%= service.name %>.service
|
264
264
|
<%- end -%>
|
265
|
-
<%- elsif @platform.
|
265
|
+
<%- elsif @platform.get_service_types.include?("sysv") -%>
|
266
266
|
chkconfig --add <%= service.name %> >/dev/null 2>&1 || :
|
267
|
-
<%- elsif @platform.
|
267
|
+
<%- elsif @platform.get_service_types.include?("aix") -%>
|
268
268
|
if /usr/bin/lssrc -s <%= service.name -%> > /dev/null 2>&1; then
|
269
269
|
/usr/bin/chssys -s <%= service.name -%> -p <%= service.service_command -%> -w 7 -S -n 15 -f 9 > /dev/null 2>&1 || :
|
270
270
|
else
|
@@ -305,17 +305,17 @@ fi
|
|
305
305
|
<%- get_services.each do |service| -%>
|
306
306
|
# switch based on systemd vs systemv vs smf vs aix
|
307
307
|
#
|
308
|
-
<%- if @platform.
|
308
|
+
<%- if @platform.get_service_types.include?("systemd") -%>
|
309
309
|
<%- if @platform.is_sles? -%>
|
310
310
|
%service_del_postun <%= service.name %>.service
|
311
311
|
<%- else -%>
|
312
312
|
%systemd_postun_with_restart <%= service.name %>.service
|
313
313
|
<%- end -%>
|
314
|
-
<%- elsif @platform.
|
314
|
+
<%- elsif @platform.get_service_types.include?("sysv") -%>
|
315
315
|
if [ "$1" -eq 1 ]; then
|
316
316
|
/sbin/service <%= service.name %> condrestart || :
|
317
317
|
fi
|
318
|
-
<%- elsif @platform.
|
318
|
+
<%- elsif @platform.get_service_types.include?("aix") -%>
|
319
319
|
if [ "$1" -eq 0 ]; then
|
320
320
|
/usr/bin/rmssys -s <%= service.name -%> > /dev/null 2>&1 || :
|
321
321
|
/usr/sbin/rmitab <%= service.name -%> > /dev/null 2>&1 || :
|
@@ -336,18 +336,18 @@ if [ "$1" -eq 0 ] ; then
|
|
336
336
|
fi
|
337
337
|
|
338
338
|
<%- get_services.each do |service| -%>
|
339
|
-
<%- if @platform.
|
339
|
+
<%- if @platform.get_service_types.include?("systemd") -%>
|
340
340
|
<%- if @platform.is_sles? -%>
|
341
341
|
%service_del_preun <%= service.name %>.service
|
342
342
|
<%- else -%>
|
343
343
|
%systemd_preun <%= service.name %>.service
|
344
344
|
<%- end -%>
|
345
|
-
<%- elsif @platform.
|
345
|
+
<%- elsif @platform.get_service_types.include?("sysv") -%>
|
346
346
|
if [ "$1" -eq 0 ]; then
|
347
347
|
/sbin/service <%= service.name %> stop >/dev/null 2>&1 || :
|
348
348
|
chkconfig --del <%= service.name %> || :
|
349
349
|
fi
|
350
|
-
<%- elsif @platform.
|
350
|
+
<%- elsif @platform.get_service_types.include?("aix") -%>
|
351
351
|
# stop the service only on a real uninstall, not on upgrades
|
352
352
|
if [ "$1" -eq 0 ] ; then
|
353
353
|
/usr/bin/stopsrc -s <%= service.name -%> > /dev/null 2>&1 || :
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%- get_requires.each do |
|
2
|
-
P <%= requirement %>
|
1
|
+
<%- get_requires.each do |requires| -%>
|
2
|
+
P <%= requires.requirement %>
|
3
3
|
<%- end -%>
|
@@ -9,8 +9,12 @@
|
|
9
9
|
<%- get_configfiles.each do |config|
|
10
10
|
dest_file = config.path.gsub(/\.pristine$/, '') -%>
|
11
11
|
|
12
|
-
if [ -f "<%= dest_file %>" ]
|
13
|
-
|
12
|
+
if [ -f "<%= dest_file %>" ]; then
|
13
|
+
if diff "<%= config.path %>" "<%= dest_file %>" > /dev/null; then
|
14
|
+
rm -f "<%= config.path %>"
|
15
|
+
else
|
16
|
+
echo "Detected file at '<%= dest_file %>'; updated file at '<%= config.path %>'."
|
17
|
+
fi
|
14
18
|
else
|
15
19
|
cp -pr '<%= config.path %>' '<%= dest_file %>'
|
16
20
|
fi
|
@@ -19,7 +23,11 @@ fi
|
|
19
23
|
|
20
24
|
# Set up any specific permissions needed...
|
21
25
|
<%- (get_directories + get_configfiles + get_files).select { |pathname| pathname.has_overrides? }.uniq.each do |file_or_directory| -%>
|
22
|
-
|
26
|
+
<%- if file_or_directory.mode -%>
|
27
|
+
if [ -f "<%= file_or_directory.path %>" ] || [ -d "<%= file_or_directory.path %>" ]; then
|
28
|
+
chmod '<%= file_or_directory.mode %>' '<%= file_or_directory.path %>'
|
29
|
+
fi
|
30
|
+
<%- end -%>
|
23
31
|
<%- if file_or_directory.owner -%>
|
24
32
|
if getent passwd '<%= file_or_directory.owner %>' &> /dev/null; then
|
25
33
|
chown '<%= file_or_directory.owner %>' '<%= file_or_directory.path %>'
|
@@ -17,8 +17,8 @@ set name=variant.opensolaris.zone value=global value=nonglobal
|
|
17
17
|
%>
|
18
18
|
|
19
19
|
# Add any needed dependencies
|
20
|
-
<%- get_requires.each do |
|
21
|
-
depend fmri=pkg:/<%= requirement %> type=require
|
20
|
+
<%- get_requires.each do |requires| -%>
|
21
|
+
depend fmri=pkg:/<%= requires.requirement %> type=require
|
22
22
|
<%- end -%>
|
23
23
|
|
24
24
|
# Always drop /etc, /usr, and /var, it will cause conflicts with other system packages
|
@@ -93,6 +93,7 @@ describe Vanagon::CLI::List do
|
|
93
93
|
end
|
94
94
|
|
95
95
|
describe "#run" do
|
96
|
+
let(:defaults){ ['def1', 'def2', 'def3'] }
|
96
97
|
let(:projects){ ['foo', 'bar', 'baz'] }
|
97
98
|
let(:platforms){ ['1', '2', '3'] }
|
98
99
|
let(:output_both){
|
@@ -115,6 +116,9 @@ baz
|
|
115
116
|
expect(Dir).to receive(:exist?)
|
116
117
|
.with("#{File.join(Dir.pwd, 'configs', 'projects')}")
|
117
118
|
.and_return(true)
|
119
|
+
expect(Dir).to receive(:children)
|
120
|
+
.with("#{File.join(Dir.pwd, 'lib', 'vanagon' ,'cli', '..', 'platform', 'defaults')}")
|
121
|
+
.and_return(defaults)
|
118
122
|
expect(Dir).to receive(:children)
|
119
123
|
.with("#{File.join(Dir.pwd, 'configs', 'projects')}")
|
120
124
|
.and_return(projects)
|
@@ -124,28 +128,32 @@ baz
|
|
124
128
|
end
|
125
129
|
let(:options_empty) { {
|
126
130
|
nil=>false,
|
127
|
-
:configdir=>"#{Dir.pwd}/configs",
|
131
|
+
:configdir=>"#{Dir.pwd}/configs",
|
132
|
+
:defaults=>false,
|
128
133
|
:platforms=>false,
|
129
134
|
:projects=>false,
|
130
135
|
:use_spaces=>false
|
131
136
|
} }
|
132
137
|
let(:options_platforms_only) { {
|
133
138
|
nil=>false,
|
134
|
-
:configdir=>"#{Dir.pwd}/configs",
|
139
|
+
:configdir=>"#{Dir.pwd}/configs",
|
140
|
+
:defaults=>false,
|
135
141
|
:platforms=>true,
|
136
142
|
:projects=>false,
|
137
143
|
:use_spaces=>false
|
138
144
|
} }
|
139
145
|
let(:options_projects_only) { {
|
140
146
|
nil=>false,
|
141
|
-
:configdir=>"#{Dir.pwd}/configs",
|
147
|
+
:configdir=>"#{Dir.pwd}/configs",
|
148
|
+
:defaults=>false,
|
142
149
|
:platforms=>false,
|
143
150
|
:projects=>true,
|
144
151
|
:use_spaces=>false
|
145
152
|
} }
|
146
153
|
let(:options_space_only) { {
|
147
154
|
nil=>false,
|
148
|
-
:configdir=>"#{Dir.pwd}/configs",
|
155
|
+
:configdir=>"#{Dir.pwd}/configs",
|
156
|
+
:defaults=>false,
|
149
157
|
:platforms=>false,
|
150
158
|
:projects=>false,
|
151
159
|
:use_spaces=>true
|
@@ -164,7 +172,7 @@ foo bar baz
|
|
164
172
|
- Platforms
|
165
173
|
1 2 3
|
166
174
|
"
|
167
|
-
|
175
|
+
}
|
168
176
|
it "outputs projects and platforms space separated" do
|
169
177
|
expect do
|
170
178
|
cli.run(options_space_only)
|
@@ -202,14 +210,19 @@ baz
|
|
202
210
|
let(:options_configdir) { {
|
203
211
|
nil=>false,
|
204
212
|
:configdir=> '/configs',
|
213
|
+
:defaults=>false,
|
205
214
|
:platforms=>false,
|
206
215
|
:projects=>false,
|
207
|
-
:use_spaces=>false
|
216
|
+
:use_spaces=>false
|
217
|
+
} }
|
208
218
|
it "it successfully takes the configs directory" do
|
209
219
|
expect(Dir).to receive(:exist?).with('/configs' + '/platforms')
|
210
220
|
.and_return(true)
|
211
221
|
expect(Dir).to receive(:exist?).with('/configs' + '/projects')
|
212
222
|
.and_return(true)
|
223
|
+
expect(Dir).to receive(:children)
|
224
|
+
.with("#{File.join(Dir.pwd, 'lib', 'vanagon' ,'cli', '..', 'platform', 'defaults')}")
|
225
|
+
.and_return(defaults)
|
213
226
|
expect(Dir).to receive(:children).with('/configs' + '/projects')
|
214
227
|
.and_return(projects)
|
215
228
|
expect(Dir).to receive(:children).with('/configs' + '/platforms')
|
@@ -219,8 +232,43 @@ baz
|
|
219
232
|
end.to output(output_both).to_stdout
|
220
233
|
end
|
221
234
|
end
|
235
|
+
|
236
|
+
context "spec to determine vanagon defaults" do
|
237
|
+
let(:options_default_platforms) { {
|
238
|
+
nil=>false,
|
239
|
+
:configdir=>"#{Dir.pwd}/configs",
|
240
|
+
:defaults=>true,
|
241
|
+
:platforms=>false,
|
242
|
+
:projects=>false,
|
243
|
+
:use_spaces=>false
|
244
|
+
} }
|
245
|
+
let(:output_defaults){
|
246
|
+
"- Defaults
|
247
|
+
def1
|
248
|
+
def2
|
249
|
+
def3
|
250
|
+
"
|
251
|
+
}
|
252
|
+
it "lists the vanagon defaults" do
|
253
|
+
expect(Dir).to receive(:exist?)
|
254
|
+
.with("#{File.join(Dir.pwd, 'configs', 'platforms')}")
|
255
|
+
.and_return(true)
|
256
|
+
expect(Dir).to receive(:exist?)
|
257
|
+
.with("#{File.join(Dir.pwd, 'configs', 'projects')}")
|
258
|
+
.and_return(true)
|
259
|
+
expect(Dir).to receive(:children)
|
260
|
+
.with("#{File.join(Dir.pwd, 'lib', 'vanagon' ,'cli', '..', 'platform', 'defaults')}")
|
261
|
+
.and_return(defaults)
|
262
|
+
expect(Dir).to receive(:children)
|
263
|
+
.with("#{File.join(Dir.pwd, 'configs', 'projects')}")
|
264
|
+
.and_return(projects)
|
265
|
+
expect(Dir).to receive(:children)
|
266
|
+
.with("#{File.join(Dir.pwd, 'configs', 'platforms')}")
|
267
|
+
.and_return(platforms)
|
268
|
+
expect do
|
269
|
+
cli.run(options_default_platforms)
|
270
|
+
end.to output(output_defaults).to_stdout
|
271
|
+
end
|
272
|
+
end
|
222
273
|
end
|
223
274
|
end
|
224
|
-
|
225
|
-
|
226
|
-
|
@@ -34,6 +34,16 @@ end" }
|
|
34
34
|
plat._platform
|
35
35
|
}
|
36
36
|
|
37
|
+
let (:dummy_platform_sysv_or_systemd) {
|
38
|
+
plat = Vanagon::Platform::DSL.new('debian-8-x86_64')
|
39
|
+
plat.instance_eval("platform 'debian-8-x86_64' do |plat|
|
40
|
+
plat.servicetype 'sysv', servicedir: '/etc/init.d'
|
41
|
+
plat.servicetype 'systemd', servicedir: '/usr/lib/systemd/system'
|
42
|
+
plat.defaultdir '/etc/default'
|
43
|
+
end")
|
44
|
+
plat._platform
|
45
|
+
}
|
46
|
+
|
37
47
|
let (:dummy_platform_smf) {
|
38
48
|
plat = Vanagon::Platform::DSL.new('debian-11-i386')
|
39
49
|
plat.instance_eval("platform 'debian-11-i386' do |plat|
|
@@ -313,11 +323,18 @@ end" }
|
|
313
323
|
comp = Vanagon::Component::DSL.new('requires-test', {}, {})
|
314
324
|
comp.requires('library1')
|
315
325
|
comp.requires('library2')
|
316
|
-
expect(comp._component.requires).to include('library1')
|
317
|
-
expect(comp._component.requires).to include('library2')
|
326
|
+
expect(comp._component.requires.first.requirement).to include('library1')
|
327
|
+
expect(comp._component.requires.last.requirement).to include('library2')
|
318
328
|
end
|
319
329
|
end
|
320
330
|
|
331
|
+
it 'supports versioned requires' do
|
332
|
+
comp = Vanagon::Component::DSL.new('requires-test', {}, {})
|
333
|
+
comp.requires('library1', '1.2.3')
|
334
|
+
expect(comp._component.requires.first.requirement).to eq('library1')
|
335
|
+
expect(comp._component.requires.first.version).to eq('1.2.3')
|
336
|
+
end
|
337
|
+
|
321
338
|
describe '#provides' do
|
322
339
|
it 'adds the package provide to the list of provides' do
|
323
340
|
comp = Vanagon::Component::DSL.new('provides-test', {}, {})
|
@@ -568,15 +585,15 @@ end" }
|
|
568
585
|
expect(comp._component.files).to include(Vanagon::Common::Pathname.file('/etc/init.d/service-test', mode: '0755'))
|
569
586
|
|
570
587
|
# The component should now have a service registered
|
571
|
-
expect(comp._component.service.name).to
|
588
|
+
expect(comp._component.service.flat_map(&:name).compact).to include('service-test')
|
572
589
|
end
|
573
590
|
|
574
591
|
it 'reads from a file when the OS is AIX for services' do
|
575
592
|
comp = Vanagon::Component::DSL.new('service-test', {}, dummy_platform_aix)
|
576
593
|
comp.install_service('spec/fixtures/component/mcollective.service', nil, 'mcollective')
|
577
|
-
expect(comp._component.service.name).to
|
578
|
-
expect(comp._component.service.service_command).to include('/opt/puppetlabs/puppet/bin/ruby')
|
579
|
-
expect(comp._component.service.service_command).not_to include("\n")
|
594
|
+
expect(comp._component.service.flat_map(&:name).compact).to include('mcollective')
|
595
|
+
expect(comp._component.service.flat_map(&:service_command).compact.first).to include('/opt/puppetlabs/puppet/bin/ruby')
|
596
|
+
expect(comp._component.service.flat_map(&:service_command).compact.first).not_to include("\n")
|
580
597
|
end
|
581
598
|
|
582
599
|
it 'adds the correct command to the install for the component for systemd platforms' do
|
@@ -595,7 +612,34 @@ end" }
|
|
595
612
|
expect(comp._component.files).to include(Vanagon::Common::Pathname.file('/usr/lib/systemd/system/service-test.service', mode: '0644'))
|
596
613
|
|
597
614
|
# The component should now have a service registered
|
598
|
-
expect(comp._component.service.name).to
|
615
|
+
expect(comp._component.service.flat_map(&:name).compact).to include('service-test')
|
616
|
+
end
|
617
|
+
|
618
|
+
it 'adds the correct command when installing both systemd and sysv' do
|
619
|
+
comp = Vanagon::Component::DSL.new('service-test', {}, dummy_platform_sysv_or_systemd)
|
620
|
+
comp.install_service('component-client.init', 'component-client.sysconfig', init_system: 'sysv')
|
621
|
+
comp.install_service('component-client.service', 'component-client.sysconfig', init_system: 'systemd')
|
622
|
+
# Look for servicedir creation and copy - sysv
|
623
|
+
expect(comp._component.install).to include("install -d '/etc/init.d'")
|
624
|
+
expect(comp._component.install).to include("cp -p 'component-client.init' '/etc/init.d/service-test'")
|
625
|
+
|
626
|
+
# Look for servicedir creation and copy - systemd
|
627
|
+
expect(comp._component.install).to include("install -d '/usr/lib/systemd/system'")
|
628
|
+
expect(comp._component.install).to include("cp -p 'component-client.service' '/usr/lib/systemd/system/service-test.service'")
|
629
|
+
|
630
|
+
# Look for defaultdir creation and copy
|
631
|
+
expect(comp._component.install).to include("install -d '/etc/default'")
|
632
|
+
expect(comp._component.install).to include("cp -p 'component-client.sysconfig' '/etc/default/service-test'")
|
633
|
+
|
634
|
+
# Look for files and configfiles - sysv
|
635
|
+
expect(comp._component.configfiles).to include(Vanagon::Common::Pathname.configfile('/etc/default/service-test'))
|
636
|
+
expect(comp._component.files).to include(Vanagon::Common::Pathname.file('/etc/init.d/service-test', mode: '0755'))
|
637
|
+
|
638
|
+
# Look for files and configfiles - systemd
|
639
|
+
expect(comp._component.files).to include(Vanagon::Common::Pathname.file('/usr/lib/systemd/system/service-test.service', mode: '0644'))
|
640
|
+
|
641
|
+
# The component should now have a service registered
|
642
|
+
expect(comp._component.service.flat_map(&:name).compact).to include('service-test')
|
599
643
|
end
|
600
644
|
|
601
645
|
it 'adds the correct command to the install for smf services using a service_type' do
|
@@ -614,7 +658,7 @@ end" }
|
|
614
658
|
expect(comp._component.files).to include(Vanagon::Common::Pathname.file('/var/svc/manifest/network/service-test.xml', mode: '0644'))
|
615
659
|
|
616
660
|
# The component should now have a service registered
|
617
|
-
expect(comp._component.service.name).to
|
661
|
+
expect(comp._component.service.flat_map(&:name).compact).to include('service-test')
|
618
662
|
end
|
619
663
|
|
620
664
|
it 'adds the correct command to the install for smf services' do
|
@@ -633,7 +677,7 @@ end" }
|
|
633
677
|
expect(comp._component.files).to include(Vanagon::Common::Pathname.file('/var/svc/manifest/service-test.xml', mode: '0644'))
|
634
678
|
|
635
679
|
# The component should now have a service registered
|
636
|
-
expect(comp._component.service.name).to
|
680
|
+
expect(comp._component.service.flat_map(&:name).compact).to include('service-test')
|
637
681
|
end
|
638
682
|
|
639
683
|
it 'installs the file as a link when link_target is specified' do
|
@@ -654,7 +698,7 @@ end" }
|
|
654
698
|
expect(comp._component.files).to include(Vanagon::Common::Pathname.file('/etc/init.d/service-test'))
|
655
699
|
|
656
700
|
# The component should now have a service registered
|
657
|
-
expect(comp._component.service.name).to
|
701
|
+
expect(comp._component.service.flat_map(&:name).compact).to include('service-test')
|
658
702
|
end
|
659
703
|
end
|
660
704
|
|