-
Notifications
You must be signed in to change notification settings - Fork 344
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
Ensure that ansible-runner worker --worker-info Returns Unique IDs #854
Conversation
…uld be duplicated across several nodes
recheck |
I just looked at the existing tests and there are no tests at all for At a minimum, we need tests for the net new code. It would be really great to create tests for the existing function before changing it as well. |
Change both functions to accept a path to the UUID file, defaulting to an immutable Path object. This allows easier testing without mocking. Change function names to refelct that one sets the UUID (_set_uuid()), always overwriting any existing file while the other function, ensure_uuid(), will only set the UUID if the UUID file does not exist. Add unit tests.
While Path objects are immutable, the previous default had two main problems: 1. Function defaults are processed on import. The previous default meant that quite a bit of work was done just when the function was imported. 2. Since the value of Path.home() varies depending on the user invoking the function, the means the function default is not consistent. Using None then setting the default value within the function is a bit noisier, but addresses the two issues above.
Add parameters for accepting mode. Add tests for ensuring the mode is set properly.
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!
recheck |
Fixes #850
In certain cases (e.g. when utilizing VMs spun up with IBM Cloud), the provided machine ID for each node will sometimes be identical; this code change would make it so that we purposefully generate a brand new UUID for each node and store it in a file for retrieval (the details of this file and its location are still TBD); this will ensure an actually unique UUID for each worker node.