-
Notifications
You must be signed in to change notification settings - Fork 86
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 mysql_full_version and suffix return variable #115
add mysql_full_version and suffix return variable #115
Conversation
Codecov Report
@@ Coverage Diff @@
## main #115 +/- ##
==========================================
+ Coverage 75.75% 76.23% +0.48%
==========================================
Files 12 13 +1
Lines 1712 1734 +22
Branches 438 440 +2
==========================================
+ Hits 1297 1322 +25
+ Misses 269 267 -2
+ Partials 146 145 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rndmh3ro thanks for the PR
Please also add a changelog fragment https://docs.ansible.com/ansible/latest/community/development_process.html#creating-a-changelog-fragment
fyi: don't worry about |
I added the fragment! |
changelogs/fragments/115-add_mysql_full_version_suffix_return_var.yml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Jorge-Rodriguez if the PR looks good to you too, feel free to merge
@rndmh3ro could you add an explicit integration test for the suffix output? Thanks. |
plugins/modules/mysql_info.py
Outdated
returned: if not excluded by filter | ||
type: str | ||
sample: "MariaDB" | ||
full_version: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
full_version: | |
full: |
plugins/modules/mysql_info.py
Outdated
version = self.info['settings']['version'].split('.') | ||
|
||
# full_version = "5.5.60-MariaDB" | ||
full_version = self.info['settings']['version'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
full_version = self.info['settings']['version'] | |
full = self.info['settings']['version'] |
plugins/modules/mysql_info.py
Outdated
release=int(release), | ||
suffix=str(suffix), | ||
full_version=str(full_version), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
full_version=str(full_version), | |
full=str(full), |
@@ -48,7 +48,7 @@ | |||
- assert: | |||
that: | |||
- result.changed == false | |||
- result.version != {} | |||
- "mysql_version in result.version.full_version" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "mysql_version in result.version.full_version" | |
- "mysql_version in result.version.full" |
@@ -0,0 +1,2 @@ | |||
minor_changes: | |||
- mysql_info - add `full_version` and `suffix` return values (https:/ansible-collections/community.mysql/issues/114). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- mysql_info - add `full_version` and `suffix` return values (https:/ansible-collections/community.mysql/issues/114). | |
- mysql_info - add `version.full` and `version.suffix` return values (https:/ansible-collections/community.mysql/issues/114). |
@Andersson007, thanks I'll add the changes locally.
@Jorge-Rodriguez sadly it's not always empty. Looking at the CI-logs: MySQL 8:
MySQL 5.7:
How should we proceed here? |
@rndmh3ro maybe a unit test would be better suited for the task |
I'm not familiar with writing unit tests. My Python-knowledge in this regard is quite limited. How does one do that? :) |
There are a couple of simple examples in the tests/units folder. If you still don't feel comfortable, just let me know and I can do it. |
@Jorge-Rodriguez it's a very good spot about unit tests. What do you folks think? (@rndmh3ro feel free to fix what i suggested for a while.) |
@Jorge-Rodriguez ah, didn't see your comment, cool, thanks! |
I'd be glad if any of you two can write the unit test (and after that I'll try to understand it :)). |
@rndmh3ro sounds sensible |
@rndmh3ro That unit test took a lot more magick than I expected. I'll be happy to go through it with you if you want. |
add changelog fragment
Co-authored-by: Andrew Klychkov <[email protected]>
That'd be great. There are some parts I don't understand. |
@rndmh3ro I'll be hanging out as Tiriel on the Ansible channel on freenode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Jorge-Rodriguez thanks for the unit tests and adding the suggested changes!
Feel free to merge
Better yet would be to review the unit test in a repo discussion. @Andersson007 can we enable those? |
@Jorge-Rodriguez , enabled, please check |
@rndmh3ro there's more complex case in |
It works. Thanks |
SUMMARY
This PR adds two new variables: the
suffix
variable that is sometimes added to the version-string and thefull_version
-variable that contains the whole version string (to make it easier to compare versions).Fixes #114
ISSUE TYPE
COMPONENT NAME
mysql_info