diff --git a/ironic/common/utils.py b/ironic/common/utils.py index 272ec78d12..6d5c1b0a17 100644 --- a/ironic/common/utils.py +++ b/ironic/common/utils.py @@ -185,11 +185,13 @@ def is_hostname_safe(hostname): * http://tools.ietf.org/html/rfc952 * http://tools.ietf.org/html/rfc1123 + Also allow "." because what kind of hostname doesn't allow that. + :param hostname: The hostname to be validated. :returns: True if valid. False if not. """ - m = '^[a-z0-9]([a-z0-9\-]{0,61}[a-z0-9])?$' + m = '^[a-z0-9]([a-z0-9\-\.]{0,61}[a-z0-9])?$' return (isinstance(hostname, six.string_types) and (re.match(m, hostname) is not None)) diff --git a/ironic/tests/test_utils.py b/ironic/tests/test_utils.py index d6de997e5e..044f32beea 100644 --- a/ironic/tests/test_utils.py +++ b/ironic/tests/test_utils.py @@ -343,6 +343,7 @@ class GenericUtilsTestCase(base.TestCase): self.assertFalse(utils.is_hostname_safe('spam-')) self.assertTrue(utils.is_hostname_safe('spam-eggs')) self.assertFalse(utils.is_hostname_safe('spam eggs')) + self.assertTrue(utils.is_hostname_safe('spam.eggs')) self.assertTrue(utils.is_hostname_safe('9spam')) self.assertTrue(utils.is_hostname_safe('spam7')) self.assertTrue(utils.is_hostname_safe('br34kf4st'))