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

Feature #28836 - allow multiple disassociating of provisioning templates #502

Merged
merged 1 commit into from
Mar 2, 2020

Conversation

yifatmakias
Copy link
Contributor

No description provided.

Copy link
Member

@ofedoren ofedoren left a comment

Choose a reason for hiding this comment

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

Thanks, @yifatmakias! Works as expected (I was able to disassociate some templates) and tests pass, but I think it would be also nice to have this command similar to add-provisioning-templates with --provisioning-template-search. What do you think? Not blocker though.


api_expects(:operatingsystems, :update) do |par|
par['id'] == '1' &&
par['operatingsystem'] == { 'provisioning_template_ids' => [] }
Copy link
Member

Choose a reason for hiding this comment

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

Although the tests pass, this is weird, because in a real call we'd send an array with id ('provisioning_template_ids' => ['1'] in this case). Not sure why the test requires the array to be empty...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right it should be 'provisioning_template_ids' => ['1'] in this case. I will fix it and also address the issue from the other PR you mentioned here.

@yifatmakias
Copy link
Contributor Author

yifatmakias commented Feb 26, 2020

I thought that when disassociating a template it is more likely to want to delete it according to the full name or specific id so there will be no mistake and that's why I thought that search option here is not necessary. But if you think it should be added I will add it. What do you say? @ofedoren

@ofedoren
Copy link
Member

@yifatmakias, I agree that search option has limited usage in this context, but if I wanted to disassociate all e.g. Kickstart templates, I'd rather use something like --search ".*Kickstart.*" instead of listing all of them.

@yifatmakias
Copy link
Contributor Author

O.K, I will add the search option.
Thanks a lot for the review :)

Copy link
Member

@ofedoren ofedoren left a comment

Choose a reason for hiding this comment

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

@yifatmakias, thanks! Now it's easier to disassociate multiple templates from os :)

Unfortunatelly, while testing --...-search option I've noticed that we have it quite broken and with associate command as well :(. It works, but the search result is limited to per_page setting in Foreman. Example: I've got an OS with 30 associated templates, 25 of which have prefix dis_. If I want to [dis]associate all the templates with this prefix, I will need to run a command with --...-search option twice in case I've got per_page set to 20 in Foreman. I've kinda resolved this issue as part of #417, but the solution works only on basic name resolving (uses --...-name[s] option).

Please let me know if you want to resolve this issue as part of this PR (which I think is out of scope) or we should create a separate issue in redmine. After we decide it I'll wait for new changes or merge this right away and we'll deal with the problem later :)

@yifatmakias
Copy link
Contributor Author

I agree that this problem is out of scope for this PR. I think we should create a new Redmine issue for this problem.

@ofedoren
Copy link
Member

ofedoren commented Mar 2, 2020

@yifatmakias, okay then :) I've created the issue: https://projects.theforeman.org/issues/29231.

So, merging this one, thanks!

@ofedoren ofedoren merged commit 81f93da into theforeman:master Mar 2, 2020
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.

3 participants