With LDAP enabled and snap install, templating cannot use the'grafana' user

Bug #1964725 reported by Xav Paice
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Grafana Charm
Fix Released
Undecided
Unassigned

Bug Description

When installed from snap, and attempting to configure LDAP, we receive a traceback:

2022-03-13 22:01:10 INFO unit.grafana/0.juju-log server.go:327 Invoking reactive handler: reactive/grafana.py:1440:configure_ldap_authentication
2022-03-13 22:01:10 INFO unit.grafana/0.juju-log server.go:327 Setting up LDAP auth...

2022-03-13 22:01:10 ERROR unit.grafana/0.juju-log server.go:327 Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-grafana-0/.venv/lib/python3.6/site-packages/charms/reactive/__init__.py", line 74, in main
    bus.dispatch(restricted=restricted_mode)
  File "/var/lib/juju/agents/unit-grafana-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 390, in dispatch
    _invoke(other_handlers)
  File "/var/lib/juju/agents/unit-grafana-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 359, in _invoke
    handler.invoke()
  File "/var/lib/juju/agents/unit-grafana-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 181, in invoke
    self._action(*args)
  File "/var/lib/juju/agents/unit-grafana-0/charm/reactive/grafana.py", line 1464, in configure_ldap_authentication
    render_ldap_config(config, ldap_toml_path)
  File "lib/charms/layer/grafana.py", line 449, in render_ldap_config
    perms=0o600,
  File "/var/lib/juju/agents/unit-grafana-0/.venv/lib/python3.6/site-packages/charmhelpers/core/templating.py", line 92, in render
    host.write_file(target, content.encode(encoding), owner, group, perms)
  File "/var/lib/juju/agents/unit-grafana-0/.venv/lib/python3.6/site-packages/charmhelpers/core/host.py", line 546, in write_file
    uid = pwd.getpwnam(owner).pw_uid
KeyError: "getpwnam(): name not found: 'grafana'"

There is no 'grafana' user when we install from snap.

Related branches

Xav Paice (xavpaice)
Changed in charm-grafana:
status: New → Fix Committed
Changed in charm-grafana:
milestone: none → 21.10
milestone: 21.10 → 22.10
Changed in charm-grafana:
status: Fix Committed → Fix Released
Changed in charm-grafana:
status: Fix Released → Fix Committed
Changed in charm-grafana:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.