cloudbase / cloudbase-init

Cross-platform instance initialization
http://openstack.org
Apache License 2.0
414 stars 150 forks source link

hostname '-' is replaced to '0' #72

Closed wywself closed 2 years ago

wywself commented 3 years ago

hello,

the code hostname = re.sub(r'-$', '0', hostname) in cloudbase-init/utils/hostname.py will replace the last '-' to '0', What does this substitution mean? why is this necessary?

image

Can someone help me please? Thank you.

ader1990 commented 3 years ago

Hello,

According to https://datatracker.ietf.org/doc/html/rfc952, the hostname cannot end with a hyphen (can be a digit or a letter). At the time of the change, replacing the hyphen with a digit or a letter made sense.

Do you have an issue caused by this substitution?

Thank you, Adrian Vladu