Project

General

Profile

Bug #21552

Host parameters added/updated via API do not make it to userscript on provisioning to EC2

Added by Lembitu Ling almost 2 years ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Compute resources - EC2
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Description

Host parameters set in API call do not make it to the userscript when provisioning via API to AWS EC2

Description of problem:

When creating host via API V2 through POST/api/hosts and using EC2 the parameters added/updated in API call either are empty or not updated (if pre-defined in hostgroup)

Version-Release number of selected component (if applicable):

Foreman Version 1.15.6 and at least 1.15.4

How reproducible:

Easily Reproducible

Steps to Reproduce:

API call:

curl -XPOST "$FOREMAN_URL/api/v2/hosts" -u $USER:$PASS -H "Accept:application/json,version=2" -H "Content-Type:application/json" -k -d' { "host" : {"build": "1",
"enabled": "1",
"architecture_id": 1,
"hostgroup_id":"1",
"name": "hostname",
"compute_resource_id": 1,
"compute_profile_id": 1,
"image_id": 1,
"domain_id": 1,
"environment_id": 1,
"medium_id": 1,
"operatingsystem_id": 1,
"owner_id": 1,
"organization_id":1,
"location_id":1,
"provision_method": "image",
"host_parameters_attributes": [{"name":"foo", "value":"bar"}]
}}'

Actual results:

Host yaml snippet from Foreman after creation :

parameters:
foo: bar

Snip from User Data script preview for host from Foreman:

cat > /etc/test << EOF
FOO=<%= host_param('foo') %>
EOF

Snip from User data preview of the created host

cat > /etc/test << EOF
FOO=bar
EOF

Actual results:

[root@hostname]# cat /etc/test
FOO=

Actual results IF parameter "foo" pre-defined in hostgroup as "initial":

[root@hostname]# cat /etc/test
FOO=initial

Expected results

[root@hostname]# cat /etc/test
FOO=bar

Additional info:

Tested only on EC2 instance creation as we do not use other compute service providers. Might affect others also.


Related issues

Related to Foreman - Bug #20062: Host parameter not rendered in user_data template New

History

#1 Updated by Lembitu Ling over 1 year ago

  • Copied to Bug #23298: Unregistering content host deletes virtual machine added

#2 Updated by Lembitu Ling over 1 year ago

  • Copied to deleted (Bug #23298: Unregistering content host deletes virtual machine)

#3 Updated by Anthony Chevalet over 1 year ago

  • Related to Bug #20062: Host parameter not rendered in user_data template added

#4 Updated by Steve D over 1 year ago

Also seeing this in 1.16.1 in the web UI.

Provision ec2 host with hostgroup, host parameter override kt_activation_keys, the override is rendered in foreman userdata but the ec2 host userdata shows the hostgroup activation key value, not the overridden value.

Also available in: Atom PDF