Skip to content

ISD-2819 restart synapse and MAS if MAS config has changed #779

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

Merged

Conversation

Thanhphan1147
Copy link
Collaborator

@Thanhphan1147 Thanhphan1147 commented Apr 29, 2025

Check for drifts using the existing method for synapse config and restart both Synapse and MAS if the config has changed.

Checklist

@Thanhphan1147 Thanhphan1147 requested a review from amandahla May 6, 2025 14:17
Copy link
Contributor

github-actions bot commented May 7, 2025

Test results for commit 61cae0d

Test coverage for 61cae0d

Name                                    Stmts   Miss Branch BrPart  Cover   Missing
-----------------------------------------------------------------------------------
src/actions.py                             36      0      6      0   100%
src/auth/__init__.py                        0      0      0      0   100%
src/auth/mas.py                            85      6      2      0    93%   78-80, 97-99
src/backup.py                             175      5     20      2    96%   351-352, 421-422, 479->481, 482
src/backup_observer.py                    151     16     14      0    90%   162-165, 170-173, 210-213, 242-245
src/charm.py                              276     26     62     12    89%   178->180, 183, 257, 310, 314-315, 321-322, 340-341, 365, 372, 447-451, 454-455, 483-485, 505, 535-541, 571-572
src/charm_types.py                         30      0      0      0   100%
src/database_client.py                     57      1      8      4    92%   35, 47->exit, 69->exit, 88->98
src/database_observer.py                   49      4      2      0    92%   61-64
src/exceptions.py                           3      0      0      0   100%
src/matrix_auth_observer.py                59      5      6      0    92%   133-137
src/media_observer.py                      45      4      2      1    89%   60-62, 81
src/observability.py                       13      0      0      0   100%
src/pebble.py                             227     42     54     13    80%   158->exit, 169-173, 218-219, 237-241, 261-262, 280-283, 350->353, 353->358, 364-365, 371-372, 374-375, 406, 408, 410, 412, 414, 421-424, 452, 603-619, 661-668
src/redis_observer.py                      39      3      4      0    93%   63-66
src/s3_parameters.py                       22      0      4      0   100%
src/smtp_observer.py                       61      1     14      2    96%   89, 108->113
src/state/__init__.py                       0      0      0      0   100%
src/state/charm_state.py                  144     11     34      7    90%   168, 172, 193, 218, 224, 230, 234-235, 321, 388-389
src/state/mas.py                           79      8      6      3    87%   154, 160-161, 188-190, 205, 225
src/state/validation.py                    36      3      2      0    92%   110-112
src/synapse/__init__.py                     2      0      0      0   100%
src/synapse/workload.py                   151      7     30      2    93%   366-369, 400-401, 449
src/synapse/workload_configuration.py     142     24     34     12    80%   62-63, 127->exit, 131-132, 171-172, 201, 221-222, 255, 264-265, 280, 285-286, 305->310, 311, 329->331, 341-342, 361, 369->371, 371->373, 378-379, 390->397, 400, 420-421
src/user.py                                23      5      2      1    76%   27-29, 56, 73
-----------------------------------------------------------------------------------
TOTAL                                    1905    171    306     59    89%

Static code analysis report

Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Run started:2025-05-07 13:14:08.036976

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 9806
  Total lines skipped (#nosec): 6
  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):

config = container.pull(MAS_CONFIGURATION_PATH).read()
return yaml.safe_load(config)
except ops.pebble.PathError as exc:
# If the MAS config has not been created, we return an empty dict to trigger a replan
Copy link
Collaborator

Choose a reason for hiding this comment

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

When could this happen?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The 2 most likely cases are:
When the charm first starts, or when the config is manually deleted for whatever reason

@Thanhphan1147 Thanhphan1147 merged commit 61d8564 into 2/main May 7, 2025
23 checks passed
@Thanhphan1147 Thanhphan1147 deleted the restart_synapse_and_mas_when_mas_config_changed branch May 7, 2025 13:55
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.

2 participants