canonical / postgresql-operator

A Charmed Operator for running PostgreSQL on machines
https://charmhub.io/postgresql
Apache License 2.0
8 stars 19 forks source link

SyntaxError when trying to create an admin user with data-integrator relation #182

Closed gustavosr98 closed 1 year ago

gustavosr98 commented 1 year ago

Steps to reproduce

juju deploy postgresql
juju deploy data-integrator postgresql-admin --to 1
juju config postgresql-admin database-name=maas extra-user-roles=admin
juju relate  postgresql postgresql-admin

Expected behavior

Relation to work

Actual behavior

➜  ~ juju status
Model    Controller  Cloud/Region         Version  SLA          Timestamp
default  lxd         localhost/localhost  2.9.42   unsupported  15:58:08-05:00

App               Version  Status   Scale  Charm            Channel    Rev  Exposed  Message
postgresql        14.7     blocked      1  postgresql       14/stable  288  no       Failed to initialize database relation
postgresql-admin           blocked      1  data-integrator  stable      11  no       Please relate the data-integrator with the desired product

Unit                 Workload  Agent  Machine  Public address  Ports  Message
postgresql-admin/0*  blocked   idle   1        10.46.90.163           Please relate the data-integrator with the desired product
postgresql/1*        blocked   idle   1        10.46.90.163           Failed to initialize database relation

Machine  State    Address       Inst id        Series  AZ  Message
1        started  10.46.90.163  juju-f9c688-1  jammy       Running

Versions

Operating system: Jammy Juju CLI: 2.9.43 Juju agent: 2.9.42 LXD: 5.1

Charm versions:

Log output

# [..]
controller-0: 15:39:42 INFO juju.worker.provisioner entering provisioner task loop; using provisioner pool with 16 workers
controller-0: 15:39:42 INFO juju.worker.provisioner provisioning in zones: [black]
controller-0: 15:40:34 INFO juju.worker.provisioner provisioning in zones: [black]
controller-0: 15:40:34 INFO juju.worker.provisioner found machine pending provisioning id:1, details:1
controller-0: 15:40:36 INFO juju.worker.provisioner trying machine 1 StartInstance in availability zone black
controller-0: 15:40:50 INFO juju.worker.provisioner started machine 1 as instance juju-f9c688-1 with hardware "arch=amd64 cores=0 mem=0M", network config [], volumes [], volume attachments map[], subnets to zones [], lxd profiles []
controller-0: 15:40:54 INFO juju.worker.instancemutater.environ no changes necessary to machine-1 lxd profiles ([default juju-default])
controller-0: 15:40:57 INFO juju.worker.instancepoller machine "1" (instance ID "juju-f9c688-1") instance status changed from {"running" "Container started"} to {"running" "Running"}
controller-0: 15:40:57 INFO juju.worker.instancepoller machine "1" (instance ID "juju-f9c688-1") has new addresses: [local-cloud:10.46.90.163@alpha]
machine-1: 15:43:23 INFO juju.cmd running jujud [2.9.42 7b871e782195bdac9c90f8a8f01723cc3e08ab92 gc go1.19.6]
machine-1: 15:43:23 DEBUG juju.cmd   args: []string{"/var/lib/juju/tools/machine-1/jujud", "machine", "--data-dir", "/var/lib/juju", "--machine-id", "1", "--debug"}
machine-1: 15:43:23 DEBUG juju.utils setting GOMAXPROCS to 12
machine-1: 15:43:23 DEBUG juju.agent read agent config, format "2.0"
machine-1: 15:43:23 INFO juju.worker.upgradesteps upgrade steps for 2.9.42 have already been run.
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrade-check-gate" manifold worker started at 2023-07-12 20:43:23.048049541 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "termination-signal-handler" manifold worker started at 2023-07-12 20:43:23.051009689 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrade-check-flag" manifold worker started at 2023-07-12 20:43:23.051574734 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "agent" manifold worker started at 2023-07-12 20:43:23.053446539 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "state-config-watcher" manifold worker started at 2023-07-12 20:43:23.055906314 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "api-config-watcher" manifold worker started at 2023-07-12 20:43:23.055964329 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "clock" manifold worker started at 2023-07-12 20:43:23.056118567 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrade-steps-gate" manifold worker started at 2023-07-12 20:43:23.057021241 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "syslog" manifold worker started at 2023-07-12 20:43:23.057507633 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.apicaller connecting with old password
machine-1: 15:43:23 DEBUG juju.worker.introspection introspection worker listening on "@jujud-machine-1"
machine-1: 15:43:23 DEBUG juju.worker.introspection stats worker now serving
machine-1: 15:43:23 DEBUG juju.api successfully dialed "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
machine-1: 15:43:23 INFO juju.api connection established to "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
machine-1: 15:43:23 DEBUG juju.worker.dependency "is-not-controller-flag" manifold worker started at 2023-07-12 20:43:23.066581602 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "is-controller-flag" manifold worker started at 2023-07-12 20:43:23.066737945 +0000 UTC
machine-1: 15:43:23 INFO juju.worker.apicaller [70e3fa] "machine-1" successfully connected to "10.46.90.219:17070"
machine-1: 15:43:23 DEBUG juju.worker.apicaller changing password...
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrade-steps-flag" manifold worker started at 2023-07-12 20:43:23.068654426 +0000 UTC
machine-1: 15:43:23 INFO juju.worker.apicaller [70e3fa] password changed for "machine-1"
machine-1: 15:43:23 DEBUG juju.api RPC connection died
machine-1: 15:43:23 DEBUG juju.worker.dependency "api-caller" manifold worker stopped: restart immediately
machine-1: 15:43:23 DEBUG juju.worker.apicaller connecting with current password
machine-1: 15:43:23 DEBUG juju.api successfully dialed "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
machine-1: 15:43:23 INFO juju.api connection established to "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
machine-1: 15:43:23 INFO juju.worker.apicaller [70e3fa] "machine-1" successfully connected to "10.46.90.219:17070"
machine-1: 15:43:23 DEBUG juju.worker.dependency "api-caller" manifold worker started at 2023-07-12 20:43:23.109172068 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "migration-inactive-flag" manifold worker started at 2023-07-12 20:43:23.120577321 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrader" manifold worker started at 2023-07-12 20:43:23.120715659 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrade-steps-runner" manifold worker started at 2023-07-12 20:43:23.12076289 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrade-steps-runner" manifold worker completed successfully
machine-1: 15:43:23 DEBUG juju.worker.dependency "valid-credential-flag" manifold worker started at 2023-07-12 20:43:23.143169039 +0000 UTC
machine-1: 15:43:23 INFO juju.worker.upgrader desired agent binary version: 2.9.42
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrade-check-flag" manifold worker stopped: gate unlocked
stack trace:
github.com/juju/juju/worker/gate.init:95: gate unlocked
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrade-check-flag" manifold worker started at 2023-07-12 20:43:23.154488615 +0000 UTC
machine-1: 15:43:23 INFO juju.worker.deployer new context: units "", stopped ""
machine-1: 15:43:23 DEBUG juju.worker.dependency "deployer" manifold worker started at 2023-07-12 20:43:23.165613941 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "migration-fortress" manifold worker started at 2023-07-12 20:43:23.16567375 +0000 UTC
machine-1: 15:43:23 INFO juju.worker.deployer checking unit "postgresql/1"
machine-1: 15:43:23 DEBUG juju.worker.dependency "migration-minion" manifold worker started at 2023-07-12 20:43:23.175952745 +0000 UTC
machine-1: 15:43:23 INFO juju.worker.migrationminion migration phase is now: NONE
machine-1: 15:43:23 DEBUG juju.worker.dependency "ssh-authkeys-updater" manifold worker started at 2023-07-12 20:43:23.189386455 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "state-converter" manifold worker started at 2023-07-12 20:43:23.189595704 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.fanconfigurer Processing new fan config
machine-1: 15:43:23 DEBUG juju.worker.machinesetup Starting machine setup requiring an API connection
machine-1: 15:43:23 DEBUG juju.worker.dependency "host-key-reporter" manifold worker started at 2023-07-12 20:43:23.189878739 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "log-sender" manifold worker started at 2023-07-12 20:43:23.189988146 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "api-address-updater" manifold worker started at 2023-07-12 20:43:23.190082862 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "proxy-config-updater" manifold worker started at 2023-07-12 20:43:23.190150189 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.logger initial log config: "<root>=DEBUG"
machine-1: 15:43:23 DEBUG juju.worker.dependency "storage-provisioner" manifold worker started at 2023-07-12 20:43:23.19023516 +0000 UTC
machine-1: 15:43:23 INFO juju.worker.logger logger worker started
machine-1: 15:43:23 DEBUG juju.worker.dependency "reboot-executor" manifold worker started at 2023-07-12 20:43:23.190501775 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "machine-action-runner" manifold worker started at 2023-07-12 20:43:23.190783486 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "disk-manager" manifold worker started at 2023-07-12 20:43:23.190922667 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "upgrade-series" manifold worker started at 2023-07-12 20:43:23.191001295 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "logging-config-updater" manifold worker started at 2023-07-12 20:43:23.191085659 +0000 UTC
machine-1: 15:43:23 DEBUG juju.worker.dependency "agent-config-updater" manifold worker stopped: resource permanently unavailable
stack trace:
resource permanently unavailable
github.com/juju/juju/worker/fortress.Occupy:63: 
github.com/juju/juju/cmd/jujud/agent/engine.occupyStart.func1:93: 
machine-1: 15:43:23 DEBUG juju.utils.ssh reading authorised keys file /home/ubuntu/.ssh/authorized_keys
machine-1: 15:43:23 DEBUG juju.utils.ssh reading authorised keys file /home/ubuntu/.ssh/authorized_keys
machine-1: 15:43:23 DEBUG juju.worker.proxyupdater applying in-process legacy proxy settings proxy.Settings{Http:"", Https:"", Ftp:"", NoProxy:"10.46.90.219,127.0.0.1,::1,localhost", AutoNoProxy:""}
machine-1: 15:43:23 DEBUG juju.service discovered init system "systemd" from series "jammy"
machine-1: 15:43:23 DEBUG juju.utils.ssh writing authorised keys file /home/ubuntu/.ssh/authorized_keys
machine-1: 15:43:23 INFO juju.worker.deployer deploying unit "postgresql/1"
machine-1: 15:43:23 DEBUG juju.network no lxc bridge addresses to filter for machine
machine-1: 15:43:23 DEBUG juju.worker.dependency "kvm-container-provisioner" manifold worker stopped: container types
stack trace:
github.com/juju/juju/worker/provisioner.ContainerManifoldConfig.machineSupportsContainers:175: container types
github.com/juju/juju/worker/fortress.Occupy:63: 
github.com/juju/juju/cmd/jujud/agent/engine.occupyStart.func1:93: 
machine-1: 15:43:23 DEBUG juju.network cannot get "lxdbr0" addresses: route ip+net: no such network interface (ignoring)
machine-1: 15:43:23 ERROR juju.worker.dependency "kvm-container-provisioner" manifold worker returned unexpected error: container types
machine-1: 15:43:23 DEBUG juju.network cannot get "virbr0" addresses: route ip+net: no such network interface (ignoring)
machine-1: 15:43:23 DEBUG juju.network including address local-cloud:10.46.90.219 for machine
machine-1: 15:43:23 DEBUG juju.network including address local-machine:127.0.0.1 for machine
machine-1: 15:43:23 DEBUG juju.worker.dependency "lxd-container-provisioner" manifold worker stopped: container types
stack trace:
github.com/juju/juju/worker/provisioner.ContainerManifoldConfig.machineSupportsContainers:175: container types
github.com/juju/juju/worker/fortress.Occupy:63: 
github.com/juju/juju/cmd/jujud/agent/engine.occupyStart.func1:93: 
machine-1: 15:43:23 DEBUG juju.network including address local-machine:::1 for machine
machine-1: 15:43:23 ERROR juju.worker.dependency "lxd-container-provisioner" manifold worker returned unexpected error: container types
machine-1: 15:43:23 DEBUG juju.network addresses after filtering: [local-cloud:10.46.90.219 local-machine:127.0.0.1 local-machine:::1]
machine-1: 15:43:23 DEBUG juju.worker.apiaddressupdater updating API hostPorts to [[10.46.90.219:17070 127.0.0.1:17070 [::1]:17070]]
machine-1: 15:43:23 DEBUG juju.agent API server address details [["10.46.90.219:17070" "127.0.0.1:17070" "[::1]:17070"]] written to agent config as ["10.46.90.219:17070"]
machine-1: 15:43:23 INFO juju.worker.authenticationworker "machine-1" key updater worker started
machine-1: 15:43:23 INFO juju.worker.deployer creating new agent config for "postgresql/1"
machine-1: 15:43:23 DEBUG juju.agent read agent config, format "2.0"
machine-1: 15:43:23 INFO juju.worker.deployer starting workers for "postgresql/1"
machine-1: 15:43:23 DEBUG juju.worker.deployer created rotating log file "/var/log/juju/unit-postgresql-1.log" with max size 100 MB and max backups 2
unit-postgresql-1: 15:43:23 INFO juju Starting unit workers for "postgresql/1"
machine-1: 15:43:23 DEBUG juju.worker.introspection introspection worker listening on "@jujud-unit-postgresql-1"
machine-1: 15:43:23 DEBUG juju.worker.introspection stats worker now serving
machine-1: 15:43:23 DEBUG juju.api successfully dialed "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
machine-1: 15:43:23 INFO juju.api connection established to "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
unit-postgresql-1: 15:43:23 INFO juju.worker.apicaller [70e3fa] "unit-postgresql-1" successfully connected to "10.46.90.219:17070"
unit-postgresql-1: 15:43:23 INFO juju.worker.apicaller [70e3fa] password changed for "unit-postgresql-1"
machine-1: 15:43:23 DEBUG juju.api RPC connection died
machine-1: 15:43:23 DEBUG juju.api successfully dialed "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
machine-1: 15:43:23 INFO juju.api connection established to "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
unit-postgresql-1: 15:43:23 INFO juju.worker.apicaller [70e3fa] "unit-postgresql-1" successfully connected to "10.46.90.219:17070"
machine-1: 15:43:23 INFO juju.worker.upgradeseries no series upgrade lock present
machine-1: 15:43:23 DEBUG juju.worker.logger reconfiguring logging from "<root>=DEBUG" to "<root>=INFO"
machine-1: 15:43:23 DEBUG juju.worker.reboot Reboot worker got action: noop
machine-1: 15:43:23 ERROR juju.worker.dependency "broker-tracker" manifold worker returned unexpected error: no container types determined
machine-1: 15:43:23 INFO juju.worker.machiner setting addresses for "machine-1" to [local-machine:127.0.0.1 local-cloud:10.46.90.163 local-machine:::1]
unit-postgresql-1: 15:43:23 INFO juju.worker.migrationminion migration phase is now: NONE
unit-postgresql-1: 15:43:23 INFO juju.worker.logger logger worker started
unit-postgresql-1: 15:43:23 INFO juju.worker.upgrader no waiter, upgrader is done
machine-1: 15:43:23 INFO juju.worker.leadership postgresql/1 promoted to leadership of postgresql
unit-postgresql-1: 15:43:23 ERROR juju.worker.meterstatus error running "meter-status-changed": charm missing from disk
machine-1: 15:43:23 INFO juju.agent.tools ensure jujuc symlinks in /var/lib/juju/tools/unit-postgresql-1
machine-1: 15:43:23 INFO juju.agent.tools was a symlink, now looking at /var/lib/juju/tools/2.9.42-ubuntu-amd64
machine-1: 15:43:23 WARNING juju.worker.machinesetup determining kvm support: INFO: /dev/kvm does not exist
HINT:   sudo modprobe kvm_intel
modprobe: FATAL: Module msr not found in directory /lib/modules/5.15.0-76-generic
: exit status 1
no kvm containers possible
machine-1: 15:43:23 INFO juju.worker.machiner "machine-1" started
unit-postgresql-1: 15:43:23 INFO juju.worker.uniter unit "postgresql/1" started
unit-postgresql-1: 15:43:23 INFO juju.worker.uniter resuming charm install
unit-postgresql-1: 15:43:23 INFO juju.worker.uniter.charm downloading ch:amd64/jammy/postgresql-288 from API server
machine-1: 15:43:23 INFO juju.downloader downloading from ch:amd64/jammy/postgresql-288
machine-1: 15:43:23 INFO juju.downloader download complete ("ch:amd64/jammy/postgresql-288")
machine-1: 15:43:23 INFO juju.downloader download verified ("ch:amd64/jammy/postgresql-288")
machine-1: 15:43:26 INFO juju.worker.kvmprovisioner machine-1 does not support kvm container
machine-1: 15:43:26 INFO juju.container.lxd Availability zone will be empty for this container manager
unit-postgresql-1: 15:43:31 INFO juju.worker.uniter hooks are retried true
unit-postgresql-1: 15:43:33 INFO juju.worker.uniter.operation ran "pgdata-storage-attached" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:43:33 INFO juju.worker.uniter.storage initial storage attachments ready
unit-postgresql-1: 15:43:33 INFO unit.postgresql/1.juju-log Running legacy hooks/install.
unit-postgresql-1: 15:44:21 INFO juju.worker.uniter.operation ran "install" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:44:22 INFO juju.worker.uniter.operation ran "database-peers-relation-created" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:44:23 INFO juju.worker.uniter.operation ran "restart-relation-created" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:44:23 INFO juju.worker.uniter found queued "leader-elected" hook
unit-postgresql-1: 15:45:24 INFO juju.worker.uniter.operation ran "leader-elected" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:45:25 INFO juju.worker.uniter.operation ran "config-changed" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:45:25 INFO juju.worker.uniter found queued "start" hook
unit-postgresql-1: 15:45:26 INFO unit.postgresql/1.juju-log Running legacy hooks/start.
unit-postgresql-1: 15:45:30 INFO juju.worker.uniter.operation ran "start" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:45:31 INFO juju.worker.uniter.operation ran "database-peers-relation-changed" hook (via hook dispatching script: dispatch)
machine-1: 15:49:17 INFO juju.worker.deployer checking unit "postgresql-admin/0"
machine-1: 15:49:17 INFO juju.worker.deployer deploying unit "postgresql-admin/0"
machine-1: 15:49:17 INFO juju.worker.deployer creating new agent config for "postgresql-admin/0"
machine-1: 15:49:17 INFO juju.worker.deployer starting workers for "postgresql-admin/0"
unit-postgresql-admin-0: 15:49:17 INFO juju Starting unit workers for "postgresql-admin/0"
machine-1: 15:49:17 INFO juju.api connection established to "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
unit-postgresql-admin-0: 15:49:17 INFO juju.worker.apicaller [70e3fa] "unit-postgresql-admin-0" successfully connected to "10.46.90.219:17070"
unit-postgresql-admin-0: 15:49:17 INFO juju.worker.apicaller [70e3fa] password changed for "unit-postgresql-admin-0"
machine-1: 15:49:17 INFO juju.api connection established to "wss://10.46.90.219:17070/model/70e3fa08-884e-47d4-8189-a25245f9c688/api"
unit-postgresql-admin-0: 15:49:17 INFO juju.worker.apicaller [70e3fa] "unit-postgresql-admin-0" successfully connected to "10.46.90.219:17070"
unit-postgresql-admin-0: 15:49:17 INFO juju.worker.migrationminion migration phase is now: NONE
unit-postgresql-admin-0: 15:49:17 INFO juju.worker.logger logger worker started
unit-postgresql-admin-0: 15:49:17 INFO juju.worker.upgrader no waiter, upgrader is done
machine-1: 15:49:17 INFO juju.worker.leadership postgresql-admin/0 promoted to leadership of postgresql-admin
unit-postgresql-admin-0: 15:49:17 ERROR juju.worker.meterstatus error running "meter-status-changed": charm missing from disk
machine-1: 15:49:17 INFO juju.agent.tools ensure jujuc symlinks in /var/lib/juju/tools/unit-postgresql-admin-0
machine-1: 15:49:17 INFO juju.agent.tools was a symlink, now looking at /var/lib/juju/tools/2.9.42-ubuntu-amd64
unit-postgresql-admin-0: 15:49:17 INFO juju.worker.uniter unit "postgresql-admin/0" started
unit-postgresql-admin-0: 15:49:17 INFO juju.worker.uniter resuming charm install
unit-postgresql-admin-0: 15:49:17 INFO juju.worker.uniter.charm downloading ch:amd64/jammy/data-integrator-11 from API server
machine-1: 15:49:17 INFO juju.downloader downloading from ch:amd64/jammy/data-integrator-11
machine-1: 15:49:17 INFO juju.downloader download complete ("ch:amd64/jammy/data-integrator-11")
machine-1: 15:49:17 INFO juju.downloader download verified ("ch:amd64/jammy/data-integrator-11")
unit-postgresql-admin-0: 15:49:20 INFO juju.worker.uniter hooks are retried true
unit-postgresql-admin-0: 15:49:20 INFO juju.worker.uniter.storage initial storage attachments ready
unit-postgresql-admin-0: 15:49:20 INFO juju.worker.uniter found queued "install" hook
unit-postgresql-admin-0: 15:49:20 INFO unit.postgresql-admin/0.juju-log Running legacy hooks/install.
unit-postgresql-admin-0: 15:49:21 INFO juju.worker.uniter.operation ran "install" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:49:21 INFO juju.worker.uniter.operation ran "data-integrator-peers-relation-created" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:49:21 INFO juju.worker.uniter found queued "leader-elected" hook
unit-postgresql-admin-0: 15:49:22 INFO juju.worker.uniter.operation ran "leader-elected" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:49:22 INFO juju.worker.uniter.operation ran "config-changed" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:49:22 INFO juju.worker.uniter found queued "start" hook
unit-postgresql-admin-0: 15:49:23 INFO unit.postgresql-admin/0.juju-log Running legacy hooks/start.
unit-postgresql-admin-0: 15:49:23 INFO juju.worker.uniter.operation ran "start" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:49:33 WARNING unit.postgresql/1.juju-log No relation: certificates
unit-postgresql-1: 15:49:33 INFO juju.worker.uniter.operation ran "update-status" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:49:34 INFO unit.postgresql/1.juju-log database-peers:2: Starting cluster topology observer process
unit-postgresql-1: 15:49:34 INFO unit.postgresql/1.juju-log database-peers:2: Started cluster topology observer process with PID 15391
unit-postgresql-1: 15:49:35 INFO juju.worker.uniter.operation ran "database-peers-relation-changed" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:50:18 INFO juju.worker.uniter.operation ran "config-changed" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:50:28 INFO juju.worker.uniter.operation ran "database-relation-created" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:50:29 INFO juju.worker.uniter.operation ran "postgresql-relation-created" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:50:30 INFO juju.worker.uniter.operation ran "database-relation-joined" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:50:30 INFO juju.worker.uniter.operation ran "postgresql-relation-joined" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:50:31 ERROR unit.postgresql/1.juju-log database:5: Failed to create user: syntax error at or near ";"
LINE 1: ...n-5" WITH LOGIN ENCRYPTED PASSWORD '2zHH9YZF2N1hnBdx' admin;
                                                                      ^

unit-postgresql-1: 15:50:31 ERROR unit.postgresql/1.juju-log database:5: 
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-postgresql-1/charm/lib/charms/postgresql_k8s/v0/postgresql.py", line 174, in create_user
    cursor.execute(
psycopg2.errors.SyntaxError: syntax error at or near ";"
LINE 1: ...n-5" WITH LOGIN ENCRYPTED PASSWORD '2zHH9YZF2N1hnBdx' admin;
                                                                      ^

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-postgresql-1/charm/src/relations/postgresql_provider.py", line 82, in _on_database_requested
    self.charm.postgresql.create_user(user, password, extra_user_roles=extra_user_roles)
  File "/var/lib/juju/agents/unit-postgresql-1/charm/lib/charms/postgresql_k8s/v0/postgresql.py", line 179, in create_user
    raise PostgreSQLCreateUserError()
charms.postgresql_k8s.v0.postgresql.PostgreSQLCreateUserError
unit-postgresql-1: 15:50:32 INFO juju.worker.uniter.operation ran "database-relation-changed" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:50:32 INFO juju.worker.uniter.operation ran "postgresql-relation-changed" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:50:33 INFO juju.worker.uniter.operation ran "database-relation-changed" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:50:34 INFO juju.worker.uniter.operation ran "postgresql-relation-changed" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:50:35 INFO juju.worker.uniter.operation ran "database-relation-changed" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:53:34 INFO juju.worker.uniter.operation ran "update-status" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:54:31 WARNING unit.postgresql/1.juju-log No relation: certificates
unit-postgresql-1: 15:54:31 INFO juju.worker.uniter.operation ran "update-status" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 15:58:46 WARNING unit.postgresql/1.juju-log No relation: certificates
unit-postgresql-1: 15:58:46 INFO juju.worker.uniter.operation ran "update-status" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 15:59:00 INFO juju.worker.uniter.operation ran "update-status" hook (via hook dispatching script: dispatch)
unit-postgresql-1: 16:03:10 WARNING unit.postgresql/1.juju-log No relation: certificates
unit-postgresql-1: 16:03:10 INFO juju.worker.uniter.operation ran "update-status" hook (via hook dispatching script: dispatch)
unit-postgresql-admin-0: 16:04:12 INFO juju.worker.uniter.operation ran "update-status" hook (via hook dispatching script: dispatch)
# [..]
github-actions[bot] commented 1 year ago

https://warthogs.atlassian.net/browse/DPE-2235

gustavosr98 commented 1 year ago

Additional Context

I was following the config docs as it says "... e.g. admin in case of a database ..."

But it seems un-setting the extra-user-roles makes it work

juju config postgresql-admin --reset extra-user-roles
# Still not working, so I had to re-create the relation
juju remove-relation postgresql-admin postgresql
juju add-relation postgresql-admin postgresql

I would still believe there might be an issue there

dragomirp commented 1 year ago

Hi, looks like the same root cause as https://github.com/canonical/postgresql-k8s-operator/issues/192 (in a shared charm lib), but we haven't had an opportunity to have a look at it yet.

dragomirp commented 1 year ago

If you need admin privileges urgently, you can try using extra_user_roles SUPERUSER, that works for Pgbouncer here.

marceloneppel commented 1 year ago

Hi, @gustavosr98, the admin extra-user-role should work now in the new revision from the 14/edge channel (rev. 318).