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

Fixes #37982 - Fix error when importing templates with -v #15

Closed
wants to merge 1 commit into from

Conversation

adamlazik1
Copy link

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.

@ofedoren
Copy link
Member

ofedoren commented Nov 4, 2024

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.

@adamlazik1
Copy link
Author

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?

@ofedoren
Copy link
Member

ofedoren commented Nov 5, 2024

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.
```
@adamlazik1 adamlazik1 changed the title Fixes #37971 - Allow template sync through proxy Fixes #37982 - Fix error when importing templates with -v Nov 5, 2024
@adamlazik1
Copy link
Author

@ofedoren thank you for the explanation. It appears that this is indeed regression from f909477, so I created new issue and changed the title of the PR to reflect it.

For the record, this issue was discovered by @lhellebr.

@adamlazik1
Copy link
Author

This issue may be resolved by theforeman/foreman_templates#192, I which case I will close this.

@adamlazik1
Copy link
Author

Solved by theforeman/foreman_templates#192.

@adamlazik1 adamlazik1 closed this Nov 8, 2024
@adamlazik1 adamlazik1 deleted the template-sync branch November 8, 2024 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants