Add xdg_mime module#10007
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
russoz
left a comment
There was a problem hiding this comment.
hi @mhalano thanks for pursuing this.
There are some adjustments to be made, please check the comments below.
Also, you will need to:
- add yourself to the BOTMETA file as the owner of the two files (in module_utils and modules, respectively), and
- add tests - which I again encourage you to replicate the logic for unit testing
gio_mime.
|
Added myself to BOTMETA. Now I fixing the unit tests. |
|
Tests passing (a.k.a. "works on my machine") |
|
I found out that xdg-mime won't set the handler when we are dealing with an invalid handler, let's say |
Sincere condolences! That's fine for me. I would place it after the copyright/license statements (separated by at least one empty line). |
Co-authored-by: Felix Fontein <felix@fontein.de>
This comment was marked as outdated.
This comment was marked as outdated.
|
@mhalano This PR was evaluated as a potentially problematic PR for the following reasons:
Such PR can only be merged by human. Contact a Core team member to review this PR on IRC: |
|
@mhalano meus sentimentos a você e sua família! Espero que esta distração tenha ajudado a aliviar um pouco do peso desses dias. By all means, add it there. |
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Backport to stable-10: 💚 backport PR created✅ Backport PR branch: Backported as #10072 🤖 @patchback |
* Add version of xdg_mime module * Fix xdg_mime_get since the command is different * Add query parameter * Fix order of parameters * Add myself to BOTMETA * Add unit tests * Fix the way we deal when there is no handler set * Improve documentation * Remove unused import * Fix documentation * Strip xdg-mime from version string * Fix information about version * Add error message sample * Add test to invalid handler * Add support to multiple mime-types * Change the output parameter from handlers to handler * Change tests related to multiple mime-type support * Small fixes * Stop using constant to enable changed state * Add before_handlers and after_handlers * Change tests to use before and after structures * Add a stronger message about using a non-installed handler * Manage some edge cases * Change error message to match the new value * Add some fixes * Change some tests * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Remove a blank line * Remove single quote * Add xdg-mime to the version in the mocks * Remove after_handlers and make code simpler * Update tests to work without after_handlers * Remove diff_params and clean output_params * Make mime_type plural since it supports multiple items * Move the handler check to module init * Use anchors in the test to make yaml simpler * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add blank line to separe examples * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add a small homage to my late grandma * Update plugins/modules/xdg_mime.py Co-authored-by: Felix Fontein <felix@fontein.de> * Fix pep8 problem with the homage * Remove trailing whitespace * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 373334d)
Add xdg_mime module (#10007) * Add version of xdg_mime module * Fix xdg_mime_get since the command is different * Add query parameter * Fix order of parameters * Add myself to BOTMETA * Add unit tests * Fix the way we deal when there is no handler set * Improve documentation * Remove unused import * Fix documentation * Strip xdg-mime from version string * Fix information about version * Add error message sample * Add test to invalid handler * Add support to multiple mime-types * Change the output parameter from handlers to handler * Change tests related to multiple mime-type support * Small fixes * Stop using constant to enable changed state * Add before_handlers and after_handlers * Change tests to use before and after structures * Add a stronger message about using a non-installed handler * Manage some edge cases * Change error message to match the new value * Add some fixes * Change some tests * Update plugins/modules/xdg_mime.py * Remove a blank line * Remove single quote * Add xdg-mime to the version in the mocks * Remove after_handlers and make code simpler * Update tests to work without after_handlers * Remove diff_params and clean output_params * Make mime_type plural since it supports multiple items * Move the handler check to module init * Use anchors in the test to make yaml simpler * Update plugins/modules/xdg_mime.py * Update plugins/modules/xdg_mime.py * Update plugins/modules/xdg_mime.py * Update plugins/modules/xdg_mime.py * Update plugins/modules/xdg_mime.py * Update plugins/modules/xdg_mime.py * Update plugins/modules/xdg_mime.py * Update plugins/modules/xdg_mime.py * Update plugins/modules/xdg_mime.py * Update plugins/modules/xdg_mime.py * Add blank line to separe examples * Update plugins/modules/xdg_mime.py * Add a small homage to my late grandma * Update plugins/modules/xdg_mime.py * Fix pep8 problem with the homage * Remove trailing whitespace * Update plugins/modules/xdg_mime.py --------- (cherry picked from commit 373334d) Co-authored-by: Marcos Alano <mhalano@users.noreply.github.com> Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Felix Fontein <felix@fontein.de>
* Add version of xdg_mime module * Fix xdg_mime_get since the command is different * Add query parameter * Fix order of parameters * Add myself to BOTMETA * Add unit tests * Fix the way we deal when there is no handler set * Improve documentation * Remove unused import * Fix documentation * Strip xdg-mime from version string * Fix information about version * Add error message sample * Add test to invalid handler * Add support to multiple mime-types * Change the output parameter from handlers to handler * Change tests related to multiple mime-type support * Small fixes * Stop using constant to enable changed state * Add before_handlers and after_handlers * Change tests to use before and after structures * Add a stronger message about using a non-installed handler * Manage some edge cases * Change error message to match the new value * Add some fixes * Change some tests * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Remove a blank line * Remove single quote * Add xdg-mime to the version in the mocks * Remove after_handlers and make code simpler * Update tests to work without after_handlers * Remove diff_params and clean output_params * Make mime_type plural since it supports multiple items * Move the handler check to module init * Use anchors in the test to make yaml simpler * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add blank line to separe examples * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add a small homage to my late grandma * Update plugins/modules/xdg_mime.py Co-authored-by: Felix Fontein <felix@fontein.de> * Fix pep8 problem with the homage * Remove trailing whitespace * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Felix Fontein <felix@fontein.de>
* Add version of xdg_mime module * Fix xdg_mime_get since the command is different * Add query parameter * Fix order of parameters * Add myself to BOTMETA * Add unit tests * Fix the way we deal when there is no handler set * Improve documentation * Remove unused import * Fix documentation * Strip xdg-mime from version string * Fix information about version * Add error message sample * Add test to invalid handler * Add support to multiple mime-types * Change the output parameter from handlers to handler * Change tests related to multiple mime-type support * Small fixes * Stop using constant to enable changed state * Add before_handlers and after_handlers * Change tests to use before and after structures * Add a stronger message about using a non-installed handler * Manage some edge cases * Change error message to match the new value * Add some fixes * Change some tests * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Remove a blank line * Remove single quote * Add xdg-mime to the version in the mocks * Remove after_handlers and make code simpler * Update tests to work without after_handlers * Remove diff_params and clean output_params * Make mime_type plural since it supports multiple items * Move the handler check to module init * Use anchors in the test to make yaml simpler * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add blank line to separe examples * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add a small homage to my late grandma * Update plugins/modules/xdg_mime.py Co-authored-by: Felix Fontein <felix@fontein.de> * Fix pep8 problem with the homage * Remove trailing whitespace * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Felix Fontein <felix@fontein.de>
* Add version of xdg_mime module * Fix xdg_mime_get since the command is different * Add query parameter * Fix order of parameters * Add myself to BOTMETA * Add unit tests * Fix the way we deal when there is no handler set * Improve documentation * Remove unused import * Fix documentation * Strip xdg-mime from version string * Fix information about version * Add error message sample * Add test to invalid handler * Add support to multiple mime-types * Change the output parameter from handlers to handler * Change tests related to multiple mime-type support * Small fixes * Stop using constant to enable changed state * Add before_handlers and after_handlers * Change tests to use before and after structures * Add a stronger message about using a non-installed handler * Manage some edge cases * Change error message to match the new value * Add some fixes * Change some tests * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Remove a blank line * Remove single quote * Add xdg-mime to the version in the mocks * Remove after_handlers and make code simpler * Update tests to work without after_handlers * Remove diff_params and clean output_params * Make mime_type plural since it supports multiple items * Move the handler check to module init * Use anchors in the test to make yaml simpler * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add blank line to separe examples * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add a small homage to my late grandma * Update plugins/modules/xdg_mime.py Co-authored-by: Felix Fontein <felix@fontein.de> * Fix pep8 problem with the homage * Remove trailing whitespace * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Felix Fontein <felix@fontein.de>
* Add version of xdg_mime module * Fix xdg_mime_get since the command is different * Add query parameter * Fix order of parameters * Add myself to BOTMETA * Add unit tests * Fix the way we deal when there is no handler set * Improve documentation * Remove unused import * Fix documentation * Strip xdg-mime from version string * Fix information about version * Add error message sample * Add test to invalid handler * Add support to multiple mime-types * Change the output parameter from handlers to handler * Change tests related to multiple mime-type support * Small fixes * Stop using constant to enable changed state * Add before_handlers and after_handlers * Change tests to use before and after structures * Add a stronger message about using a non-installed handler * Manage some edge cases * Change error message to match the new value * Add some fixes * Change some tests * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Remove a blank line * Remove single quote * Add xdg-mime to the version in the mocks * Remove after_handlers and make code simpler * Update tests to work without after_handlers * Remove diff_params and clean output_params * Make mime_type plural since it supports multiple items * Move the handler check to module init * Use anchors in the test to make yaml simpler * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add blank line to separe examples * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * Add a small homage to my late grandma * Update plugins/modules/xdg_mime.py Co-authored-by: Felix Fontein <felix@fontein.de> * Fix pep8 problem with the homage * Remove trailing whitespace * Update plugins/modules/xdg_mime.py Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Felix Fontein <felix@fontein.de>
SUMMARY
Adds a new module called
xdg_mime. It's based ongio_mimemodule, but it usesxdg-mimeinstead ofgioto do the configuration.My first idea was to create a more generic module called
mime, but @russoz suggested creating a separated module. Maybe the could merge in the future.ISSUE TYPE
COMPONENT NAME
xdg_mime
ADDITIONAL INFORMATION