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

Create a charm action to run wp core update db after a wordpress upgrade #235

Conversation

alithethird
Copy link
Contributor

@alithethird alithethird commented Aug 1, 2024

Added an action for updating database.
NEED ADVICE: I did not check the boxes regarding documentation because I am not sure if I need to update the documentation and how to do that.

Overview

After updating the WordPress version we have to update the database and there was no action for it. This PR creates an action for that called 'update-database'.

Rationale

After updating the WordPress version we have to update the database and there was no action for it.
User had to ssh into the container to do that.

Juju Events Changes

Module Changes

Library Changes

Checklist

@alithethird alithethird added enhancement New feature or request trivial This is a trivial PR labels Aug 1, 2024
@alithethird alithethird requested a review from a team as a code owner August 1, 2024 11:03
Copy link
Contributor

@cbartz cbartz left a comment

Choose a reason for hiding this comment

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

Thank you! Some comments.

tests/unit/test_charm.py Show resolved Hide resolved
actions.yaml Outdated Show resolved Hide resolved
tests/unit/wordpress_mock.py Outdated Show resolved Hide resolved
@canonical canonical deleted a comment from github-actions bot Aug 1, 2024
@amandahla
Copy link
Contributor

amandahla commented Aug 1, 2024

Wouldnt that be the case of adding this to the _on_upgrade_charm event instead of a manual action? When running with --dry-run wouldn't be possible to check if is needed or not?

@alithethird alithethird changed the title 233 create a charm action to run wp core update db after a wordpress upgrade Create a charm action to run wp core update db after a wordpress upgrade Aug 2, 2024
@canonical canonical deleted a comment from github-actions bot Aug 2, 2024
src/charm.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@yanksyoon yanksyoon left a comment

Choose a reason for hiding this comment

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

I think we should discuss what to do when db-update fails, otherwise LGTM!

src/charm.py Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
tests/unit/test_charm.py Outdated Show resolved Hide resolved
tests/unit/wordpress_mock.py Show resolved Hide resolved
cbartz
cbartz previously approved these changes Aug 6, 2024
Copy link
Contributor

@cbartz cbartz left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@javierdelapuente javierdelapuente left a comment

Choose a reason for hiding this comment

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

LGTM

@alithethird alithethird added the documentation Improvements or additions to documentation label Aug 6, 2024
@alithethird alithethird requested a review from erinecon August 6, 2024 07:14
weiiwang01
weiiwang01 previously approved these changes Aug 6, 2024
Copy link
Contributor

@erinecon erinecon left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

github-actions bot commented Aug 6, 2024

Test coverage for 5d2eee5

Name                Stmts   Miss Branch BrPart  Cover   Missing
---------------------------------------------------------------
src/charm.py          556     35    190     34    91%   162, 204-207, 299->302, 414, 473->477, 626, 657, 663, 680-684, 714, 749-750, 808, 817, 921->934, 933, 935, 940-941, 1001, 1021, 1028, 1118, 1127, 1139, 1160, 1169, 1188, 1192, 1221, 1262, 1394, 1416, 1423->1425, 1468->exit, 1480, 1490, 1528
src/cos.py             20      0      0      0   100%
src/exceptions.py      16      1      2      1    89%   41
src/state.py           33      0      4      0   100%
src/types_.py          15      0      0      0   100%
---------------------------------------------------------------
TOTAL                 640     36    196     35    92%

Static code analysis report

Run started:2024-08-06 12:13:17.541693

Test results:
  No issues identified.

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

@alithethird alithethird merged commit fc9c2b6 into main Aug 6, 2024
31 checks passed
@alithethird alithethird deleted the 233-create-a-charm-action-to-run-wp-core-update-db-after-a-wordpress-upgrade branch August 6, 2024 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request Libraries: Out of sync trivial This is a trivial PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a charm action to run wp core update-db after a WordPress upgrade
7 participants