canonical / juju-backup-all

Tool for backing up charms, local juju configs, and juju controllers.
Apache License 2.0
0 stars 5 forks source link

BackupProcessor.process_backups should return the results of running the backups, instead of printing them to stdout #31

Closed zxhdaze closed 7 months ago

zxhdaze commented 7 months ago

Current master (commit c8ffbeacbe3be3428e4f68f15545ea8abe689994)

The main cli entrypoint (Cli) delegates the heavy lifting to BackupProcessor.process_backups. However, this method does not return the result of performing the backups, but instead prints them (stdout). This makes it inconvenient to use BackupProcessor from external code (as a library):

https://git.launchpad.net/juju-backup-all/tree/jujubackupall/process.py?id=c8ffbeacbe3be3428e4f68f15545ea8abe689994#n104

It would probably be better for BackupProcessor.process_backups to return the json (that it already produces) instead, and let the caller decide what it wants to do with it. This way Cli.run can just print it, but library users can handle it differently.


Imported from Launchpad using lp2gh.