Skip to content

Commit

Permalink
Add backwards compatibility in transition to Stdlib::Host
Browse files Browse the repository at this point in the history
Patch [1] changed all `port` parameters to use `Stdlib::Port`. When
moving from String type to the new type, this patch is backwards
incompatible leading to type errors when applying manifest. This patch
is using Variant type to make this change backwards compatible and ease
transition to new versions of puppet-collectd.

[1] voxpupuli@d7b79c5
  • Loading branch information
amoralej committed Apr 6, 2020
1 parent a556938 commit fd84350
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion manifests/plugin/amqp1.pp
Expand Up @@ -104,7 +104,7 @@
Boolean $manage_package = $collectd::manage_package,
String $transport = 'metrics',
Stdlib::Host $host = 'localhost',
Stdlib::Port $port = 5672,
Variant[Stdlib::Port,String] $port = 5672,
String $user = 'guest',
String $password = 'guest',
String $address = 'collectd',
Expand Down
12 changes: 6 additions & 6 deletions manifests/plugin/mongodb.pp
Expand Up @@ -3,12 +3,12 @@
class collectd::plugin::mongodb (
String $db_user,
String $db_pass,
Enum['absent','present'] $ensure = 'present',
Optional[Variant[String,Float]] $interval = undef,
Stdlib::Host $db_host = '127.0.0.1',
Optional[Stdlib::Port] $db_port = undef,
Optional[Array] $configured_dbs = undef,
$collectd_dir = '/usr/lib/collectd',
Enum['absent','present'] $ensure = 'present',
Optional[Variant[String,Float]] $interval = undef,
Stdlib::Host $db_host = '127.0.0.1',
Optional[Variant[Stdlib::Port,String]] $db_port = undef,
Optional[Array] $configured_dbs = undef,
$collectd_dir = '/usr/lib/collectd',
) {

include collectd
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/mysql/database.pp
Expand Up @@ -5,7 +5,7 @@
String $host = 'UNSET',
String $username = 'UNSET',
String $password = 'UNSET',
Stdlib::Port $port = 3306,
Variant[Stdlib::Port,String] $port = 3306,
Boolean $masterstats = false,
Boolean $slavestats = false,
Optional[String] $socket = undef,
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/write_prometheus.pp
@@ -1,5 +1,5 @@
class collectd::plugin::write_prometheus (
Stdlib::Port $port = 9103,
Variant[Stdlib::Port,String] $port = 9103,
$ensure = 'present',
) {

Expand Down
8 changes: 4 additions & 4 deletions manifests/plugin/zookeeper.pp
@@ -1,8 +1,8 @@
class collectd::plugin::zookeeper (
Enum['present', 'absent'] $ensure = 'present',
Optional[Integer] $interval = undef,
Stdlib::Host $zookeeper_host = 'localhost',
Stdlib::Port $zookeeper_port = 2181,
Enum['present', 'absent'] $ensure = 'present',
Optional[Integer] $interval = undef,
Stdlib::Host $zookeeper_host = 'localhost',
Variant[Stdlib::Port,String] $zookeeper_port = 2181,
) {

include collectd
Expand Down

0 comments on commit fd84350

Please sign in to comment.