mirror of
https://github.com/netdata/netdata.git
synced 2025-05-05 01:30:32 +00:00
Better handle creation of UUID for claiming. (#11974)
* Properly check for the availability of `uuidgen` before blindly using it. * Fall back on Linux to the kernel-provided interface for generating UUIDs if `uuidgen` is not present. * Provide a more useful error message if we can’t use either option.
This commit is contained in:
parent
96376fc8b5
commit
3f06aa65ae
1 changed files with 8 additions and 1 deletions
|
@ -151,7 +151,14 @@ NETDATA_USER=$(get_config_value netdata global "run as user")
|
||||||
gen_id() {
|
gen_id() {
|
||||||
local id
|
local id
|
||||||
|
|
||||||
id="$(uuidgen)"
|
if command -v uuidgen > /dev/null 2>&1; then
|
||||||
|
id="$(uuidgen)"
|
||||||
|
elif [ -r /proc/sys/kernel/random/uuid ]; then
|
||||||
|
id="$(cat /proc/sys/kernel/random/uuid)"
|
||||||
|
else
|
||||||
|
echo >&2 "Unable to generate machine ID."
|
||||||
|
exit 18
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${id}" = "8a795b0c-2311-11e6-8563-000c295076a6" ] || [ "${id}" = "4aed1458-1c3e-11e6-a53f-000c290fc8f5" ]; then
|
if [ "${id}" = "8a795b0c-2311-11e6-8563-000c295076a6" ] || [ "${id}" = "4aed1458-1c3e-11e6-a53f-000c290fc8f5" ]; then
|
||||||
gen_id
|
gen_id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue