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

Hack around source location lookup failure #759

Closed
wants to merge 1 commit into from

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Sep 19, 2024

While extracting plugins I found this started to fail. With the patch
applied I get this output:

$ bundle exec rake 'gettext:find[foreman-tasks]'
2024-09-19T12:16:13 [I|app|] Rails cache backend: File
2024-09-19T12:16:13 [W|app|] You are trying to replace import_subnets from . Adding allowed actions from plugin permissions to the existing one.
2024-09-19T12:16:13 [D|app|] Registering 15 assets for plugin foreman-tasks precompilation
Unable to find plugin for action 'Actions::CheckLongRunningTasks'
Unable to find plugin for action 'Actions::ActionWithSubPlans'
Unable to find plugin for action 'Actions::Foreman::Puppetclass::Import'
Unable to find plugin for action 'Actions::Foreman::Host::ImportFacts'
Unable to find plugin for action 'Actions::DeliverLongRunningTasksNotification'

That is all of the actions. When I used pry I could see that sometimes
@engine was nil. Other times lookup actually failed:

[1] pry(main)> action
=> Actions::Foreman::Puppetclass::Import
[4] pry(main)> Object.const_source_location(action.to_s)
=> [false, 0]

Looking at the documentation Ruby is never supposed to return false.

I suspect this is because of Zeitwerk changes, but I have no idea why.

While extracting plugins I found this started to fail. With the patch
applied I get this output:

    $ bundle exec rake 'gettext:find[foreman-tasks]'
    2024-09-19T12:16:13 [I|app|] Rails cache backend: File
    2024-09-19T12:16:13 [W|app|] You are trying to replace import_subnets from . Adding allowed actions from plugin permissions to the existing one.
    2024-09-19T12:16:13 [D|app|] Registering 15 assets for plugin foreman-tasks precompilation
    Unable to find plugin for action 'Actions::CheckLongRunningTasks'
    Unable to find plugin for action 'Actions::ActionWithSubPlans'
    Unable to find plugin for action 'Actions::Foreman::Puppetclass::Import'
    Unable to find plugin for action 'Actions::Foreman::Host::ImportFacts'
    Unable to find plugin for action 'Actions::DeliverLongRunningTasksNotification'

That is all of the actions. When I used pry I could see that sometimes
`@engine` was `nil`. Other times lookup actually failed:

    [1] pry(main)> action
    => Actions::Foreman::Puppetclass::Import
    [4] pry(main)> Object.const_source_location(action.to_s)
    => [false, 0]

Looking at the documentation[1] Ruby is never supposed to return
`false`.

I suspect this is because of Zeitwerk changes, but I have no idea why.

[1]: https://www.rubydoc.info/stdlib/core/Module:const_source_location
@adamruzicka
Copy link
Contributor

Closing in favor of #761. gettext:find[foreman-tasks] still doesn't work, but it at least fixed plugin:gettext[foreman-tasks] which can be used to extract strings. Thank you @ekohl

@ekohl
Copy link
Member Author

ekohl commented Oct 25, 2024

Thanks for fixing that. It'll make string extraction way easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants