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

values need to be bytes when writing back to ldap #48666

Merged
merged 16 commits into from
Oct 1, 2018

Conversation

angeloudy
Copy link
Contributor

What does this PR do?

What issues does this PR fix or reference?

fix for #48599

@rallytime rallytime requested a review from terminalmage July 20, 2018 14:43
salt/modules/ldap3.py Outdated Show resolved Hide resolved
@dwoz
Copy link
Contributor

dwoz commented Jul 21, 2018

Should the encoding/decoding be specific to the ldap server? It looks like this PR is basing the encoding/decoding based on the client's system settings. Have you thought about what happens if the client system is using a non utf-8 encoding?

@angeloudy
Copy link
Contributor Author

@dwoz
That's a good point!
I have no idea how to get the encoding.
What do you suggest?

@dwoz
Copy link
Contributor

dwoz commented Jul 31, 2018

@angeloudy I think it's best to use utf-8 here (it looks like that is what LDAPv3 expects by default). We can make it configurable down the road if needed

@cachedout
Copy link
Contributor

@dwoz and @angeloudy There is also __salt_system_encoding__ that should be available.

@cachedout
Copy link
Contributor

Hi @angeloudy. Where are we on this one?

@angeloudy
Copy link
Contributor Author

@cachedout should salt.utils.data.encode use __salt_system_encoding__ by default?
I did have any 'utf8' hardcoded in my changes.

@terminalmage
Copy link
Contributor

@angeloudy It would try utf8 first, and then try the detected encoding if that raises a UnicodeEncodeError.

@rallytime
Copy link
Contributor

@angeloudy Are you planning on making the requested changes here?

@angeloudy
Copy link
Contributor Author

@rallytime what requested changes.
I am fine with my current version.

@angeloudy
Copy link
Contributor Author

@terminalmage @rallytime
if an UnicodeEncodeError exception catching is necessary, shouldn't it be done inside salt.utils.data.encode?

@rallytime
Copy link
Contributor

@terminalmage and @dwoz can you comment/re-review?

@angeloudy
Copy link
Contributor Author

Hi, any plans to merge this pull request so that I don't have to maintain my own patch?
I don't understand why are you guys worrying about UnicodeEncodeError, the encode method is being used everywhere in saltstack.

Copy link
Contributor

@terminalmage terminalmage left a comment

Choose a reason for hiding this comment

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

I don't think anyone is worrying about an encoding error. You still haven't made the suggested changes from a few months ago, which is probably why this hasn't been merged.

salt/modules/ldap3.py Outdated Show resolved Hide resolved
@rallytime rallytime added the bugfix-bckport will be be back-ported to an older release branch by creating a PR against that branch label Oct 1, 2018
@rallytime rallytime merged commit 365d7f7 into saltstack:develop Oct 1, 2018
@rallytime rallytime added ZZZ[Done]-back-ported-bf RETIRED The pull request has been back-ported to an older branch. and removed bugfix-bckport will be be back-ported to an older release branch by creating a PR against that branch labels Oct 9, 2018
rallytime pushed a commit that referenced this pull request Oct 9, 2018
@ghost ghost mentioned this pull request Mar 8, 2019
sathieu added a commit to sathieu/salt that referenced this pull request Aug 29, 2019
Regression from 05e55bd (saltstack#48666):
- AttributeError: 'tuple' object has no attribute 'encode'
- ValueError: too many values to unpack

Fixes: saltstack#52022.
sathieu added a commit to sathieu/salt that referenced this pull request Dec 21, 2019
Regression from 05e55bd (saltstack#48666):
- AttributeError: 'tuple' object has no attribute 'encode'
- ValueError: too many values to unpack

Fixes: saltstack#52022.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ZZZ[Done]-back-ported-bf RETIRED The pull request has been back-ported to an older branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants