Skip to content

Commit e68157d

Browse files
Scott Cabrinhatruthbk
authored andcommitted
pass in password via hiera (DataDog#514)
* pass in password via hiera We should be able to use this class with `include datadog_agent::integrations::postgres`, but without specifying a password, this fails: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Class[Datadog_agent::Integrations::Postgres]: expects a value for parameter 'password' * it should compile with default params
1 parent 1ba0484 commit e68157d

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

manifests/integrations/postgres.pp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,26 @@
6464
# }
6565
# }
6666
# }
67+
#
68+
# Hiera Usage:
6769
#
70+
# datadog_agent::integrations::postgres::instances:
71+
# - host: 'localhost'
72+
# dbname: 'postgres'
73+
# username: 'datadog'
74+
# password: 'some_pass'
75+
# ssl: false
76+
# custom_metrics:
77+
# a_custom_query:
78+
# query: 'select tag_column, %s from table'
79+
# relation: false
80+
# metrics:
81+
# value_column: ["value_column.datadog.tag", "GAUGE"]
82+
# descriptors:
83+
# - ["tag_column", "tag_column.datadog.tag"]
6884
#
6985
class datadog_agent::integrations::postgres(
70-
String $password,
86+
Optional[String] $password = undef,
7187
String $host = 'localhost',
7288
String $dbname = 'postgres',
7389
Variant[String, Integer] $port = '5432',

spec/classes/datadog_agent_integrations_postgres_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
end
2525

2626
context 'with default parameters' do
27-
it { should_not compile }
27+
it { should compile }
2828
end
2929

3030
context 'with password set' do

0 commit comments

Comments
 (0)