bfraser / puppet-grafana

Puppet module to manage Grafana
Apache License 2.0
39 stars 204 forks source link

Type mismatch for 'login.LdapConfig.servers': when using heira #124

Open tylerfrench opened 7 years ago

tylerfrench commented 7 years ago

I have setup roles and profiles in my puppet environment and am using hiera to setup my grafana node. Everything is working as it should however when adding the config part for ldap i am getting the following error: Type mismatch for 'login.LdapConfig.servers': Expected slice but found 'map[string]interface {}'

I have figured out that the issue is when using hiera the config file needs to be laid out like so:

---
grafana::install_method: 'package'
grafana::cfg:
        app_mode: 'production'
        server:
                http_port: '8080'
        database:
                type: 'mysql'
                host: '172.0.0.1:3306'
                name: 'grafana'
                user: 'root'
                password: 'secretpassword'
        users:
                allow_sign_up: false
        auth.ldap:
                enabled: true
                config_file: '/etc/grafana/ldap.toml'
grafana::ldap_cfg:
        servers:
                host: "dc01.tom.future.lab"
                port: 389
                use_ssl: false
                search_filter: '(sAMAccountName=%s)'
                search_base_dns:
                        - 'dc=tom,dc=future,dc=lab'
                bind_dn: 'user@tom.future.lab'
                bind_password: 'secretpassword'
        servers.attributes:
                name: 'givenName'
                surname: 'sn'
                username: 'cn'
                member_of: 'memberOf'
                email: 'email'

When the ldap.toml file is then generated you get the following:

[servers]
bind_dn = "user@tom.future.lab"
bind_password = "secretpassword"
host = "dc01.tom.future.lab"
port = 389
search_base_dns = ["dc=tom,dc=future,dc=lab"]
search_filter = "(sAMAccountName=%s)"
use_ssl = false

[servers.attributes]
email = "email"
member_of = "memberOf"
name = "givenName"
surname = "sn"
username = "cn"

The config file that is generate has [servers] instead of [[servers]], i was able to get this working by changing the hiera file as follows:

grafana::ldap_cfg:
        '[servers]':

So not sure if this is a module, toml issue, or just something weird...