diff options
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rwxr-xr-x | cloudinit/distros/__init__.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 86a22c3e..e63b8c7a 100755 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -816,6 +816,11 @@ def _sanitize_mirror_url(url: str): lambda hostname: ''.join( c if c in acceptable_chars else "-" for c in hostname ), + + # Drop leading/trailing hyphens from each part of the hostname + lambda hostname: '.'.join( + part.strip('-') for part in hostname.split('.') + ), ] return _apply_hostname_transformations_to_url(url, transformations) |