summaryrefslogtreecommitdiff
path: root/cloudinit/distros/__init__.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2017-08-16 16:50:07 -0500
committerScott Moser <smoser@brickies.net>2017-08-30 21:10:08 -0400
commit7e76c57b590c7c2c13f7b1a2a8b5b7d4f2d18396 (patch)
treef0eb82212d46bc6373e104c864ab9810663a7417 /cloudinit/distros/__init__.py
parent300e4516f78dbb0a9533749aa84f7e366b023d04 (diff)
downloadvyos-cloud-init-7e76c57b590c7c2c13f7b1a2a8b5b7d4f2d18396.tar.gz
vyos-cloud-init-7e76c57b590c7c2c13f7b1a2a8b5b7d4f2d18396.zip
distro: allow distro to specify a default locale
Currently the cloud-init default locale (en_US.UTF-8) is set by the base datasource class. This patch allows a distro to overide the fallback value with one that's available in the distro but continues to respect an image which has preconfigured a locale. - Distro object now has a get_locale method which will return a preconfigure locale setting by checking the distros locale system configuration file. If not set or not present, return the default locale of en_US.UTF-8 which retains behavior of all previous cloud-init releases. - Apply locale now handles regenerating locales or system configuration files as needed. - Adjust apply_locale logic to skip locale-regen if the specified LANG value is C.UTF-8,C, or POSIX; they do not require regeneration. - Further add unittests to exercise the default paths for Ubuntu and non-ubuntu paths to validate they get the LANG expected.
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rwxr-xr-xcloudinit/distros/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 807b3ea2..b714b9ab 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -188,6 +188,9 @@ class Distro(object):
def _get_localhost_ip(self):
return "127.0.0.1"
+ def get_locale(self):
+ raise NotImplementedError()
+
@abc.abstractmethod
def _read_hostname(self, filename, default=None):
raise NotImplementedError()