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

Change foreman_katello_repositories ignorable_content to list #164

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

covert8
Copy link
Contributor

@covert8 covert8 commented Jun 19, 2024

Fixes ignorable content parsing when its an empty list

Copy link
Collaborator

@bitkeks bitkeks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One question for review.

Refs #161 regarding changes in download_concurrency attribute.

Comment on lines +352 to +358
if ignorableContent, ok := d.GetOk("ignorable_content"); ok {
casted := ignorableContent.([]interface{})
var ignorableContentList []string
for _, item := range casted {
ignorableContentList = append(ignorableContentList, item.(string))
}
repo.IgnorableContent = ignorableContentList
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you directly assert to []string here? Suggestion also adds ok to check, else it may panic.

Like this:

Suggested change
if ignorableContent, ok := d.GetOk("ignorable_content"); ok {
casted := ignorableContent.([]interface{})
var ignorableContentList []string
for _, item := range casted {
ignorableContentList = append(ignorableContentList, item.(string))
}
repo.IgnorableContent = ignorableContentList
if ignorableContent, ok := d.GetOk("ignorable_content"); ok {
ignorableContentList, ok := ignorableContent.([]string)
if ok {
repo.IgnorableContent = ignorableContentList
}

@bitkeks bitkeks assigned bitkeks and covert8 and unassigned bitkeks Aug 7, 2024
@covert8 covert8 closed this Aug 13, 2024
@bitkeks bitkeks reopened this Aug 14, 2024
@bitkeks bitkeks assigned bitkeks and unassigned covert8 Aug 14, 2024
@covert8
Copy link
Contributor Author

covert8 commented Aug 14, 2024

Sorry I have exams, it will be a while before i have more time.

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