-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Update VirtualBox Group parsing to align with documentation. #8510
Update VirtualBox Group parsing to align with documentation. #8510
Conversation
Previously, we could separate the group string on the `/` char and consider each element to be distinct, top-level groups. This change implements the notion of nested groups and the use of the `,` char to split multiple groups.
This comment was marked as resolved.
This comment was marked as resolved.
Thanks for your contribution! I'm pretty sure this is a new feature, and not a bugfix, since the documentation of the inventory plugin never mentioned the new behavior. It is a new feature, and (as you correctly stated in the changelog fragment) a breaking change. Breaking changes are not acceptable without a long enough deprecation period informing users of the changing behavior. The best choice is to make the behavior configurable, with default being the old behavior. Then users who want can switch to the new behavior, and it isn't breaking anyone. |
Changed the implementation from a breaking change to a minor change by introducing a new parameter to configure the behaviour. Keep the default values to maintain the existing behaviour, and allow consumers an option to opt-in.
The long lines were tripping CI. Reduce the length.
Update documentation to match expected conventions and correct the final rendered formatting. Set the initial parent_group to `None` instead of `all` and rely on the parent class' inventory reconciliation logic to ensure consistent behaviour across different inventory plugins. Co-authored-by: Felix Fontein <felix@fontein.de>
Thank you for the great feedback Felix! I've taken in your suggestions. |
This comment was marked as outdated.
This comment was marked as outdated.
The tests did not like the line ending with the colon character.
I will reword it to avoid that stylistic choice. |
One of the lines ended with a colon character which made the CI tests fail since it would interpret it as a YAML key. Reworded the description altogether to avoid that issue.
That's basic YAML parsing which doesn't like it. A colon followed by a space indicates a dictionary entry in YAML, so you end up with a one-element dictionary with a funny key and value instead of having a string. Simply quoting the thing (or using things like |
Co-authored-by: Felix Fontein <felix@fontein.de>
Your explanation makes it so obvious. Thanks! |
If nobody objects, I'll merge this on Sunday. |
Backport to stable-9: 💚 backport PR created✅ Backport PR branch: Backported as #8621 🤖 @patchback |
* Update VirtualBox Group parsing to align with documentation. Previously, we could separate the group string on the `/` char and consider each element to be distinct, top-level groups. This change implements the notion of nested groups and the use of the `,` char to split multiple groups. * Address code review comments. Changed the implementation from a breaking change to a minor change by introducing a new parameter to configure the behaviour. Keep the default values to maintain the existing behaviour, and allow consumers an option to opt-in. * Fix line length. The long lines were tripping CI. Reduce the length. * Apply suggestions from code review Update documentation to match expected conventions and correct the final rendered formatting. Set the initial parent_group to `None` instead of `all` and rely on the parent class' inventory reconciliation logic to ensure consistent behaviour across different inventory plugins. Co-authored-by: Felix Fontein <felix@fontein.de> * Reword module arg description to avoid issues with CI. One of the lines ended with a colon character which made the CI tests fail since it would interpret it as a YAML key. Reworded the description altogether to avoid that issue. * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 21b16c1)
@lyrandy thanks for your contribution! |
…g to align with documentation. (#8621) Update VirtualBox Group parsing to align with documentation. (#8510) * Update VirtualBox Group parsing to align with documentation. Previously, we could separate the group string on the `/` char and consider each element to be distinct, top-level groups. This change implements the notion of nested groups and the use of the `,` char to split multiple groups. * Address code review comments. Changed the implementation from a breaking change to a minor change by introducing a new parameter to configure the behaviour. Keep the default values to maintain the existing behaviour, and allow consumers an option to opt-in. * Fix line length. The long lines were tripping CI. Reduce the length. * Apply suggestions from code review Update documentation to match expected conventions and correct the final rendered formatting. Set the initial parent_group to `None` instead of `all` and rely on the parent class' inventory reconciliation logic to ensure consistent behaviour across different inventory plugins. Co-authored-by: Felix Fontein <felix@fontein.de> * Reword module arg description to avoid issues with CI. One of the lines ended with a colon character which made the CI tests fail since it would interpret it as a YAML key. Reworded the description altogether to avoid that issue. * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 21b16c1) Co-authored-by: lyrandy <42095565+lyrandy@users.noreply.github.com>
Thank you for your guidance and help! |
…-collections#8510) * Update VirtualBox Group parsing to align with documentation. Previously, we could separate the group string on the `/` char and consider each element to be distinct, top-level groups. This change implements the notion of nested groups and the use of the `,` char to split multiple groups. * Address code review comments. Changed the implementation from a breaking change to a minor change by introducing a new parameter to configure the behaviour. Keep the default values to maintain the existing behaviour, and allow consumers an option to opt-in. * Fix line length. The long lines were tripping CI. Reduce the length. * Apply suggestions from code review Update documentation to match expected conventions and correct the final rendered formatting. Set the initial parent_group to `None` instead of `all` and rely on the parent class' inventory reconciliation logic to ensure consistent behaviour across different inventory plugins. Co-authored-by: Felix Fontein <felix@fontein.de> * Reword module arg description to avoid issues with CI. One of the lines ended with a colon character which made the CI tests fail since it would interpret it as a YAML key. Reworded the description altogether to avoid that issue. * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
…-collections#8510) * Update VirtualBox Group parsing to align with documentation. Previously, we could separate the group string on the `/` char and consider each element to be distinct, top-level groups. This change implements the notion of nested groups and the use of the `,` char to split multiple groups. * Address code review comments. Changed the implementation from a breaking change to a minor change by introducing a new parameter to configure the behaviour. Keep the default values to maintain the existing behaviour, and allow consumers an option to opt-in. * Fix line length. The long lines were tripping CI. Reduce the length. * Apply suggestions from code review Update documentation to match expected conventions and correct the final rendered formatting. Set the initial parent_group to `None` instead of `all` and rely on the parent class' inventory reconciliation logic to ensure consistent behaviour across different inventory plugins. Co-authored-by: Felix Fontein <felix@fontein.de> * Reword module arg description to avoid issues with CI. One of the lines ended with a colon character which made the CI tests fail since it would interpret it as a YAML key. Reworded the description altogether to avoid that issue. * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
…-collections#8510) * Update VirtualBox Group parsing to align with documentation. Previously, we could separate the group string on the `/` char and consider each element to be distinct, top-level groups. This change implements the notion of nested groups and the use of the `,` char to split multiple groups. * Address code review comments. Changed the implementation from a breaking change to a minor change by introducing a new parameter to configure the behaviour. Keep the default values to maintain the existing behaviour, and allow consumers an option to opt-in. * Fix line length. The long lines were tripping CI. Reduce the length. * Apply suggestions from code review Update documentation to match expected conventions and correct the final rendered formatting. Set the initial parent_group to `None` instead of `all` and rely on the parent class' inventory reconciliation logic to ensure consistent behaviour across different inventory plugins. Co-authored-by: Felix Fontein <felix@fontein.de> * Reword module arg description to avoid issues with CI. One of the lines ended with a colon character which made the CI tests fail since it would interpret it as a YAML key. Reworded the description altogether to avoid that issue. * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
Previously, we could separate the group string on the
/
char and consider each element to be distinct, top-level groups. This change implements the notion of nested groups and the use of the,
char to split multiple groups.SUMMARY
Fixes #8508
Update the parsing algorithm in the VirtualBox dynamic inventory. The update changes how groups are formed when considering VirtualBox VMs.
ISSUE TYPE
COMPONENT NAME
virtualbox inventory plugin
ADDITIONAL INFORMATION
Before, we would split groups based only on the
/
characters to form top-level groups. This was problematic for users (like me) who want to use nested groups for better variable management.This change introduces the ability to use nested groups using
/
, and different groups using,
. This approach more closely aligns with the official VirtualBox documentation.https://www.virtualbox.org/manual/UserManual.html#gui-vmgroups
In the linked issue, it shows that previously, the
my_custom_variable
would resolve to"This is in \"zgroup1\" group"
because the groups for vm-1 are on "the same level", and so variable resolution depends on lexicographical ordering.Also, groups for vm-2 had a trailing
,
character.Here are the results of the Ansible debug commands with this updated inventory file.