1 diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
2 index 79e26235..bdc32c52 100644
3 --- a/cloudinit/distros/__init__.py
4 +++ b/cloudinit/distros/__init__.py
5 @@ -91,6 +91,7 @@ OSFAMILIES = {
7 "openeuler": ["openeuler"],
8 "OpenCloudOS": ["OpenCloudOS", "TencentOS"],
12 LOG = logging.getLogger(__name__)
13 diff --git a/cloudinit/distros/nixos.py b/cloudinit/distros/nixos.py
15 index 00000000..67c049b8
17 +++ b/cloudinit/distros/nixos.py
21 +# Copyright (C) 2012 Canonical Ltd.
22 +# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
23 +# Copyright (C) 2012 Yahoo! Inc.
25 +# Author: Scott Moser <scott.moser@canonical.com>
26 +# Author: Juerg Haefliger <juerg.haefliger@hp.com>
27 +# Author: Joshua Harlow <harlowja@yahoo-inc.com>
29 +# This program is free software: you can redistribute it and/or modify
30 +# it under the terms of the GNU General Public License version 3, as
31 +# published by the Free Software Foundation.
33 +# This program is distributed in the hope that it will be useful,
34 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
35 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 +# GNU General Public License for more details.
38 +# You should have received a copy of the GNU General Public License
39 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
44 +from cloudinit import distros
45 +from cloudinit import helpers
46 +from cloudinit import util
47 +from cloudinit import atomic_helper
49 +from cloudinit.distros.parsers.hostname import HostnameConf
50 +from cloudinit.net import dhcp
52 +LOG = logging.getLogger(__name__)
54 +class Distro(distros.Distro):
56 + def __init__(self, name, cfg, paths):
57 + distros.Distro.__init__(self, name, cfg, paths)
58 + # This will be used to restrict certain
59 + # calls from repeatly happening (when they
60 + # should only happen say once per instance...)
61 + self._runner = helpers.Runners(paths)
62 + self.usr_lib_exec = os.path.join(os.path.dirname(__file__),
63 + "../../../../../libexec")
64 + self.osfamily = 'nixos'
65 + self.dhcp_client_priority = [
71 + def _select_hostname(self, hostname, fqdn):
72 + # Prefer the short hostname over the long
73 + # fully qualified domain name
78 + def _write_hostname(self, your_hostname, out_fn):
81 + # Try to update the previous one
82 + # so lets see if we can read it first.
83 + conf = self._read_hostname_conf(out_fn)
87 + conf = HostnameConf('')
88 + conf.set_hostname(your_hostname)
89 + atomic_helper.write_file(out_fn, str(conf).encode("utf-8"))
91 + def _read_system_hostname(self):
92 + sys_hostname = self._read_hostname(self.hostname_conf_fn)
93 + return (self.hostname_conf_fn, sys_hostname)
95 + def _read_hostname_conf(self, filename):
96 + conf = HostnameConf(util.load_text_file(filename))
100 + def _read_hostname(self, filename, default=None):
103 + conf = self._read_hostname_conf(filename)
104 + hostname = conf.hostname
111 + def _write_network(self, settings):
112 + raise NotImplementedError()
114 + def apply_locale(self, locale, out_fn=None):
115 + raise NotImplementedError()
117 + def install_packages(self, pkglist):
118 + raise NotImplementedError()
120 + def package_command(self, command, args=None, pkgs=None):
123 + def set_timezone(self, tz):
126 + def update_package_sources(self):