Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Example of using in module data to avoid PUP-6453 #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
wordpress_app::database_profile::port: '3306'
6 changes: 6 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
version: 4
datadir: 'data'
hierarchy:
- name: 'common'
backend: 'yaml'
3 changes: 2 additions & 1 deletion manifests/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
user => "${user}@localhost",
}
}

Wordpress_app::Database produces Database {
host => $::fqdn,
port => '3306',
port => lookup('wordpress_app::database_profile::port'),
provider => 'tcp',
}
10 changes: 10 additions & 0 deletions manifests/database_profile.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
class wordpress_app::database_profile (
# Must only be set with lookup or Wordpress_app::Database produces Database will be wrong
String $port,
String $bind_address = '0.0.0.0',
) {

# If $port doesn't match the lookup value this should fail to prevent inaccurate
# database capabilities.
if ($port != lookup('wordpress_app::database_profile::port')) {
fail("\$wordpress_app::database_profile::port can only be set via puppet lookup.")
}

notify {"port is getting ${port}": }
class { 'mysql::server':
override_options => {
'mysqld' => {
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"source": "https://github.com/puppetlabs/puppetlabs-wordpress_app",
"project_page": "https://github.com/puppetlabs/puppetlabs-wordpress_app",
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
"data_provider": "hiera",

Choose a reason for hiding this comment

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

What does this do? I'm a lookup newb.

"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down Expand Up @@ -59,7 +60,6 @@
{"name":"hunner-wordpress","version_requirement":">=1.0.0 <2.0.0"},
{"name":"hunner-wordpress","version_requirement":">=1.0.0 <2.0.0"},
{"name":"jfryman-selinux","version_requirement":">=0.4.0 <0.5.0"}
],
"data_provider": null
]
}