vanagon 0.3.19 → 0.4.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/lib/vanagon/component.rb +3 -0
- data/lib/vanagon/component/dsl.rb +55 -8
- data/lib/vanagon/component/source.rb +23 -11
- data/lib/vanagon/component/source/http.rb +1 -1
- data/lib/vanagon/engine/pooler.rb +2 -2
- data/lib/vanagon/platform.rb +1 -8
- data/lib/vanagon/platform/deb.rb +48 -1
- data/lib/vanagon/platform/dsl.rb +17 -65
- data/lib/vanagon/platform/osx.rb +17 -4
- data/lib/vanagon/platform/rpm.rb +27 -12
- data/lib/vanagon/platform/rpm/aix.rb +28 -0
- data/lib/vanagon/platform/rpm/sles.rb +35 -0
- data/lib/vanagon/platform/solaris_10.rb +14 -4
- data/lib/vanagon/project.rb +60 -8
- data/lib/vanagon/project/dsl.rb +7 -1
- data/lib/vanagon/utilities.rb +8 -12
- data/spec/lib/vanagon/component/dsl_spec.rb +106 -6
- data/spec/lib/vanagon/engine/pooler_spec.rb +2 -0
- data/spec/lib/vanagon/platform/dsl_spec.rb +12 -16
- data/spec/lib/vanagon/platform/rpm/aix_spec.rb +29 -0
- data/spec/lib/vanagon/platform/rpm_spec.rb +35 -15
- data/templates/Makefile.erb +12 -6
- data/templates/deb/control.erb +1 -1
- data/templates/deb/docs.erb +2 -0
- data/templates/deb/postinst.erb +10 -1
- data/templates/deb/postrm.erb +10 -2
- data/templates/deb/preinst.erb +11 -0
- data/templates/deb/prerm.erb +10 -0
- data/templates/deb/rules.erb +2 -2
- data/templates/rpm/project.spec.erb +67 -11
- data/templates/solaris/11/p5m.erb +14 -0
- metadata +12 -6
@@ -0,0 +1,28 @@
|
|
1
|
+
# AIX is special. This subclassing gives us the chance to define some sane
|
2
|
+
# defaults for aix without cluttering the main rpm class in if statements.
|
3
|
+
class Vanagon
|
4
|
+
class Platform
|
5
|
+
class RPM
|
6
|
+
class AIX < Vanagon::Platform::RPM
|
7
|
+
def rpm_defines
|
8
|
+
%(--define '_topdir $(tempdir)/rpmbuild' )
|
9
|
+
end
|
10
|
+
|
11
|
+
# Constructor. Sets up some defaults for the aix platform and calls the parent constructor
|
12
|
+
#
|
13
|
+
# @param name [String] name of the platform
|
14
|
+
# @return [Vanagon::Platform::RPM::AIX] the rpm derived platform with the given name
|
15
|
+
def initialize(name)
|
16
|
+
@name = name
|
17
|
+
@make = "/usr/bin/gmake"
|
18
|
+
@tar = "/opt/freeware/bin/tar"
|
19
|
+
@patch = "/opt/freeware/bin/patch"
|
20
|
+
@num_cores = "lsdev -Cc processor |wc -l"
|
21
|
+
@install = "/opt/freeware/bin/install"
|
22
|
+
@rpmbuild = "/usr/bin/rpm"
|
23
|
+
super(name)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# SLES is special, mainly in the differences between yum and zypper,
|
2
|
+
# so here we subclass SLES off of rpm.
|
3
|
+
class Vanagon
|
4
|
+
class Platform
|
5
|
+
class RPM
|
6
|
+
class SLES < Vanagon::Platform::RPM
|
7
|
+
# Helper to setup a zypper repository on a target system
|
8
|
+
#
|
9
|
+
# @param definition [String] the repo setup URI or RPM file
|
10
|
+
# @return [Array] A list of commands to add a zypper repo for the build system
|
11
|
+
def add_repository(definition)
|
12
|
+
definition = URI.parse(definition)
|
13
|
+
if @os_version == '10'
|
14
|
+
flag = 'sa'
|
15
|
+
else
|
16
|
+
flag = 'ar'
|
17
|
+
end
|
18
|
+
|
19
|
+
commands = []
|
20
|
+
|
21
|
+
if definition.scheme =~ /^(http|ftp)/
|
22
|
+
if File.extname(definition.path) == '.rpm'
|
23
|
+
# repo definition is an rpm (like puppetlabs-release)
|
24
|
+
commands << "curl -o local.rpm '#{definition}'; rpm -Uvh local.rpm; rm -f local.rpm"
|
25
|
+
else
|
26
|
+
commands << "yes | zypper -n --no-gpg-checks #{flag} -t YUM --repo '#{definition}'"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
commands
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -10,6 +10,18 @@ class Vanagon
|
|
10
10
|
name_and_version = "#{project.name}-#{project.version}"
|
11
11
|
pkg_name = package_name(project)
|
12
12
|
|
13
|
+
# Here we maintain backward compatibility with older vanagon versions
|
14
|
+
# that did this by default. This shim should get removed at some point
|
15
|
+
# in favor of just letting the makefile deliver the bill-of-materials
|
16
|
+
# to the correct directory. This shouldn't be required at all then.
|
17
|
+
if project.bill_of_materials.nil?
|
18
|
+
bom_install = [# Move bill-of-materials into a docdir
|
19
|
+
"mkdir -p $(tempdir)/#{name_and_version}/usr/share/doc/#{project.name}",
|
20
|
+
"mv $(tempdir)/#{name_and_version}/bill-of-materials $(tempdir)/#{name_and_version}/usr/share/doc/#{project.name}/bill-of-materials",]
|
21
|
+
else
|
22
|
+
bom_install = []
|
23
|
+
end
|
24
|
+
|
13
25
|
[
|
14
26
|
# Set up our needed directories
|
15
27
|
"mkdir -p $(tempdir)/#{name_and_version}",
|
@@ -19,9 +31,7 @@ class Vanagon
|
|
19
31
|
# Unpack the project and stage the packaging artifacts
|
20
32
|
"gunzip -c #{name_and_version}.tar.gz | '#{@tar}' -C '$(tempdir)' -xf -",
|
21
33
|
|
22
|
-
|
23
|
-
"mkdir -p $(tempdir)/#{name_and_version}/usr/share/doc/#{project.name}",
|
24
|
-
"mv $(tempdir)/#{name_and_version}/bill-of-materials $(tempdir)/#{name_and_version}/usr/share/doc/#{project.name}/bill-of-materials",
|
34
|
+
bom_install,
|
25
35
|
|
26
36
|
"rm #{name_and_version}.tar.gz",
|
27
37
|
"cp -r packaging $(tempdir)/",
|
@@ -46,7 +56,7 @@ class Vanagon
|
|
46
56
|
"pkgmk -f $(tempdir)/packaging/proto -b $(tempdir)/#{name_and_version} -o -d $(tempdir)/pkg/",
|
47
57
|
"pkgtrans -s $(tempdir)/pkg/ $(tempdir)/pkg/#{pkg_name.gsub(/\.gz$/, '')} #{project.name}",
|
48
58
|
"gzip -c $(tempdir)/pkg/#{pkg_name.gsub(/\.gz$/, '')} > output/#{target_dir}/#{pkg_name}",
|
49
|
-
]
|
59
|
+
].flatten.compact
|
50
60
|
end
|
51
61
|
|
52
62
|
# Method to generate the files required to build a solaris package for the project
|
data/lib/vanagon/project.rb
CHANGED
@@ -11,6 +11,7 @@ class Vanagon
|
|
11
11
|
attr_accessor :version, :directories, :license, :description, :vendor
|
12
12
|
attr_accessor :homepage, :requires, :user, :repo, :noarch, :identifier
|
13
13
|
attr_accessor :cleanup, :version_file, :release, :replaces, :provides
|
14
|
+
attr_accessor :bill_of_materials
|
14
15
|
|
15
16
|
# Loads a given project from the configdir
|
16
17
|
#
|
@@ -110,18 +111,69 @@ class Vanagon
|
|
110
111
|
provides.flatten.uniq
|
111
112
|
end
|
112
113
|
|
113
|
-
# Collects the
|
114
|
+
# Collects the preinstall packaging actions for the project and it's components
|
115
|
+
# for the specified packaging state
|
114
116
|
#
|
115
|
-
# @
|
116
|
-
|
117
|
-
|
117
|
+
# @param pkg_state [String] the package state we want to run the given scripts for.
|
118
|
+
# Can be one or more of 'install' or 'upgrade'
|
119
|
+
# @return [String] string of Bourne shell compatible scriptlets to execute during the preinstall
|
120
|
+
# phase of packaging during the state of the system defined by pkg_state (either install or upgrade)
|
121
|
+
def get_preinstall_actions(pkg_state)
|
122
|
+
scripts = @components.map(&:preinstall_actions).flatten.compact.select { |s| s.pkg_state.include? pkg_state }.map(&:scripts)
|
123
|
+
if scripts.empty?
|
124
|
+
return ':'
|
125
|
+
else
|
126
|
+
return scripts.join("\n")
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
# Collects the postinstall packaging actions for the project and it's components
|
132
|
+
# for the specified packaging state
|
133
|
+
#
|
134
|
+
# @param pkg_state [String] the package state we want to run the given scripts for.
|
135
|
+
# Can be one or more of 'install' or 'upgrade'
|
136
|
+
# @return [String] string of Bourne shell compatible scriptlets to execute during the postinstall
|
137
|
+
# phase of packaging during the state of the system defined by pkg_state (either install or upgrade)
|
138
|
+
def get_postinstall_actions(pkg_state)
|
139
|
+
scripts = @components.map(&:postinstall_actions).flatten.compact.select { |s| s.pkg_state.include? pkg_state }.map(&:scripts)
|
140
|
+
if scripts.empty?
|
141
|
+
return ':'
|
142
|
+
else
|
143
|
+
return scripts.join("\n")
|
144
|
+
end
|
118
145
|
end
|
119
146
|
|
120
|
-
# Collects the
|
147
|
+
# Collects the preremove packaging actions for the project and it's components
|
148
|
+
# for the specified packaging state
|
121
149
|
#
|
122
|
-
# @
|
123
|
-
|
124
|
-
|
150
|
+
# @param pkg_state [String] the package state we want to run the given scripts for.
|
151
|
+
# Can be one or more of 'removal' or 'upgrade'
|
152
|
+
# @return [String] string of Bourne shell compatible scriptlets to execute during the preremove
|
153
|
+
# phase of packaging during the state of the system defined by pkg_state (either removal or upgrade)
|
154
|
+
def get_preremove_actions(pkg_state)
|
155
|
+
scripts = @components.map(&:preremove_actions).flatten.compact.select { |s| s.pkg_state.include? pkg_state }.map(&:scripts)
|
156
|
+
if scripts.empty?
|
157
|
+
return ':'
|
158
|
+
else
|
159
|
+
return scripts.join("\n")
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Collects the postremove packaging actions for the project and it's components
|
164
|
+
# for the specified packaging state
|
165
|
+
#
|
166
|
+
# @param pkg_state [String] the package state we want to run the given scripts for.
|
167
|
+
# Can be one or more of 'removal' or 'upgrade'
|
168
|
+
# @return [String] string of Bourne shell compatible scriptlets to execute during the postremove
|
169
|
+
# phase of packaging during the state of the system defined by pkg_state (either removal or upgrade)
|
170
|
+
def get_postremove_actions(pkg_state)
|
171
|
+
scripts = @components.map(&:postremove_actions).flatten.compact.select { |s| s.pkg_state.include? pkg_state }.map(&:scripts)
|
172
|
+
if scripts.empty?
|
173
|
+
return ':'
|
174
|
+
else
|
175
|
+
return scripts.join("\n")
|
176
|
+
end
|
125
177
|
end
|
126
178
|
|
127
179
|
# Collects any configfiles supplied by components
|
data/lib/vanagon/project/dsl.rb
CHANGED
@@ -208,11 +208,17 @@ class Vanagon
|
|
208
208
|
@project.cleanup = true
|
209
209
|
end
|
210
210
|
|
211
|
-
# This method will write the
|
211
|
+
# This method will write the project's version to a designated file during package creation
|
212
212
|
# @param target [String] a full path to the version file for the project
|
213
213
|
def write_version_file(target)
|
214
214
|
@project.version_file = Vanagon::Common::Pathname.file(target)
|
215
215
|
end
|
216
|
+
|
217
|
+
# This method will write the project's bill-of-materials to a designated directory during package creation.
|
218
|
+
# @param target [String] a full path to the directory for the bill-of-materials for the project
|
219
|
+
def bill_of_materials(target)
|
220
|
+
@project.bill_of_materials = Vanagon::Common::Pathname.new(target)
|
221
|
+
end
|
216
222
|
end
|
217
223
|
end
|
218
224
|
end
|
data/lib/vanagon/utilities.rb
CHANGED
@@ -241,21 +241,17 @@ class Vanagon
|
|
241
241
|
# output of the command if return_command_output is true
|
242
242
|
# @raise [RuntimeError] If there is no target given or the command fails an exception is raised
|
243
243
|
def remote_ssh_command(target, command, port = 22, return_command_output: false)
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
return ret
|
250
|
-
else
|
251
|
-
raise "Remote ssh command (#{command}) failed on '#{target}'."
|
252
|
-
end
|
244
|
+
puts "Executing '#{command}' on '#{target}'"
|
245
|
+
if return_command_output
|
246
|
+
ret = %x(#{ssh_command(port)} -T #{target} '#{command.gsub("'", "'\\\\''")}').chomp
|
247
|
+
if $?.success?
|
248
|
+
return ret
|
253
249
|
else
|
254
|
-
|
255
|
-
$?.success? or raise "Remote ssh command (#{command}) failed on '#{target}'."
|
250
|
+
raise "Remote ssh command (#{command}) failed on '#{target}'."
|
256
251
|
end
|
257
252
|
else
|
258
|
-
|
253
|
+
Kernel.system("#{ssh_command(port)} -T #{target} '#{command.gsub("'", "'\\\\''")}'")
|
254
|
+
$?.success? or raise "Remote ssh command (#{command}) failed on '#{target}'."
|
259
255
|
end
|
260
256
|
end
|
261
257
|
|
@@ -196,16 +196,116 @@ end" }
|
|
196
196
|
end
|
197
197
|
|
198
198
|
describe '#add_actions' do
|
199
|
-
it 'adds the corect preinstall action to the component
|
199
|
+
it 'adds the corect preinstall action to the component' do
|
200
200
|
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
201
|
-
comp.add_preinstall_action('chkconfig --list')
|
202
|
-
|
201
|
+
comp.add_preinstall_action(['install', 'upgrade'], ['chkconfig --list', '/bin/true'])
|
202
|
+
comp.add_preinstall_action('install', 'echo "hello, world"')
|
203
|
+
expect(comp._component.preinstall_actions.count).to eq(2)
|
204
|
+
expect(comp._component.preinstall_actions.first.scripts.count).to eq(2)
|
205
|
+
expect(comp._component.preinstall_actions.first.pkg_state.count).to eq(2)
|
206
|
+
expect(comp._component.preinstall_actions.first.pkg_state.first).to eq('install')
|
207
|
+
expect(comp._component.preinstall_actions.first.pkg_state.last).to eq('upgrade')
|
208
|
+
expect(comp._component.preinstall_actions.first.scripts.first).to eq('chkconfig --list')
|
209
|
+
expect(comp._component.preinstall_actions.first.scripts.last).to eq('/bin/true')
|
210
|
+
|
211
|
+
expect(comp._component.preinstall_actions.last.scripts.count).to eq(1)
|
212
|
+
expect(comp._component.preinstall_actions.last.pkg_state.count).to eq(1)
|
213
|
+
expect(comp._component.preinstall_actions.last.pkg_state.first).to eq('install')
|
214
|
+
expect(comp._component.preinstall_actions.last.scripts.first).to eq('echo "hello, world"')
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'fails with bad preinstall action' do
|
218
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
219
|
+
expect { comp.add_preinstall_action('foo', '/bin/true') }.to raise_error(Vanagon::Error)
|
220
|
+
end
|
221
|
+
|
222
|
+
it 'fails with empty preinstall action' do
|
223
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
224
|
+
expect { comp.add_preinstall_action([], '/bin/true') }.to raise_error(Vanagon::Error)
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'adds the corect postinstall action to the component' do
|
228
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
229
|
+
comp.add_postinstall_action(['install', 'upgrade'], ['chkconfig --list', '/bin/true'])
|
230
|
+
comp.add_postinstall_action('install', 'echo "hello, world"')
|
231
|
+
expect(comp._component.postinstall_actions.count).to eq(2)
|
232
|
+
expect(comp._component.postinstall_actions.first.scripts.count).to eq(2)
|
233
|
+
expect(comp._component.postinstall_actions.first.pkg_state.count).to eq(2)
|
234
|
+
expect(comp._component.postinstall_actions.first.pkg_state.first).to eq('install')
|
235
|
+
expect(comp._component.postinstall_actions.first.pkg_state.last).to eq('upgrade')
|
236
|
+
expect(comp._component.postinstall_actions.first.scripts.first).to eq('chkconfig --list')
|
237
|
+
expect(comp._component.postinstall_actions.first.scripts.last).to eq('/bin/true')
|
238
|
+
|
239
|
+
expect(comp._component.postinstall_actions.last.scripts.count).to eq(1)
|
240
|
+
expect(comp._component.postinstall_actions.last.pkg_state.count).to eq(1)
|
241
|
+
expect(comp._component.postinstall_actions.last.pkg_state.first).to eq('install')
|
242
|
+
expect(comp._component.postinstall_actions.last.scripts.first).to eq('echo "hello, world"')
|
243
|
+
end
|
244
|
+
|
245
|
+
it 'fails with bad postinstall action' do
|
246
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
247
|
+
expect { comp.add_postinstall_action('foo', '/bin/true') }.to raise_error(Vanagon::Error)
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'fails with empty postinstall action' do
|
251
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
252
|
+
expect { comp.add_postinstall_action([], '/bin/true') }.to raise_error(Vanagon::Error)
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'adds the corect preremove action to the component' do
|
256
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
257
|
+
comp.add_preremove_action(['removal', 'upgrade'], ['chkconfig --list', '/bin/true'])
|
258
|
+
comp.add_preremove_action('removal', 'echo "hello, world"')
|
259
|
+
expect(comp._component.preremove_actions.count).to eq(2)
|
260
|
+
expect(comp._component.preremove_actions.first.scripts.count).to eq(2)
|
261
|
+
expect(comp._component.preremove_actions.first.pkg_state.count).to eq(2)
|
262
|
+
expect(comp._component.preremove_actions.first.pkg_state.first).to eq('removal')
|
263
|
+
expect(comp._component.preremove_actions.first.pkg_state.last).to eq('upgrade')
|
264
|
+
expect(comp._component.preremove_actions.first.scripts.first).to eq('chkconfig --list')
|
265
|
+
expect(comp._component.preremove_actions.first.scripts.last).to eq('/bin/true')
|
266
|
+
|
267
|
+
expect(comp._component.preremove_actions.last.scripts.count).to eq(1)
|
268
|
+
expect(comp._component.preremove_actions.last.pkg_state.count).to eq(1)
|
269
|
+
expect(comp._component.preremove_actions.last.pkg_state.first).to eq('removal')
|
270
|
+
expect(comp._component.preremove_actions.last.scripts.first).to eq('echo "hello, world"')
|
271
|
+
end
|
272
|
+
|
273
|
+
it 'fails with bad preremove action' do
|
274
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
275
|
+
expect { comp.add_preremove_action('foo', '/bin/true') }.to raise_error(Vanagon::Error)
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'fails with empty preremove action' do
|
279
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
280
|
+
expect { comp.add_preremove_action([], '/bin/true') }.to raise_error(Vanagon::Error)
|
281
|
+
end
|
282
|
+
|
283
|
+
it 'adds the corect postremove action to the component' do
|
284
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
285
|
+
comp.add_postremove_action(['removal', 'upgrade'], ['chkconfig --list', '/bin/true'])
|
286
|
+
comp.add_postremove_action('removal', 'echo "hello, world"')
|
287
|
+
expect(comp._component.postremove_actions.count).to eq(2)
|
288
|
+
expect(comp._component.postremove_actions.first.scripts.count).to eq(2)
|
289
|
+
expect(comp._component.postremove_actions.first.pkg_state.count).to eq(2)
|
290
|
+
expect(comp._component.postremove_actions.first.pkg_state.first).to eq('removal')
|
291
|
+
expect(comp._component.postremove_actions.first.pkg_state.last).to eq('upgrade')
|
292
|
+
expect(comp._component.postremove_actions.first.scripts.first).to eq('chkconfig --list')
|
293
|
+
expect(comp._component.postremove_actions.first.scripts.last).to eq('/bin/true')
|
294
|
+
|
295
|
+
expect(comp._component.postremove_actions.last.scripts.count).to eq(1)
|
296
|
+
expect(comp._component.postremove_actions.last.pkg_state.count).to eq(1)
|
297
|
+
expect(comp._component.postremove_actions.last.pkg_state.first).to eq('removal')
|
298
|
+
expect(comp._component.postremove_actions.last.scripts.first).to eq('echo "hello, world"')
|
299
|
+
end
|
300
|
+
|
301
|
+
it 'fails with bad postremove action' do
|
302
|
+
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
303
|
+
expect { comp.add_postremove_action('foo', '/bin/true') }.to raise_error(Vanagon::Error)
|
203
304
|
end
|
204
305
|
|
205
|
-
it '
|
306
|
+
it 'fails with empty postremove action' do
|
206
307
|
comp = Vanagon::Component::DSL.new('action-test', {}, dummy_platform_sysv)
|
207
|
-
comp.
|
208
|
-
expect(comp._component.postinstall_actions).to include("chkconfig --list")
|
308
|
+
expect { comp.add_postremove_action([], '/bin/true') }.to raise_error(Vanagon::Error)
|
209
309
|
end
|
210
310
|
end
|
211
311
|
|
@@ -38,6 +38,8 @@ describe 'Vanagon::Engine::Pooler' do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'returns nil if there is no env var or file' do
|
41
|
+
expect(File).to receive(:expand_path).with('~/.vanagon-token').and_return(token_filename)
|
42
|
+
expect(File).to receive(:exist?).with(token_filename).and_return(false)
|
41
43
|
expect(Vanagon::Engine::Pooler.new(platform).token).to be_nil
|
42
44
|
end
|
43
45
|
end
|
@@ -5,7 +5,7 @@ describe 'Vanagon::Platform::DSL' do
|
|
5
5
|
let (:el_5_platform_block) { "platform 'el-5-fixture' do |plat| end" }
|
6
6
|
let (:el_6_platform_block) { "platform 'el-6-fixture' do |plat| end" }
|
7
7
|
let (:sles_platform_block) { "platform 'sles-test-fixture' do |plat| end" }
|
8
|
-
let (:
|
8
|
+
let (:cicso_wrlinux_platform_block) { "platform 'cisco-wrlinux-fixture' do |plat| end" }
|
9
9
|
let (:solaris_10_platform_block) { "platform 'solaris-10-fixture' do |plat| end" }
|
10
10
|
let (:solaris_11_platform_block) { "platform 'solaris-11-fixture' do |plat| end" }
|
11
11
|
|
@@ -15,11 +15,12 @@ describe 'Vanagon::Platform::DSL' do
|
|
15
15
|
let(:el_definition) { "http://builds.delivery.puppetlabs.net/puppet-agent/0.2.1/repo_configs/rpm/pl-puppet-agent-0.2.1-el-7-x86_64" }
|
16
16
|
let(:el_definition_rpm) { "http://builds.delivery.puppetlabs.net/puppet-agent/0.2.1/repo_configs/rpm/pl-puppet-agent-0.2.1-release.rpm" }
|
17
17
|
let(:sles_definition) { "http://builds.delivery.puppetlabs.net/puppet-agent/0.2.2/repo_configs/rpm/pl-puppet-agent-0.2.2-sles-12-x86_64" }
|
18
|
-
let(:sles_definition_rpm) { "http://builds.delivery.puppetlabs.net/puppet-agent/0.2.1/repo_configs/rpm/pl-puppet-agent-0.2.1-release.rpm" }
|
19
|
-
let(:
|
18
|
+
let(:sles_definition_rpm) { "http://builds.delivery.puppetlabs.net/puppet-agent/0.2.1/repo_configs/rpm/pl-puppet-agent-0.2.1-release-sles.rpm" }
|
19
|
+
let(:cisco_wrlinux_definition) { "http://builds.delivery.puppetlabs.net/puppet-agent/0.2.1/repo_configs/rpm/pl-puppet-agent-0.2.1-cisco-wrlinux-5-x86_64.repo" }
|
20
20
|
|
21
21
|
let(:hex_value) { "906264d248061b0edb1a576cc9c8f6c7" }
|
22
22
|
|
23
|
+
# These apt_repo, yum_repo, and zypper_repo methods are all deprecated.
|
23
24
|
describe '#apt_repo' do
|
24
25
|
it "grabs the file and adds .list to it" do
|
25
26
|
plat = Vanagon::Platform::DSL.new('debian-test-fixture')
|
@@ -54,26 +55,21 @@ describe 'Vanagon::Platform::DSL' do
|
|
54
55
|
expect(plat._platform.provisioning).to include("curl -o '/etc/yum.repos.d/#{hex_value}-pl-puppet-agent-0.2.1-el-7-x86_64.repo' '#{el_definition}'")
|
55
56
|
end
|
56
57
|
|
57
|
-
|
58
|
-
|
58
|
+
# This test currently covers wrlinux 5 and 7
|
59
|
+
it "downloads the repo file to the correct yum location for wrlinux" do
|
60
|
+
plat = Vanagon::Platform::DSL.new('cisco-wrlinux-fixture')
|
59
61
|
expect(SecureRandom).to receive(:hex).and_return(hex_value)
|
60
|
-
plat.instance_eval(
|
61
|
-
plat.yum_repo(
|
62
|
-
expect(plat._platform.provisioning).to include("curl -o '/etc/yum/repos.d/#{hex_value}-pl-puppet-agent-0.2.1-
|
62
|
+
plat.instance_eval(cicso_wrlinux_platform_block)
|
63
|
+
plat.yum_repo(cisco_wrlinux_definition)
|
64
|
+
expect(plat._platform.provisioning).to include("curl -o '/etc/yum/repos.d/#{hex_value}-pl-puppet-agent-0.2.1-cisco-wrlinux-5-x86_64.repo' '#{cisco_wrlinux_definition}'")
|
63
65
|
end
|
64
66
|
|
65
67
|
describe "installs a rpm when given a rpm" do
|
66
|
-
it 'uses
|
67
|
-
plat = Vanagon::Platform::DSL.new('el-6-fixture')
|
68
|
-
plat.instance_eval(el_6_platform_block)
|
69
|
-
plat.yum_repo(el_definition_rpm)
|
70
|
-
expect(plat._platform.provisioning).to include("yum localinstall -y '#{el_definition_rpm}'")
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'uses rpm on el 5 and lower' do
|
68
|
+
it 'uses rpm everywhere' do
|
74
69
|
plat = Vanagon::Platform::DSL.new('el-5-fixture')
|
75
70
|
plat.instance_eval(el_5_platform_block)
|
76
71
|
plat.yum_repo(el_definition_rpm)
|
72
|
+
expect(plat._platform.provisioning).to include("rpm -q curl > /dev/null || yum -y install curl")
|
77
73
|
expect(plat._platform.provisioning).to include("curl -o local.rpm '#{el_definition_rpm}'; rpm -Uvh local.rpm; rm -f local.rpm")
|
78
74
|
end
|
79
75
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'vanagon/platform'
|
2
|
+
|
3
|
+
describe "Vanagon::Platform::RPM::AIX" do
|
4
|
+
let(:block) {
|
5
|
+
%Q[ platform "aix-5.3-ppc" do |plat|
|
6
|
+
end
|
7
|
+
]
|
8
|
+
}
|
9
|
+
let(:plat) { Vanagon::Platform::DSL.new('aix-5.3-ppc') }
|
10
|
+
|
11
|
+
before do
|
12
|
+
plat.instance_eval(block)
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#rpm_defines' do
|
16
|
+
it "doesn't include dist on aix" do
|
17
|
+
expect(plat._platform.rpm_defines).to_not include('dist')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "aix puts commands in weird places" do
|
22
|
+
it "uses /opt/freeware/bin everwhere" do
|
23
|
+
['tar', 'patch', 'install'].each do |cmd|
|
24
|
+
expect(plat._platform.send(cmd.to_sym)).to eq(File.join('/opt/freeware/bin', cmd))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|