-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 linode inventory filtering #4336
Fix linode inventory filtering #4336
Conversation
There was a regression introduced in the addition of caching. The `_consume_options` method was added and provided the `config_data` dictionary. This `pop`s every entry, resulting in an empty `config_data` dict, which was then reused and expected to be populated. After reviewing, `_consume_data` doesn't need to be called. Also, once the ``_read_config_data` method has been called, we no longer need the config_data dict, and can instead use the `get_option` method throughout. Once those were removed, the filtering function seemed a bit odd, since we were no longer using the file. I used that opportunity to move the filter calls into the populate function directly.
cc @Charliekenney23 @InTheCloudDan @LBGarber @decentral1se @displague @rmcintosh |
Realized I missed updating the tests and changelog entries. I will have those up shortly, and will mark this as a draft until it is ready for review. |
This removes tests that targeted some custom methods on configuration file handling. These are no longer necessary since they are now handled by the BaseInventoryPlugin `_read_config_data` method.
d0f0c56
to
5f0374f
Compare
Alright. Removed the tests that targeted some custom methods on configuration file handling which are no longer necessary and added the changelog fragment. |
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.
Thanks for your contribution!
This moves filters back into their own method, but now uses the get_option calls to pull filter configuration items.
609b844
to
855b9c9
Compare
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 good as far as I can tell.
@wbh1 since you actually use this plugin (I hope :D ), could you take a look at this PR? Since you left a reaction I guess you already glanced at it (and apparently liked it), but some more explicit feedback would also be nice :) |
Ok, if nobody minds I'll merge by tomorrow morning. |
Can confirm that this works as expected / fixes the bug I introduced 😅 |
Backport to stable-4: 💚 backport PR created✅ Backport PR branch: Backported as #4356 🤖 @patchback |
* Fix linode inventory filtering There was a regression introduced in the addition of caching. The `_consume_options` method was added and provided the `config_data` dictionary. This `pop`s every entry, resulting in an empty `config_data` dict, which was then reused and expected to be populated. After reviewing, `_consume_data` doesn't need to be called. Also, once the ``_read_config_data` method has been called, we no longer need the config_data dict, and can instead use the `get_option` method throughout. Once those were removed, the filtering function seemed a bit odd, since we were no longer using the file. I used that opportunity to move the filter calls into the populate function directly. * Remove tests that target removed methods This removes tests that targeted some custom methods on configuration file handling. These are no longer necessary since they are now handled by the BaseInventoryPlugin `_read_config_data` method. * Add changelog entry for linode inventory bugfix * Revert filters back to their own method This moves filters back into their own method, but now uses the get_option calls to pull filter configuration items. (cherry picked from commit 386bb4b)
@stvnjacobs thanks for fixing this! |
* Fix linode inventory filtering There was a regression introduced in the addition of caching. The `_consume_options` method was added and provided the `config_data` dictionary. This `pop`s every entry, resulting in an empty `config_data` dict, which was then reused and expected to be populated. After reviewing, `_consume_data` doesn't need to be called. Also, once the ``_read_config_data` method has been called, we no longer need the config_data dict, and can instead use the `get_option` method throughout. Once those were removed, the filtering function seemed a bit odd, since we were no longer using the file. I used that opportunity to move the filter calls into the populate function directly. * Remove tests that target removed methods This removes tests that targeted some custom methods on configuration file handling. These are no longer necessary since they are now handled by the BaseInventoryPlugin `_read_config_data` method. * Add changelog entry for linode inventory bugfix * Revert filters back to their own method This moves filters back into their own method, but now uses the get_option calls to pull filter configuration items. (cherry picked from commit 386bb4b) Co-authored-by: steven jacobs <stjacobs@fastmail.fm>
SUMMARY
There was a regression introduced in the addition of caching. The
_consume_options
method was added and provided theconfig_data
dictionary. This
pop
s every entry, resulting in an emptyconfig_data
dict, which was then reused and expected to be populated.
After reviewing,
_consume_data
doesn't need to be called. Also, oncethe
_read_config_data
method has been called, we no longer need theconfig_data
dict, and can instead use theget_option
methodthroughout.
Once those were removed, the filtering function seemed a bit odd, since
we were no longer using the file. I used that opportunity to move the
filter calls into the populate function directly.
ISSUE TYPE
COMPONENT NAME
community.general.linode