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

hardcode path to /etc/grafana ( ldap.toml ) #257

Open
olevole opened this issue Sep 14, 2021 · 2 comments
Open

hardcode path to /etc/grafana ( ldap.toml ) #257

olevole opened this issue Sep 14, 2021 · 2 comments

Comments

@olevole
Copy link

olevole commented Sep 14, 2021

I would like to avoid hardcode paths in the module code: https://github.com/voxpupuli/puppet-grafana/blob/v9.0.1/manifests/config.pp#L94 (was added by 8f1f6e92 )

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.2.1
  • Ruby: 2.7.4
  • Distribution: FreeBSD
  • Module version: 9.0.2-rc0

How to reproduce (e.g Puppet code you use)

Try using any arbitrary directory instead of /etc/grafana

What are you seeing

What behaviour did you expect instead

I would like to be able to choose file paths, getting rid of the hardcode.

Output log

Any additional information you'd like to impart

I would like to use an additional variable, by analogy with cfg_location:

diff --git a/data/common.yaml b/data/common.yaml
index 28bb0ac..0db6045 100644
--- a/data/common.yaml
+++ b/data/common.yaml
@@ -3,6 +3,7 @@ grafana::archive_source: ~
 grafana::cfg_location: '/etc/grafana/grafana.ini'
 grafana::cfg: {}
 grafana::ldap_cfg: ~
+grafana::ldap_cfg_location: '/etc/grafana/ldap.toml'
 grafana::container_cfg: false
 grafana::container_params: {}
 grafana::docker_image: 'grafana/grafana'
diff --git a/manifests/config.pp b/manifests/config.pp
index 341269f..f593701 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -91,7 +91,7 @@ class grafana::config {
 
     $ldap_cfg_toml = inline_template($template_body.join(''))
 
-    file { '/etc/grafana/ldap.toml':
+    file { $grafana::ldap_cfg_location:
       ensure  => file,
       content => $ldap_cfg_toml,
       owner   => 'grafana',
diff --git a/manifests/init.pp b/manifests/init.pp
index 69a4552..14eb11c 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -138,6 +138,7 @@ class grafana (
   String $cfg_location,
   Hash $cfg,
   Optional[Variant[Hash,Array]] $ldap_cfg,
+  String $ldap_cfg_location,
   Boolean $container_cfg,
   Hash $container_params,
   String $docker_image,
@olevole
Copy link
Author

olevole commented Sep 14, 2021

my version: olevole@7dae575

@ghoneycutt
Copy link
Member

Could you please open a PR?

olevole added a commit to olevole/puppet-grafana that referenced this issue Sep 15, 2021
I would like to avoid hardcode paths, voxpupuli#257
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants