Ok, for anybody who is curious.

Doing a PUT to /provisioning_templates/:id with

{"provisioning_template" : {"template_combinations_attributes" : 
[{"hostgroup_id" : "73"}, {"hostgroup_id" : "77"}, {"hostgroup_id" : "81"}, 
{"hostgroup_id" : "85"}]}}

Seems to do this trick.

On Thursday, September 15, 2016 at 9:58:37 PM UTC-4, Andrew Schofield wrote:

> 2 years later and it still doesn't!I've lost a few hours today trying to 
> figure this out!
>
> My next question though is how do we do this via the API? Taking a look at 
> what is generated by foreman:
>
> 2016-09-15T21:46:41 [app] [I] Started PATCH 
> "/templates/provisioning_templates/22-Kickstart%20RHEL%20default" for 
> 127.0.0.1 at 2016-09-15 21:46:41 -0400
>
> 2016-09-15T21:46:42 [app] [I] Processing by 
> ProvisioningTemplatesController#update as */*
>
> 2016-09-15T21:46:42 [app] [I]   Parameters: {"utf8"=>"✓", 
> "authenticity_token"=>"RMIiR7+Dn1xqM8EL0IvjeLwKrFvBGkDm+x36bAU1K5k=", 
> "provisioning_template"=>{"name"=>"Kickstart RHEL default", "default"=>"1", 
> "template"=>"SNIP", "audit_comment"=>"", "snippet"=>"0", 
> "template_kind_id"=>"4", "operatingsystem_ids"=>[""], 
> "template_combinations_attributes"=>{"1473990106406"=>{"hostgroup_id"=>"1", 
> "environment_id"=>"", "_destroy"=>"false"}}, "location_ids"=>["", "1"], 
> "organization_ids"=>["", "2"]}, "preview_host_id"=>"2", "mode"=>"ruby", 
> "keybinding"=>"Default", "id"=>"22-Kickstart RHEL default"}
>
> It *looks* like this might be done via template_combinations_attributes 
> and a PATCH method. Neither of these are documented in the API calls at 
> https://theforeman.org/api/1.12/index.html. Does anybody know? Likewise 
> for assigning a template to an OS...
>
> On Wednesday, July 16, 2014 at 1:16:11 PM UTC-4, Greg Sutcliffe wrote:
>>
>> Good stuff! Yeah, that feature doesn't get enough coverage, and it's 
>> very useful :) 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-users+unsubscr...@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to