Bug #31279
closedActivation key not supplied to the global registration template
Description
Having Foreman + Katello, attempting to register a RHEL 7 host:
In host registration dialog, supply a hostgroup with associated activation key, generate the command.
Run the command on the host, fails with "Error: Must specify an activation key"
Verbose output excrept from the host:
```echo "# Running registration"
- Running registration
echo "#" #
if [ x$ID = xrhel ] || [ x$ID = xcentos ]; then
register_katello_host(){
UUID=$(subscription-manager identity | head -1 | awk '{print $3}')
curl --cacert $SSL_CA_CERT --request POST "https://testhost.example.com/register?uuid=$UUID" \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2MDQ5MjcwODQsImp0aSI6ImJiMjE5MGE3NzdlZmMwMzM3OGQxZmY3YjEzNjZhN2U3MWIxNGI4NzE1OGZkNzYzZjkwNGVmNTY1ZDA3ZDE0YTciLCJleHAiOjE2MDQ5NDE0ODR9.O3MiKfD2RrDjE5sUsTJBuB2b718iSoxE6JDSeaPT4ag' \
--data "host[organization_id]=1" --data "host[location_id]=2"
}
CONSUMER_RPM=$(mktemp --suffix .rpm)
curl --output $CONSUMER_RPM http://testhost.example.com/pub/katello-ca-consumer-latest.noarch.rpm
yum localinstall $CONSUMER_RPM -y
rm -f $CONSUMER_RPM
subscription-manager register --org=Default_Organization --activationkey=""
register_katello_host | bash
else
register_host | bash
fi
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8600 100 8600 0 0 133k 0 --:--:-- --:--:-- --:--:-- 135k
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Examining /tmp/tmp.3kyMSSvKPs.rpm: katello-ca-consumer-testhost.example.com-1.0-1.noarch
/tmp/tmp.3kyMSSvKPs.rpm: does not update installed package.
Nothing to do
Error: Must specify an activation key
This system is not yet registered. Try 'subscription-manager register --help' for more information.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 207 0 164 100 43 881 230 --:--:-- --:--:-- --:--:-- 886
ERROR: not_found
Host was not found by the subscription UUID: '', this can happen if the host is registered already, but not to this Foreman
```
Seems like the AK is not supplied from the hostgroup to the template.
Btw. subscription-manager allows also registration without AK, with supplying just LC environment and content view, should that be supported in the template?
Updated by Peter Ondrejka about 4 years ago
- Related to Feature #30440: Simple & automatic host registration WF added