cloud-init: 0.7.6 -> 0.7.9

Changed files
+121 -5
pkgs
tools
virtualization
+113
pkgs/tools/virtualization/cloud-init/add-nixos-support.patch
··· 1 + diff -ruN cloud-init-0.7.6.orig/cloudinit/distros/__init__.py cloud-init-0.7.6/cloudinit/distros/__init__.py 2 + --- cloud-init-0.7.6.orig/cloudinit/distros/__init__.py 2014-10-10 15:26:25.000000000 +0000 3 + +++ cloud-init-0.7.6/cloudinit/distros/__init__.py 2016-06-08 07:51:45.230357099 +0000 4 + @@ -43,6 +43,7 @@ 5 + 'freebsd': ['freebsd'], 6 + 'suse': ['sles'], 7 + 'arch': ['arch'], 8 + + 'nixos': ['nixos'], 9 + } 10 + 11 + LOG = logging.getLogger(__name__) 12 + diff -ruN cloud-init-0.7.6.orig/cloudinit/distros/nixos.py cloud-init-0.7.6/cloudinit/distros/nixos.py 13 + --- cloud-init-0.7.6.orig/cloudinit/distros/nixos.py 1970-01-01 00:00:00.000000000 +0000 14 + +++ cloud-init-0.7.6/cloudinit/distros/nixos.py 2016-06-08 07:50:58.602616595 +0000 15 + @@ -0,0 +1,98 @@ 16 + +# vi: ts=4 expandtab 17 + +# 18 + +# Copyright (C) 2012 Canonical Ltd. 19 + +# Copyright (C) 2012 Hewlett-Packard Development Company, L.P. 20 + +# Copyright (C) 2012 Yahoo! Inc. 21 + +# 22 + +# Author: Scott Moser <scott.moser@canonical.com> 23 + +# Author: Juerg Haefliger <juerg.haefliger@hp.com> 24 + +# Author: Joshua Harlow <harlowja@yahoo-inc.com> 25 + +# 26 + +# This program is free software: you can redistribute it and/or modify 27 + +# it under the terms of the GNU General Public License version 3, as 28 + +# published by the Free Software Foundation. 29 + +# 30 + +# This program is distributed in the hope that it will be useful, 31 + +# but WITHOUT ANY WARRANTY; without even the implied warranty of 32 + +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 + +# GNU General Public License for more details. 34 + +# 35 + +# You should have received a copy of the GNU General Public License 36 + +# along with this program. If not, see <http://www.gnu.org/licenses/>. 37 + + 38 + +from cloudinit import distros 39 + +from cloudinit import helpers 40 + +from cloudinit import log as logging 41 + +from cloudinit import util 42 + + 43 + +from cloudinit.distros.parsers.hostname import HostnameConf 44 + + 45 + +LOG = logging.getLogger(__name__) 46 + + 47 + +class Distro(distros.Distro): 48 + + 49 + + def __init__(self, name, cfg, paths): 50 + + distros.Distro.__init__(self, name, cfg, paths) 51 + + # This will be used to restrict certain 52 + + # calls from repeatly happening (when they 53 + + # should only happen say once per instance...) 54 + + self._runner = helpers.Runners(paths) 55 + + self.osfamily = 'nixos' 56 + + 57 + + def _select_hostname(self, hostname, fqdn): 58 + + # Prefer the short hostname over the long 59 + + # fully qualified domain name 60 + + if not hostname: 61 + + return fqdn 62 + + return hostname 63 + + 64 + + def _write_hostname(self, your_hostname, out_fn): 65 + + conf = None 66 + + try: 67 + + # Try to update the previous one 68 + + # so lets see if we can read it first. 69 + + conf = self._read_hostname_conf(out_fn) 70 + + except IOError: 71 + + pass 72 + + if not conf: 73 + + conf = HostnameConf('') 74 + + conf.set_hostname(your_hostname) 75 + + util.write_file(out_fn, str(conf), 0644) 76 + + 77 + + def _read_system_hostname(self): 78 + + sys_hostname = self._read_hostname(self.hostname_conf_fn) 79 + + return (self.hostname_conf_fn, sys_hostname) 80 + + 81 + + def _read_hostname_conf(self, filename): 82 + + conf = HostnameConf(util.load_file(filename)) 83 + + conf.parse() 84 + + return conf 85 + + 86 + + def _read_hostname(self, filename, default=None): 87 + + hostname = None 88 + + try: 89 + + conf = self._read_hostname_conf(filename) 90 + + hostname = conf.hostname 91 + + except IOError: 92 + + pass 93 + + if not hostname: 94 + + return default 95 + + return hostname 96 + + 97 + + def _write_network(self, settings): 98 + + raise NotImplementedError() 99 + + 100 + + def apply_locale(self, locale, out_fn=None): 101 + + raise NotImplementedError() 102 + + 103 + + def install_packages(self, pkglist): 104 + + raise NotImplementedError() 105 + + 106 + + def package_command(self, command, args=None, pkgs=None): 107 + + raise NotImplementedError() 108 + + 109 + + def set_timezone(self, tz): 110 + + raise NotImplementedError() 111 + + 112 + + def update_package_sources(self): 113 + + raise NotImplementedError()
+8 -5
pkgs/tools/virtualization/cloud-init/default.nix
··· 1 - { lib, pythonPackages, fetchurl }: 1 + { lib, pythonPackages, fetchurl, kmod, systemd }: 2 2 3 - let version = "0.7.6"; 3 + let version = "0.7.9"; 4 4 5 5 in pythonPackages.buildPythonApplication rec { 6 6 name = "cloud-init-${version}"; ··· 8 8 9 9 src = fetchurl { 10 10 url = "https://launchpad.net/cloud-init/trunk/${version}/+download/cloud-init-${version}.tar.gz"; 11 - sha256 = "1mry5zdkfaq952kn1i06wiggc66cqgfp6qgnlpk0mr7nnwpd53wy"; 11 + sha256 = "0wnl76pdcj754pl99wxx76hkir1s61x0bg0lh27sdgdxy45vivbn"; 12 12 }; 13 13 14 + patches = [ ./add-nixos-support.patch ]; 14 15 patchPhase = '' 15 16 patchShebangs ./tools 16 17 ··· 19 20 --replace /etc $out/etc \ 20 21 --replace /lib/systemd $out/lib/systemd \ 21 22 --replace 'self.init_system = ""' 'self.init_system = "systemd"' 23 + 24 + patchPhase 22 25 ''; 23 26 24 27 propagatedBuildInputs = with pythonPackages; [ cheetah jinja2 prettytable 25 - oauth pyserial configobj pyyaml argparse requests jsonpatch ]; 28 + oauthlib pyserial configobj pyyaml argparse requests jsonpatch ]; 26 29 27 30 meta = { 28 31 homepage = http://cloudinit.readthedocs.org; 29 32 description = "Provides configuration and customization of cloud instance"; 30 - maintainers = [ lib.maintainers.madjar ]; 33 + maintainers = [ lib.maintainers.madjar lib.maintainers.phile314 ]; 31 34 platforms = lib.platforms.all; 32 35 }; 33 36 }