Set facter variable 'uuid' explicitly in docker-puppet.py

Unprivileged docker-puppet-$service containers don't have access
to devices and can't get facter 'uuid' variable. Therefore per node
hiera customizations don't work. We can work around this by using
/sys/class/dmi/id/product_uuid instead.

dmidecode>=3.1 returns system-id in lower case, so it's better to
use lowe case for compatibility.

This would also require changes to the docs as ironic node
introspection data may show it in both cases.

Change-Id: I899de7732c5b29ed70d4d487fdbc363117ac327f
Closes-Bug: #1806011
This commit is contained in:
Rabi Mishra 2018-11-30 11:12:11 +05:30
parent b6b4201be1
commit 4de17945a1
2 changed files with 4 additions and 1 deletions

View File

@ -285,6 +285,7 @@ with open(sh_script, 'w') as script_file:
fi
# $::deployment_type in puppet-tripleo
export FACTER_deployment_type=containers
export FACTER_uuid=$(cat /sys/class/dmi/id/product_uuid | tr '[:upper:]' '[:lower:]')
/usr/bin/puppet apply --summarize \
--detailed-exitcodes \
--color=false \

View File

@ -29,7 +29,9 @@ resources:
- name: node_lookup
config: |
#!/bin/sh
node_id=$(dmidecode --s system-uuid | awk 'match($0, /[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/) { print substr($0, RSTART, RLENGTH) }')
node_id=$(dmidecode --s system-uuid | awk 'match($0, \
/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/) \
{ print substr($0, RSTART, RLENGTH) }' | tr '[:upper:]' '[:lower:]')
# Create a /etc/puppet/hieradata/UUID.json file to provide
# the data of the NodeDataLookup parameter that matches the