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

parse controller API port from apiaddresses in agent.conf #54

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

barrettj12
Copy link
Contributor

@barrettj12 barrettj12 commented Nov 7, 2023

Sometimes (on k8s), the apiport key is not defined inside the unit's agent.conf. In this case, we need to parse the value given in the apiaddresses key, which has the form

apiaddresses:
- localhost:17070

Change the api_port method so that we're parsing the apiaddresses agent.conf key, instead of relying on apiport. If the key can't be found, then the method raises an AgentConfException, which is caught in the event handler and the status is set to 'error'.

Add unit tests to cover all this.

As a drive-by, move flake8 to the end of the run_tests script, so that unit tests are always run, even if the linting doesn't pass.

src/charm.py Outdated Show resolved Hide resolved
- move flake8 to end of run_tests file, so unit tests always run
@barrettj12 barrettj12 merged commit d8fb619 into 3.3 Nov 9, 2023
9 checks passed
@barrettj12 barrettj12 deleted the apiport branch November 9, 2023 14:26
@manadart manadart mentioned this pull request Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants