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

Fix for long computer names #114

Conversation

aristotelos
Copy link
Contributor

SUMMARY

Fix issue with long computer hostnames.

Fixes #113

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

microsoft.ad.membership

Copy link

@jborean93
Copy link
Collaborator

Thanks for the PR, from a basic look I don't see this being a problem but I'll have to look a bit deeper as I seem to recall GetHostName() may have been problematic in some scenarios. I could have been thinking of another API so I'll have a play around and get back to you!

@jborean93
Copy link
Collaborator

I've opened aristotelos#1 which contains the changelog fragment and changes to the existing manual tests to cover this new scenario. I've run them locally to ensure that this tests out your original issue as well as a few other edge cases to ensure we don't break it in the future.

I would probably recommend using $cs.DNSHostName and add DNSHostName to the -Property list on line 129 because:

  • It can retrieve Unicode characters, GetHostName() returns ? for those characters
  • It doesn't rely on the socket API which may have issues depending on the OS setup (I could not find a way to break it though)

This isn't something you need to change so I left it alone in my PR targeting your branch but it might be worth considering when/if I ever get to adding Unicode support to this module.

Added changelog fragement and improve tests
Copy link

@jborean93
Copy link
Collaborator

Thanks for working on this!

@jborean93 jborean93 merged commit 88575f9 into ansible-collections:main Apr 29, 2024
21 checks passed
@jterpstra1
Copy link

@jborean93 can a new release be published with this merge?
We're running into the same issue and a new release with this would be appreciated.

Sorry for hijacking this issue.

@jborean93
Copy link
Collaborator

I'm hoping to merge in #117 once it's ready before the next release. Hopefully it'll be out at the end of this week or next week.

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.

Error: Skip computer 'x' with new name 'x' because the new name is the same as the current name.
3 participants