-
Notifications
You must be signed in to change notification settings - Fork 33
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
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 |
There was a problem hiding this comment.
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:
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 | |
} | |
Sorry I have exams, it will be a while before i have more time. |
Fixes ignorable content parsing when its an empty list