Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat[mysql_user]: add support for mysql user attributes #604
feat[mysql_user]: add support for mysql user attributes #604
Changes from 1 commit
5273712
7012a27
9a8b53d
c35bfb9
55e896e
208719f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
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.
Looks like this will return
None
rather than an empty dict if the user exists but does not have any attributes set - are you recommending returningNone
over{}
in that scenario?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.
yep
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.
That should be fine, but there are a few things to keep in mind about
None
vs{}
when it comes to attributes... if aCREATE USER
is ran without theATTRIBUTES '{}'
option, the user's attributes are stored asNULL
until attributes are set, and if all attributes are deleted, attributes will then be stored as{}
and cannot be changed back toNULL
(as far as I can tell):I think there are a couple different options:
{}
even if theATTRIBUTE
database value isNULL
register: foo
withmysql_user
could still treatfoo.attributes
as a dictionary even if theATTRIBUTE
value isNULL
. It also makes the code a bit cleaner ifattributes_get
always returns a dict for users that exist.CREATE USER
query inuser_add
withATTRIBUTES {}
even if no attributes are specified, so that theATTRIBUTE
database value will always be{}
for ansible-created users on servers with attribute support.None
even if theATTRIBUTE
database value is{}
(I think this is what you were proposing)None
or{}
depending on the database valueOption 2 is how this feature behaves as of my latest commit (I also wrote tests to assert the attributes return value for users without attributes). I think any of these options are fine depending on ansible best practices. I can stick with option 2 if you think it's preferred, I just wanted to make sure this caveat was documented in this PR.
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.
I did not bump the version in
galaxy.yml
yet; unsure what the process is for shipping new versions.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.
3.9.0
is OK hereThere 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.
I can change the parameter ordering here if desired.
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.
that's fine now