wal-e-list-backups action fails if there are no backups available

Bug #1831740 reported by Tytus Kurek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PostgreSQL Charm
Triaged
Medium
Unassigned

Bug Description

The wal-e-list-backups action fails if there are no backups available:

$ juju run-action --wait postgresql/0 wal-e-list-backups
unit-postgresql-0:
  id: f7c08d45-7d54-4647-835d-a1fb2c826485
  message: Unhandled exception
  results:
    traceback: |
      Traceback (most recent call last):
        File "/var/lib/juju/agents/unit-postgresql-0/charm/actions/wal-e-list-backups", line 191, in main
          wal_e_list_backups(params)
        File "/var/lib/juju/agents/unit-postgresql-0/charm/actions/wal-e-list-backups", line 133, in wal_e_list_backups
          details = wal_e.wal_e_list_backups(envdir)
        File "/var/lib/juju/agents/unit-postgresql-0/charm/reactive/postgresql/wal_e.py", line 196, in wal_e_list_backups
          raw = wal_e_run(['backup-list', '--detail'], envdir=envdir)
        File "/var/lib/juju/agents/unit-postgresql-0/charm/reactive/postgresql/wal_e.py", line 192, in wal_e_run
          timeout=timeout)
        File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
          **kwargs).stdout
        File "/usr/lib/python3.6/subprocess.py", line 403, in run
          with Popen(*popenargs, **kwargs) as process:
        File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
          restore_signals, start_new_session)
        File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: '/snap/bin/wal-e.envdir': '/snap/bin/wal-e.envdir'
  status: failed
  timing:
    completed: 2019-06-05 12:42:10 +0000 UTC
    enqueued: 2019-06-05 12:42:08 +0000 UTC
    started: 2019-06-05 12:42:09 +0000 UTC
  unit: postgresql/0

I think that rather than failing it should complete and report an empty list.

Revision history for this message
Tytus Kurek (tkurek) wrote :

An update on that: it only fails if storage backend is not configured. When it's configured, it completes and reports an empty list:

$ juju run-action --wait postgresql/0 wal-e-list-backups
unit-postgresql-0:
  id: b14282c3-fabe-4d95-8387-b42812735987
  status: completed
  timing:
    completed: 2019-06-06 10:55:16 +0000 UTC
    enqueued: 2019-06-06 10:55:00 +0000 UTC
    started: 2019-06-06 10:55:10 +0000 UTC
  unit: postgresql/0

tags: removed: 4010 cpe-onsite
Changed in postgresql-charm:
status: New → Invalid
Revision history for this message
Stuart Bishop (stub) wrote :

The action can certainly handle this case better than spitting a traceback at the user.

Changed in postgresql-charm:
status: Invalid → Triaged
importance: Undecided → Medium
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.