canonical / paas-app-charmer

2 stars 2 forks source link

Tell users how to download any missing libraries #20

Closed jdkandersson closed 3 months ago

jdkandersson commented 3 months ago

Applicable spec: N/A

Overview

Wraps import statements for charm libraries in a try except block adding instructions to the user for how to fix the issue. Once fetch-libs is working, we can change the messages to tell users to run fetch-libs.

Rationale

This will help users know what command to run to download the required libraries if they forgot to.

Juju Events Changes

None

Module Changes

None

Library Changes

None

Checklist

jdkandersson commented 3 months ago

LGTM.

As a different solution we could put the checks in the __init__.py file

Yeh that is a better alternative, thanks! Implemented

github-actions[bot] commented 3 months ago

Test coverage for 149ca9257dca1675cba573aea7d379aef1604011

Name                                            Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------------------------------
paas_app_charmer/__init__.py                       29     14      0      0    52%   13-14, 19-20, 26-27, 33-34, 40-41, 47-48, 54-55
paas_app_charmer/_gunicorn/__init__.py              0      0      0      0   100%
paas_app_charmer/_gunicorn/charm.py               132     20     18      4    83%   129-130, 132-133, 154->exit, 166-170, 184-186, 240-241, 246, 251, 256, 266, 271, 276, 281, 286
paas_app_charmer/_gunicorn/charm_state.py          53      1     10      1    97%   165
paas_app_charmer/_gunicorn/charm_utils.py          23      0      0      0   100%
paas_app_charmer/_gunicorn/observability.py        13      0      2      0   100%
paas_app_charmer/_gunicorn/secret_storage.py       13      0      0      0   100%
paas_app_charmer/_gunicorn/webserver.py            75      4     14      1    94%   156, 168-174
paas_app_charmer/_gunicorn/workload_config.py      19      0      0      0   100%
paas_app_charmer/_gunicorn/wsgi_app.py             72      0     30      0   100%
paas_app_charmer/database_migration.py             33      0      2      0   100%
paas_app_charmer/databases.py                      25      2     11      1    92%   89-90
paas_app_charmer/django/__init__.py                 1      0      0      0   100%
paas_app_charmer/django/charm.py                   44      7     10      1    78%   72-77, 98, 113-114
paas_app_charmer/exceptions.py                      5      0      0      0   100%
paas_app_charmer/flask/__init__.py                  1      0      0      0   100%
paas_app_charmer/flask/charm.py                    36      0      6      0   100%
paas_app_charmer/secret_storage.py                 39      3     16      5    85%   50, 54->53, 55->57, 85, 104
-------------------------------------------------------------------------------------------
TOTAL                                             613     51    119     13    90%

Static code analysis report

Run started:2024-06-04 10:58:32.294371

Test results:
    No issues identified.

Code scanned:
    Total lines of code: 1362
    Total lines skipped (#nosec): 0
    Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
    Total issues (by severity):
        Undefined: 0
        Low: 0
        Medium: 0
        High: 0
    Total issues (by confidence):
        Undefined: 0
        Low: 0
        Medium: 0
        High: 0
Files skipped (0):