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

Running list-backups actions shortly after relation with s3-integrator results in IndexError #699

Open
shayancanonical opened this issue Dec 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@shayancanonical
Copy link
Contributor

Steps to reproduce

  1. juju deploy postgresql --revision 526
  2. juju deploy s3-integrator
  3. juju run s3-integrator/0 sync-s3-credentials access-key=<access_key> secret-key=<secret_key>
  4. juju config s3-integrator endpoint=<s3_endpoint> bucket=<s3_bucket> path= region=
  5. as soon as relation formed, juju run postgresql/leader list-backups

Expected behavior

No exceptions throws, action completes successfully

Actual behavior

Error thrown

Versions

Operating system: Ubuntu 24.04

Juju CLI: 3.6.1-genericlinux-amd64

Juju agent: 3.6.0

Charm revision: 526

LXD: 5.21.2 LTS

Log output

Juju debug log:

unit-postgresql-0: 14:40:27 ERROR unit.postgresql/0.juju-log Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-postgresql-0/charm/./src/charm.py", line 1972, in <module>
    main(PostgresqlOperatorCharm)
  File "/var/lib/juju/agents/unit-postgresql-0/charm/venv/ops/__init__.py", line 343, in __call__
    return _main.main(charm_class=charm_class, use_juju_for_storage=use_juju_for_storage)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/juju/agents/unit-postgresql-0/charm/venv/ops/_main.py", line 543, in main
    manager.run()
  File "/var/lib/juju/agents/unit-postgresql-0/charm/venv/ops/_main.py", line 529, in run
    self._emit()
  File "/var/lib/juju/agents/unit-postgresql-0/charm/venv/ops/_main.py", line 518, in _emit
    _emit_charm_event(self.charm, self.dispatcher.event_name, self._juju_context)
  File "/var/lib/juju/agents/unit-postgresql-0/charm/venv/ops/_main.py", line 134, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-postgresql-0/charm/venv/ops/framework.py", line 347, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-postgresql-0/charm/venv/ops/framework.py", line 857, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-postgresql-0/charm/venv/ops/framework.py", line 947, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-postgresql-0/charm/lib/charms/tempo_coordinator_k8s/v0/charm_tracing.py", line 1064, in wrapped_function
    return callable(*args, **kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/juju/agents/unit-postgresql-0/charm/src/backups.py", line 988, in _on_list_backups_action
    formatted_list = self._generate_backup_list_output()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/juju/agents/unit-postgresql-0/charm/lib/charms/tempo_coordinator_k8s/v0/charm_tracing.py", line 1064, in wrapped_function
    return callable(*args, **kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/juju/agents/unit-postgresql-0/charm/src/backups.py", line 388, in _generate_backup_list_output
    backups = json.loads(output)[0]["backup"]
              ~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
unit-postgresql-0: 14:40:27 WARNING unit.postgresql/0.list-backups Uncaught IndexError in charm code: list index out of range
unit-postgresql-0: 14:40:27 WARNING unit.postgresql/0.list-backups Use `juju debug-log` to see the full traceback.
$ juju run postgresql/0 list-backups 
Running operation 5 with 1 task
  - task 6 on unit-postgresql-0

Waiting for task 6...
Action id 6 failed: exit status 1

Uncaught IndexError in charm code: list index out of range
Use `juju debug-log` to see the full traceback.

Additional context

@shayancanonical shayancanonical added the bug Something isn't working label Dec 12, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/DPE-6231.

This message was autogenerated

Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/DPE-6232.

This message was autogenerated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant