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

chore: image bulider match style #329

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yanksyoon
Copy link
Collaborator

Applicable spec: N/A

Overview

From previous discussion, a charm state should raise an error if not valid and be caught, rather than returning validation result. This PR follows the pattern discussed.

Rationale

To have consistent code styles.

Juju Events Changes

None.

Module Changes

  • Removed _get_set_image_ready_status which sets charm states if image relation is not ready/ not provided.
  • The charm now falls into BlockedStatus/WaitingStatus if the image relation is not provided regardless of whether the openstack charm deployment requires the image to be ready (e.g. flush doesn't require image to be ready)

Library Changes

None.

Checklist

logger.exception("Missing integration")
self.unit.status = BlockedStatus(str(err))
except IntegrationDataNotReadyError as err:
logger.exception("Missing integration data")
Copy link
Collaborator

@arturo-seijas arturo-seijas Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same msg as in line 143. Is this intentional? Otherwise, why don't you catch both exceptions together?

Copy link
Collaborator

@cbartz cbartz Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @gregory-schiano did not like the abstract name (I also originally had MissingIntegrationDataError but then changed it to MissingMongoDBError). I am fine with using the abstract name and merging this with lines 142-144, but perhaps confirm with @gregory-schiano .

Copy link
Contributor

github-actions bot commented Aug 2, 2024

Test coverage for 71155ca

Name                                       Stmts   Miss Branch BrPart  Cover   Missing
--------------------------------------------------------------------------------------
src/charm.py                                 554    134    137     27    73%   189-194, 240-242, 304-323, 341-343, 344->348, 374-378, 451, 458-460, 487-492, 509-512, 533, 545-551, 565-566, 579, 584, 614-615, 617->626, 621->626, 629-635, 669, 673-678, 729-732, 741->744, 767-784, 788-789, 817-841, 854-857, 878-888, 902-904, 951-952, 954-955, 957-958, 1037->1039, 1104-1105, 1143-1145, 1153-1157, 1204-1222, 1231
src/charm_state.py                           462     19    110      6    95%   339-351, 533-537, 625, 668-669, 677, 724-725, 1160->1163, 1167-1168, 1215
src/errors.py                                 44      0      0      0   100%
src/event_timer.py                            54      7      2      1    86%   105-106, 131, 148-149, 165-166
src/firewall.py                               51     18     20      0    61%   42-43, 66-69, 111-185
src/github_client.py                          96     16     40      5    79%   65-72, 119->exit, 124-125, 195, 218, 231-238, 260->300, 294
src/github_type.py                            50      0      0      0   100%
src/logrotate.py                              43      0      2      0   100%
src/lxd_type.py                               35      0      2      0   100%
src/metrics/__init__.py                        0      0      0      0   100%
src/metrics/events.py                         55      2      8      1    95%   56->59, 166-167
src/metrics/github.py                         16      0      0      0   100%
src/metrics/runner.py                        144     10     32      3    91%   160, 186-199, 235, 272, 454-455
src/metrics/runner_logs.py                    24      5      4      1    79%   30-33, 47->46, 51-52
src/metrics/storage.py                        70      8     12      0    90%   89-90, 117-118, 182-183, 189-190
src/metrics/type.py                            5      0      0      0   100%
src/openstack_cloud/__init__.py               26      0      2      0   100%
src/openstack_cloud/openstack_manager.py     540    118    162     21    77%   96, 263, 317, 319, 321, 438-441, 487, 490, 531-532, 698-725, 865-866, 888->exit, 898, 925-926, 929-930, 973, 982-983, 1013, 1018-1025, 1038-1044, 1048-1050, 1066-1072, 1091-1092, 1094-1105, 1112-1116, 1120-1123, 1146-1147, 1152-1158, 1176, 1191-1216, 1241-1255, 1271-1278, 1312, 1426-1431, 1452-1454, 1482-1487, 1509-1510, 1518-1528
src/reactive/__init__.py                       0      0      0      0   100%
src/reactive/consumer.py                      40      2      6      0    96%   98-101
src/reactive/runner_manager.py                53      0     14      1    99%   102->exit
src/runner_manager_type.py                    51      0      8      0   100%
src/runner_type.py                            37      0     10      0   100%
src/shared_fs.py                              93     17     10      1    83%   51-52, 119-120, 145-146, 154-155, 161-162, 180, 183-184, 196-197, 240-241
src/utilities.py                              68      7     20      7    82%   86->88, 90->96, 103, 133, 147, 186-189, 244
--------------------------------------------------------------------------------------
TOTAL                                       2611    363    601     74    84%

Static code analysis report

Run started:2024-08-02 05:40:33.002745

Test results:
  No issues identified.

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

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):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants