Skip to content

Commit 49e05ea

Browse files
author
Tim Meusel
committed
implement support for msgpack via package
if serialization_package is provided it is going to be installed, otherwise we imply that serialization_format is a gem (here is currently only msgpack supported)
1 parent 0faca82 commit 49e05ea

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

manifests/agent.pp

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
# ['configtimeout'] - How long the client should wait for the configuration to be retrieved before considering it a failure
2929
# ['stringify_facts'] - Wether puppet transforms structured facts in strings or no. Defaults to true in puppet < 4, deprecated in puppet >=4 (and will default to false)
3030
# ['serialization_format'] - defaults to undef, otherwise it sets the preferred_serialization_format param (currently only msgpack is supported)
31+
# ['serialization_package'] - defaults to undef, if provided, we install this package, otherwise we fall back to the gem from 'serialization_format'
3132
#
3233
# Actions:
3334
# - Install and configures the puppet agent
@@ -68,6 +69,7 @@
6869
$configtimeout = '2m',
6970
$stringify_facts = undef,
7071
$serialization_format = undef,
72+
$serialization_package = undef,
7173
) inherits puppet::params {
7274

7375
if ! defined(User[$::puppet::params::puppet_user]) {
@@ -310,25 +312,31 @@
310312
}
311313
}
312314
if $serialization_format != undef {
313-
if $serialization_format == 'msgpack' {
314-
unless defined(Package[$::puppet::params::ruby_dev]) {
315-
package {$::puppet::params::ruby_dev:
316-
ensure => 'latest',
317-
}
318-
} ->
319-
unless defined(Package['gcc']) {
320-
package {'gcc':
315+
if $serialization_package != undef {
316+
package { $serialization_package:
317+
ensure => latest,
318+
}
319+
} else {
320+
if $serialization_format == 'msgpack' {
321+
unless defined(Package[$::puppet::params::ruby_dev]) {
322+
package {$::puppet::params::ruby_dev:
323+
ensure => 'latest',
324+
}
325+
} ->
326+
unless defined(Package['gcc']) {
327+
package {'gcc':
328+
ensure => 'latest',
329+
}
330+
} ->
331+
package {'msgpack':
321332
ensure => 'latest',
333+
provider => 'gem',
322334
}
323-
} ->
324-
package {'msgpack':
325-
ensure => 'latest',
326-
provider => 'gem',
327335
}
328336
}
329337
ini_setting {'puppetagentserializationformat':
330338
setting => 'preferred_serialization_format',
331-
value => $serialization_format
339+
value => $serialization_format,
332340
}
333341
}
334342
}

0 commit comments

Comments
 (0)