Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change all port parameters to use Stdlib::Port #906

Merged
merged 1 commit into from
Apr 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions manifests/plugin/amqp1.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# Service name or port number on which the AMQP 1.0 intermediary accepts
# connections. This argument must be a string, even if the numeric form
# is used.
# Defaults to '5672'
# Defaults to 5672
#
# [*user*]
# User part of credentials used to authenticate to the AMQP 1.0 intermediary.
Expand Down Expand Up @@ -104,7 +104,7 @@
Boolean $manage_package = $collectd::manage_package,
String $transport = 'metrics',
Stdlib::Host $host = 'localhost',
String $port = '5672',
Stdlib::Port $port = 5672,
String $user = 'guest',
String $password = 'guest',
String $address = 'collectd',
Expand Down
14 changes: 7 additions & 7 deletions manifests/plugin/dns.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Class: collectd::plugin::dns
#
class collectd::plugin::dns (
Enum['present','absent'] $ensure = 'present',
Optional[Stdlib::Compat::Ip_address] $ignoresource = undef,
String $interface = 'any',
Optional[String] $interval = undef,
$manage_package = undef,
$package_name = 'collectd-dns',
Variant[String,Boolean] $selectnumericquerytypes = true,
Enum['present','absent'] $ensure = 'present',
Optional[Stdlib::IP::Address] $ignoresource = undef,
String $interface = 'any',
Optional[String] $interval = undef,
$manage_package = undef,
$package_name = 'collectd-dns',
Variant[String,Boolean] $selectnumericquerytypes = true,
) {

include collectd
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/hddtemp.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://collectd.org/wiki/index.php/Plugin:HDDTemp
class collectd::plugin::hddtemp (
$host = '127.0.0.1',
Integer $port = 7634,
Stdlib::Host $host = '127.0.0.1',
Stdlib::Port $port = 7634,
$ensure = 'present',
$interval = undef,
) {
Expand Down
6 changes: 3 additions & 3 deletions manifests/plugin/mongodb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
String $db_pass,
Enum['absent','present'] $ensure = 'present',
Optional[Variant[String,Float]] $interval = undef,
Stdlib::Compat::Ip_address $db_host = '127.0.0.1',
Optional[String] $db_port = 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',
) {

include collectd

if $configured_dbs {
assert_type(String, $db_port)
assert_type(Stdlib::Port, $db_port)
}

collectd::plugin { 'mongodb':
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/mysql/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
String $host = 'UNSET',
String $username = 'UNSET',
String $password = 'UNSET',
String $port = '3306',
Stdlib::Port $port = 3306,
Boolean $masterstats = false,
Boolean $slavestats = false,
Optional[String] $socket = undef,
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/network/listener.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
define collectd::plugin::network::listener (
Enum['present', 'absent'] $ensure = 'present',
Optional[Stdlib::Absolutepath] $authfile = undef,
Optional[Integer] $port = undef,
Optional[Stdlib::Port] $port = undef,
Optional[Collectd::Network::SecurityLevel] $securitylevel = undef,
Optional[String] $interface = undef,
) {
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/network/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Enum['present', 'absent'] $ensure = 'present',
Optional[String] $username = undef,
Optional[String] $password = undef,
Optional[Integer] $port = undef,
Optional[Stdlib::Port] $port = undef,
Optional[Collectd::Network::SecurityLevel] $securitylevel = undef,
Optional[String] $interface = undef,
Optional[Boolean] $forward = undef,
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/ntpd.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# https://collectd.org/wiki/index.php/Plugin:NTPd
class collectd::plugin::ntpd (
$ensure = 'present',
$host = 'localhost',
$port = 123,
Stdlib::Host $host = 'localhost',
Stdlib::Port $port = 123,
$reverselookups = false,
$includeunitid = false,
$interval = undef,
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/ovs_events.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# Defaults to 'collectd-ovs_stats'
#
# [*port*]
# TCP-port to connect to. Either a service name or a port number may be given.
# TCP-port to connect to.
#
# [*socket*]
# The UNIX domain socket path of OVS DB server JSON-RPC interface used
Expand All @@ -50,7 +50,7 @@
Boolean $manage_package = true,
Optional[Boolean] $send_notification = undef,
String $package_name = 'collectd-ovs-events',
Optional[Integer] $port = undef,
Optional[Stdlib::Port] $port = undef,
Optional[String] $socket = undef,
) {

Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/ovs_stats.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# Defaults to 'collectd-ovs_stats'
#
# [*port*]
# TCP-port to connect to. Either a service name or a port number may be given.
# TCP-port to connect to.
igalic marked this conversation as resolved.
Show resolved Hide resolved
#
# [*socket*]
# The UNIX domain socket path of OVS DB server JSON-RPC interface used
Expand All @@ -39,7 +39,7 @@
String $ensure = 'present',
Boolean $manage_package = true,
String $package_name = 'collectd-ovs-stats',
Optional[Integer] $port = undef,
Optional[Stdlib::Port] $port = undef,
Optional[String] $socket = undef,
) {

Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/postgresql/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# useful if you have multiple instances of different version of pg
define collectd::plugin::postgresql::database (
$ensure = 'present',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could use more types ;)

$host = undef,
Optional[Stdlib::Host] $host = undef,
$databasename = $name,
$port = undef,
Optional[Stdlib::Port] $port = undef,
$user = undef,
$password = undef,
$sslmode = undef,
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/statsd.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# https://collectd.org/wiki/index.php/Plugin:StatsD
class collectd::plugin::statsd (
$ensure = 'present',
$host = undef,
$port = undef,
Optional[Stdlib::Host] $host = undef,
Optional[Stdlib::Port] $port = undef,
$deletecounters = undef,
$deletetimers = undef,
$deletegauges = undef,
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/tcpconns.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://collectd.org/wiki/index.php/Plugin:TCPConns
class collectd::plugin::tcpconns (
Optional[Array] $localports = undef,
Optional[Array] $remoteports = undef,
Optional[Array[Stdlib::Port]] $localports = undef,
Optional[Array[Stdlib::Port]] $remoteports = undef,
$listening = undef,
$interval = undef,
Optional[Boolean] $allportssummary = undef,
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/write_graphite/carbon.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# a single graphite backend
define collectd::plugin::write_graphite::carbon (
$ensure = 'present',
$graphitehost = 'localhost',
$graphiteport = 2003,
Stdlib::Host $graphitehost = 'localhost',
Stdlib::Port $graphiteport = 2003,
Boolean $storerates = true,
$graphiteprefix = 'collectd.',
$graphitepostfix = undef,
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/write_kafka.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$ensure = 'present',
$kafka_host = undef,
Array[String] $kafka_hosts = ['localhost:9092'],
$kafka_port = 9092,
Stdlib::Port $kafka_port = 9092,
Hash $topics = {},
Hash $properties = {},
Hash $meta = {},
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/write_prometheus.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class collectd::plugin::write_prometheus (
String $port = '9103',
$ensure = 'present',
Stdlib::Port $port = 9103,
$ensure = 'present',
) {

include collectd
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/write_sensu.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
class collectd::plugin::write_sensu (
$ensure = 'present',
$manage_package = undef,
$sensu_host = 'localhost',
$sensu_port = 3030,
Stdlib::Host $sensu_host = 'localhost',
Stdlib::Port $sensu_port = 3030,
Boolean $store_rates = false,
Boolean $always_append_ds = false,
$metrics = false,
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/write_tsdb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
class collectd::plugin::write_tsdb (
$ensure = present,
Boolean $globals = false,
$host = 'localhost',
$port = 4242,
Stdlib::Host $host = 'localhost',
Stdlib::Port $port = 4242,
Array $host_tags = [],
Boolean $store_rates = false,
Boolean $always_append_ds = false,
Expand Down
4 changes: 2 additions & 2 deletions manifests/plugin/zookeeper.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class collectd::plugin::zookeeper (
Enum['present', 'absent'] $ensure = 'present',
Optional[Integer] $interval = undef,
String $zookeeper_host = 'localhost',
String $zookeeper_port = '2181',
Stdlib::Host $zookeeper_host = 'localhost',
Stdlib::Port $zookeeper_port = 2181,
) {

include collectd
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/collectd_plugin_amqp1_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{ ensure: 'present',
transport: 'transport',
host: 'host',
port: 'port',
port: 666,
user: 'user',
password: 'password',
address: 'address',
Expand All @@ -63,7 +63,7 @@

it { is_expected.to contain_file('amqp1.load').with(content: %r{<Transport "transport">}) }
it { is_expected.to contain_file('amqp1.load').with(content: %r{Host "host"}) }
it { is_expected.to contain_file('amqp1.load').with(content: %r{Port "port"}) }
it { is_expected.to contain_file('amqp1.load').with(content: %r{Port "666"}) }
it { is_expected.to contain_file('amqp1.load').with(content: %r{User "user"}) }
it { is_expected.to contain_file('amqp1.load').with(content: %r{Password "password"}) }
it { is_expected.to contain_file('amqp1.load').with(content: %r{Address "address"}) }
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/collectd_plugin_mongodb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
context 'set to a valid value with db_port defined and a single db' do
let :params do
default_params.merge(configured_dbs: [25],
db_port: '8080')
db_port: 8080)
end

dbport_single_fixture = File.read(fixtures('plugins/mongodb.conf.configured_dbs_single'))
Expand All @@ -110,7 +110,7 @@
context 'set to a valid value with db_port defined and multiple DBs' do
let :params do
default_params.merge(configured_dbs: [25, 26],
db_port: '8080')
db_port: 8080)
end

dbport_multi_fixture = File.read(fixtures('plugins/mongodb.conf.configured_dbs_multiple'))
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_mysql_database_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
'aliasname' => 'fancyname',
'host' => 'database.serv.er',
'port' => '8010',
'port' => 8010,
'username' => 'db_user',
'password' => 'secret',
'sslkey' => '/path/to/key.pem',
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/collectd_plugin_postgresql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
'host' => 'localhost',
'user' => 'postgres',
'password' => 'postgres',
'port' => '5432',
'port' => 5432,
'sslmode' => 'disable',
'query' => %w[disk_io log_delay]
},
Expand All @@ -88,7 +88,7 @@
'host' => 'localhost',
'user' => 'postgres',
'password' => 'postgres',
'port' => '5433',
'port' => 5433,
'sslmode' => 'disable',
'query' => %w[disk_io log_delay]

Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_statsd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{
ensure: 'present',
host: '192.0.0.1',
port: '9876'
port: 9876
}
end

Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_write_kafka_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
options = os_specific_options(facts)
context ':ensure => present and :kafka_host => \'myhost\'' do
let :params do
{ kafka_host: 'myhost', kafka_port: '9092', topics: { 'my-topic' => { 'format' => 'JSON' } }, properties: { 'my-property' => 'my-value' }, meta: { 'my-meta' => 'my-value' } }
{ kafka_host: 'myhost', kafka_port: 9092, topics: { 'my-topic' => { 'format' => 'JSON' } }, properties: { 'my-property' => 'my-value' }, meta: { 'my-meta' => 'my-value' } }
end

it "Will create #{options[:plugin_conf_dir]}/10-write_kafka.conf" do
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/collectd_plugin_write_prometheus_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
end

options = os_specific_options(facts)
context ':ensure => present and :port => "9103"' do
context ':ensure => present and :port => 9103' do
let :params do
{ port: '9103' }
{ port: 9103 }
end

it "Will create #{options[:plugin_conf_dir]}/10-write_prometheus.conf" do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_zookeeper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

context ":ensure => present and :zookeeper_host => 'myhost'" do
let :params do
{ zookeeper_host: 'myhost', zookeeper_port: '2181' }
{ zookeeper_host: 'myhost', zookeeper_port: 2181 }
end

it "Will create #{options[:plugin_conf_dir]}/10-zookeeper.load" do
Expand Down
2 changes: 1 addition & 1 deletion types/redis/node.pp
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#
type Collectd::Redis::Node = Struct[{Optional['host'] => String[1], Optional['port'] => Variant[Integer[0, 65535], String[1]], Optional['password'] => String[1], Optional['timeout'] => Integer[0], Optional['queries'] => Hash[String[1], Hash[String[1], String[1]]]}]
type Collectd::Redis::Node = Struct[{Optional['host'] => String[1], Optional['port'] => Variant[Stdlib::Port, String[1]], Optional['password'] => String[1], Optional['timeout'] => Integer[0], Optional['queries'] => Hash[String[1], Hash[String[1], String[1]]]}]