vanagon 0.17.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/bin/build +3 -1
  4. data/bin/build_host_info +3 -1
  5. data/bin/build_requirements +3 -1
  6. data/bin/inspect +3 -1
  7. data/bin/render +3 -1
  8. data/bin/repo +3 -1
  9. data/bin/ship +3 -1
  10. data/bin/sign +3 -1
  11. data/extras/completions/vanagon.bash +38 -0
  12. data/extras/completions/vanagon.zsh +41 -0
  13. data/lib/vanagon/cli.rb +12 -2
  14. data/lib/vanagon/cli/build.rb +12 -3
  15. data/lib/vanagon/cli/build_host_info.rb +12 -3
  16. data/lib/vanagon/cli/build_requirements.rb +13 -5
  17. data/lib/vanagon/cli/completion.rb +44 -0
  18. data/lib/vanagon/cli/inspect.rb +12 -3
  19. data/lib/vanagon/cli/list.rb +74 -0
  20. data/lib/vanagon/cli/render.rb +11 -2
  21. data/lib/vanagon/cli/ship.rb +5 -4
  22. data/lib/vanagon/cli/sign.rb +3 -2
  23. data/lib/vanagon/component.rb +13 -10
  24. data/lib/vanagon/component/dsl.rb +27 -20
  25. data/lib/vanagon/component/source.rb +2 -1
  26. data/lib/vanagon/component/source/git.rb +35 -10
  27. data/lib/vanagon/component/source/http.rb +3 -2
  28. data/lib/vanagon/component/source/local.rb +2 -1
  29. data/lib/vanagon/component/source/rewrite.rb +3 -2
  30. data/lib/vanagon/driver.rb +35 -34
  31. data/lib/vanagon/engine/always_be_scheduling.rb +12 -11
  32. data/lib/vanagon/engine/docker.rb +2 -1
  33. data/lib/vanagon/engine/ec2.rb +5 -4
  34. data/lib/vanagon/engine/hardware.rb +4 -3
  35. data/lib/vanagon/engine/pooler.rb +6 -5
  36. data/lib/vanagon/environment.rb +3 -2
  37. data/lib/vanagon/logger.rb +31 -0
  38. data/lib/vanagon/platform.rb +38 -5
  39. data/lib/vanagon/platform/deb.rb +2 -0
  40. data/lib/vanagon/platform/dsl.rb +23 -6
  41. data/lib/vanagon/platform/windows.rb +3 -1
  42. data/lib/vanagon/project.rb +25 -15
  43. data/lib/vanagon/project/dsl.rb +6 -5
  44. data/lib/vanagon/utilities.rb +5 -4
  45. data/resources/deb/control.erb +1 -1
  46. data/resources/deb/postinst.erb +24 -13
  47. data/resources/deb/postrm.erb +9 -6
  48. data/resources/deb/prerm.erb +18 -8
  49. data/resources/osx/postinstall.erb +5 -1
  50. data/resources/rpm/project.spec.erb +12 -12
  51. data/resources/solaris/10/depend.erb +2 -2
  52. data/resources/solaris/10/postinstall.erb +10 -2
  53. data/resources/solaris/11/p5m.erb +2 -2
  54. data/spec/lib/vanagon/cli_spec.rb +143 -0
  55. data/spec/lib/vanagon/component/dsl_spec.rb +54 -10
  56. data/spec/lib/vanagon/component/source/git_spec.rb +4 -4
  57. data/spec/lib/vanagon/component_spec.rb +15 -2
  58. data/spec/lib/vanagon/driver_spec.rb +1 -1
  59. data/spec/lib/vanagon/engine/always_be_scheduling_spec.rb +4 -4
  60. data/spec/lib/vanagon/platform_spec.rb +80 -0
  61. data/spec/lib/vanagon/utilities_spec.rb +4 -1
  62. metadata +37 -32
@@ -13,15 +13,25 @@ fi
13
13
  <%- get_services.each do |service| -%>
14
14
  # switch based on systemd vs systemv
15
15
  #
16
- <%- if @platform.servicetype == "systemd" -%>
17
- if [ "$1" = remove ]; then
18
- systemctl --no-reload disable <%= service.name %>.service > /dev/null 2>&1 || :
19
- systemctl stop <%= service.name %>.service > /dev/null 2>&1 || :
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
- <%- elsif @platform.servicetype == "sysv" -%>
23
- if [ -x "<%= service.service_file %>" ] && [ "$1" = remove ]; then
24
- invoke-rc.d <%= service.name %> stop || true
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 -%>
@@ -6,7 +6,11 @@
6
6
  dest_file = config.path.gsub(/\.pristine$/, '') -%>
7
7
 
8
8
  if [ -f "<%= dest_file %>" ]; then
9
- echo "Detected file at '<%= dest_file %>'; updated file at '<%= config.path %>'."
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.servicetype == "systemd" -%>
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.servicetype == "sysv" -%>
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.servicetype == "systemd" -%>
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.servicetype == "sysv" -%>
265
+ <%- elsif @platform.get_service_types.include?("sysv") -%>
266
266
  chkconfig --add <%= service.name %> >/dev/null 2>&1 || :
267
- <%- elsif @platform.servicetype == "aix" -%>
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.servicetype == "systemd" -%>
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.servicetype == "sysv" -%>
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.servicetype == "aix" -%>
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.servicetype == "systemd" -%>
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.servicetype == "sysv" -%>
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.servicetype == "aix" -%>
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 |requirement| -%>
2
- P <%= requirement %>
1
+ <%- get_requires.each do |requires| -%>
2
+ P <%= requires.requirement %>
3
3
  <%- end -%>
@@ -10,7 +10,11 @@
10
10
  dest_file = config.path.gsub(/\.pristine$/, '') -%>
11
11
 
12
12
  if [ -f "<%= dest_file %>" ]; then
13
- echo "Detected file at '<%= dest_file %>'; updated file at '<%= config.path %>'."
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
- <%= "chmod '#{file_or_directory.mode}' '#{file_or_directory.path}'" if file_or_directory.mode %>
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 |requirement| -%>
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
@@ -78,3 +78,146 @@ describe Vanagon::CLI do
78
78
  end
79
79
  end
80
80
  end
81
+
82
+ describe Vanagon::CLI::List do
83
+ let(:cli) { Vanagon::CLI::List.new }
84
+
85
+ describe "#output" do
86
+ let(:list) { ['a', 'b', 'c']}
87
+ it "returns an array if space is false" do
88
+ expect(cli.output(list, false)).to eq(list)
89
+ end
90
+ it "returns space separated if space is true" do
91
+ expect(cli.output(list, true)).to eq('a b c')
92
+ end
93
+ end
94
+
95
+ describe "#run" do
96
+ let(:projects){ ['foo', 'bar', 'baz'] }
97
+ let(:platforms){ ['1', '2', '3'] }
98
+ let(:output_both){
99
+ "- Projects
100
+ foo
101
+ bar
102
+ baz
103
+
104
+ - Platforms
105
+ 1
106
+ 2
107
+ 3
108
+ "
109
+ }
110
+ context "specs with standard config path" do
111
+ before(:each) do
112
+ expect(Dir).to receive(:exist?)
113
+ .with("#{File.join(Dir.pwd, 'configs', 'platforms')}")
114
+ .and_return(true)
115
+ expect(Dir).to receive(:exist?)
116
+ .with("#{File.join(Dir.pwd, 'configs', 'projects')}")
117
+ .and_return(true)
118
+ expect(Dir).to receive(:children)
119
+ .with("#{File.join(Dir.pwd, 'configs', 'projects')}")
120
+ .and_return(projects)
121
+ expect(Dir).to receive(:children)
122
+ .with("#{File.join(Dir.pwd, 'configs', 'platforms')}")
123
+ .and_return(platforms)
124
+ end
125
+ let(:options_empty) { {
126
+ nil=>false,
127
+ :configdir=>"#{Dir.pwd}/configs",
128
+ :platforms=>false,
129
+ :projects=>false,
130
+ :use_spaces=>false
131
+ } }
132
+ let(:options_platforms_only) { {
133
+ nil=>false,
134
+ :configdir=>"#{Dir.pwd}/configs",
135
+ :platforms=>true,
136
+ :projects=>false,
137
+ :use_spaces=>false
138
+ } }
139
+ let(:options_projects_only) { {
140
+ nil=>false,
141
+ :configdir=>"#{Dir.pwd}/configs",
142
+ :platforms=>false,
143
+ :projects=>true,
144
+ :use_spaces=>false
145
+ } }
146
+ let(:options_space_only) { {
147
+ nil=>false,
148
+ :configdir=>"#{Dir.pwd}/configs",
149
+ :platforms=>false,
150
+ :projects=>false,
151
+ :use_spaces=>true
152
+ } }
153
+
154
+ it "outputs projects and platforms with no options passed" do
155
+ expect do
156
+ cli.run(options_empty)
157
+ end.to output(output_both).to_stdout
158
+ end
159
+
160
+ let(:output_both_space){
161
+ "- Projects
162
+ foo bar baz
163
+
164
+ - Platforms
165
+ 1 2 3
166
+ "
167
+ }
168
+ it "outputs projects and platforms space separated" do
169
+ expect do
170
+ cli.run(options_space_only)
171
+ end.to output(output_both_space).to_stdout
172
+ end
173
+
174
+ let(:output_platforms){
175
+ "- Platforms
176
+ 1
177
+ 2
178
+ 3
179
+ "
180
+ }
181
+ it "outputs only platforms when platforms is passed" do
182
+ expect do
183
+ cli.run(options_platforms_only)
184
+ end.to output(output_platforms).to_stdout
185
+ end
186
+
187
+ let(:output_projects){
188
+ "- Projects
189
+ foo
190
+ bar
191
+ baz
192
+ "
193
+ }
194
+ it "outputs only projects when projects is passed" do
195
+ expect do
196
+ cli.run(options_projects_only)
197
+ end.to output(output_projects).to_stdout
198
+ end
199
+ end
200
+
201
+ context "spec with a configdir specified" do
202
+ let(:options_configdir) { {
203
+ nil=>false,
204
+ :configdir=> '/configs',
205
+ :platforms=>false,
206
+ :projects=>false,
207
+ :use_spaces=>false} }
208
+ it "it successfully takes the configs directory" do
209
+ expect(Dir).to receive(:exist?).with('/configs' + '/platforms')
210
+ .and_return(true)
211
+ expect(Dir).to receive(:exist?).with('/configs' + '/projects')
212
+ .and_return(true)
213
+ expect(Dir).to receive(:children).with('/configs' + '/projects')
214
+ .and_return(projects)
215
+ expect(Dir).to receive(:children).with('/configs' + '/platforms')
216
+ .and_return(platforms)
217
+ expect do
218
+ cli.run(options_configdir)
219
+ end.to output(output_both).to_stdout
220
+ end
221
+ end
222
+ end
223
+ end
@@ -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 eq('service-test')
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 eq('mcollective')
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 eq('service-test')
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 eq('service-test')
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 eq('service-test')
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 eq('service-test')
701
+ expect(comp._component.service.flat_map(&:name).compact).to include('service-test')
658
702
  end
659
703
  end
660
704
 
@@ -14,8 +14,8 @@ describe "Vanagon::Component::Source::Git" do
14
14
 
15
15
  # before(:each) blocks are run before each example
16
16
  before :each do
17
- allow(Git)
18
- .to receive(:ls_remote)
17
+ allow(Vanagon::Component::Source::Git)
18
+ .to receive(:valid_remote?)
19
19
  .and_return(true)
20
20
 
21
21
  allow(File).to receive(:realpath).and_return(@workdir)
@@ -24,8 +24,8 @@ describe "Vanagon::Component::Source::Git" do
24
24
  describe "#initialize" do
25
25
  it "raises error on initialization with an invalid repo" do
26
26
  # Ensure initializing a repo fails without calling over the network
27
- allow(Git)
28
- .to receive(:ls_remote)
27
+ allow(Vanagon::Component::Source::Git)
28
+ .to receive(:valid_remote?)
29
29
  .and_return(false)
30
30
 
31
31
  expect { @klass.new(@url, ref: @ref_tag, workdir: @workdir) }