← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~rjschwei/cloud-init/initcmdGetter into lp:cloud-init

 

Robert Schweikert has proposed merging lp:~rjschwei/cloud-init/initcmdGetter into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~rjschwei/cloud-init/initcmdGetter/+merge/224345

This provides distro handlers the option to set the init_cmd dynamically. Previously the static class variable was accessed, which did not provide support for distributions where differenet init commands need to be supported across multiple distro versions.

For example many distros are switching to systemd, thus the init_cmd should be systemctl, but the same distros used another init system previously (sysV init, upstart, or something else.) Thus the distro handlers should be able to set the init_cmd based on distro specific criteria dynamically.
-- 
https://code.launchpad.net/~rjschwei/cloud-init/initcmdGetter/+merge/224345
Your team cloud init development team is requested to review the proposed merge of lp:~rjschwei/cloud-init/initcmdGetter into lp:cloud-init.
=== modified file 'cloudinit/config/cc_set_passwords.py'
--- cloudinit/config/cc_set_passwords.py	2014-02-06 21:38:30 +0000
+++ cloudinit/config/cc_set_passwords.py	2014-06-24 18:39:33 +0000
@@ -136,7 +136,7 @@
         util.write_file(ssh_util.DEF_SSHD_CFG, "\n".join(lines))
 
         try:
-            cmd = cloud.distro.init_cmd  # Default service
+            cmd = cloud.distro.get_init_cmd()
             cmd.append(cloud.distro.get_option('ssh_svcname', 'ssh'))
             cmd.append('restart')
             if 'systemctl' in cmd:  # Switch action ordering

=== modified file 'cloudinit/distros/__init__.py'
--- cloudinit/distros/__init__.py	2014-02-12 19:56:55 +0000
+++ cloudinit/distros/__init__.py	2014-06-24 18:39:33 +0000
@@ -79,6 +79,9 @@
                            " no file found at %s") % (tz, tz_file))
         return tz_file
 
+    def get_init_cmd(self):
+        return self.init_cmd
+    
     def get_option(self, opt_name, default=None):
         return self._cfg.get(opt_name, default)
 


Follow ups