-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fixes #37982 - Fix error when importing templates with -v
#15
Conversation
If it was tested on the latest foreman_templates version, then it might be related to changes in theforeman/foreman_templates@f909477 and should be dealt either in the plugin itself or as a separate issue for hammer counterpart. |
I am not sure I follow. Do you suggest that if I want to keep the fix in this PR I should change the title to not make a connection to the new feature but treat this as a bug fix instead? |
Does this error occur with foreman_templates-10.0.0 or earlier? If so, this can be fixed as part of "sync through proxy" feature (though, I'd still recommend opening a new ticket). If this error occur only with foreman_templates-10.0.1 and develop, then it's certainly doesn't belong under "sync through proxy" feature and a new ticket must be created either for hammer or foreman_templates project, since it's a regression due to theforeman/foreman_templates@f909477. Doesn't mean you need to fix that, but kudos for finding an issue. If this is related to not-yet-merged feature, then it should be dealt as part of "sync through proxy" feature (within 37971). |
Through testing I found that `template['validation_errors']` is apparently nil instead of an empty array when using the `-v` flag, so the condition needs adjusting. Below is the tested command pair with results (before the fix): ``` \# hammer -v import-templates \ --repo="https://github.com/theforeman/community-templates.git" \ --organization-ids="36" --branch="develop" \ --dirname="/partition_tables_templates/" \ --filter="FreeBSD default fake" Could not import: Error: undefined method `empty?' for nil:NilClass \# hammer import-templates \ --repo="https://github.com/theforeman/community-templates.git" \ --organization-ids="36" --branch="develop" \ --dirname="/partition_tables_templates/" \ --filter="FreeBSD default fake" Import finished. ```
8c121ca
to
61ae061
Compare
-v
8b4bb01
to
61ae061
Compare
This issue may be resolved by theforeman/foreman_templates#192, I which case I will close this. |
Solved by theforeman/foreman_templates#192. |
I am doing this fix as a part of implementing new feature but this issue might not be necessarily related to the new parameters and could just be an uncaugt error that already existed. Through testing I found that
template['validation_errors']
is sometimes nil instead of an empty array so the condition needs adjusting.