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

Add an unused event handler as arg to _setup_and_activate to satisfy rollingops #175

Closed
wants to merge 2 commits into from

Conversation

mthaddon
Copy link
Contributor

@mthaddon mthaddon commented Jan 17, 2024

Overview

Add an unused event handler as an argument to _setup_and_activate, which is the callback to the rollingops library, as it will pass this as an argument.

Rationale

When deploying on staging we observed the following:

  File "/var/lib/juju/agents/unit-stg-discourse-k8s-1/charm/lib/charms/rolling_o
ps/v0/rollingops.py", line 335, in _on_relation_changed
    self.charm.on[self.name].run_with_lock.emit()
  File "/var/lib/juju/agents/unit-stg-discourse-k8s-1/charm/venv/ops/framework.p
y", line 351, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-stg-discourse-k8s-1/charm/venv/ops/framework.p
y", line 853, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-stg-discourse-k8s-1/charm/venv/ops/framework.p
y", line 942, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-stg-discourse-k8s-1/charm/lib/charms/rolling_o
ps/v0/rollingops.py", line 404, in _on_run_with_lock
    callback(event)
TypeError: _setup_and_activate() takes 1 positional argument but 2 were given

Juju Events Changes

N/A

Module Changes

N/A

Library Changes

N/A

Checklist

Copy link
Contributor

Test coverage for 35238dd

Name              Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------
src/charm.py        328     30     82     11    90%   177, 185-186, 346->351, 544-546, 551-552, 563-565, 570-571, 583-585, 590-591, 603-605, 630-632, 672->exit, 682->exit, 712-718, 744->exit, 758-759, 769->exit, 783
src/database.py      30      1      8      1    95%   56
-------------------------------------------------------------
TOTAL               358     31     90     12    90%

Static code analysis report

Run started:2024-01-17 09:29:02.435218

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 1981
  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):

@mthaddon
Copy link
Contributor Author

Closing this out in favour of #176

@mthaddon mthaddon closed this Jan 17, 2024
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.

1 participant