From 22184b7ca3f78808d8025bab5981ed92f8ad99f5 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 17 Jun 2010 22:22:39 -0400 Subject: make cloud-config modules configurable by cloud-config The list of cloud-config modules is now kept in cloud config itself. There is a builtin list in cloudinit, which is overrideable by /etc/cloud/cloud.cfg or user data cloud-config. This should make the modules more easily added or removed (as no code needs to be edited now) Basic summary of changes: - move CloudConfig.py -> cloudinit/CloudConfig/__init__.py - split cloud-config modules into their own files named cloudinit/CloudConfig/cc_.py - remove all the upstart/cloud-config-* scripts, replacing them with upstart/cloud-config.conf --- cloudinit/__init__.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'cloudinit/__init__.py') diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py index d8f2c8c9..2b76a73f 100644 --- a/cloudinit/__init__.py +++ b/cloudinit/__init__.py @@ -26,6 +26,7 @@ userdata_raw = datadir + '/user-data.txt' userdata = datadir + '/user-data.txt.i' user_scripts_dir = datadir + "/scripts" cloud_config = datadir + '/cloud-config.txt' +#cloud_config = '/tmp/cloud-config.txt' data_source_cache = cachedir + '/obj.pkl' system_config = '/etc/cloud/cloud.cfg' cfg_env_name = "CLOUD_CFG" @@ -36,12 +37,13 @@ user: ubuntu disable_root: 1 cloud_config_modules: + - mounts + - ssh - apt-update-upgrade - - config-misc - - config-mounts - - config-puppet - - config-ssh + - puppet + - updates-check - disable-ec2-metadata + - runcmd log_cfg: built_in """ @@ -316,7 +318,9 @@ class CloudInit: # if 'clear_on_fail' is True and func throws an exception # then remove the lock (so it would run again) def sem_and_run(self,semname,freq,func,args=[],clear_on_fail=False): - if self.sem_has_run(semname,freq): return + if self.sem_has_run(semname,freq): + log.debug("%s already ran %s", semname, freq) + return try: if not self.sem_acquire(semname,freq): raise Exception("Failed to acquire lock on %s\n" % semname) -- cgit v1.2.3