summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-20 16:39:09 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-20 16:39:09 -0700
commitf7bfe4aaae9850ab179a39436d4b6a9c9da707a5 (patch)
treee5ef14bb609a2841dbf33ee395bdc70f08c20a71
parent787377dbc08f689e4de2a112b5446f89b46d769e (diff)
downloadvyos-cloud-init-f7bfe4aaae9850ab179a39436d4b6a9c9da707a5.tar.gz
vyos-cloud-init-f7bfe4aaae9850ab179a39436d4b6a9c9da707a5.zip
Renamed back to 'cc_*' with the reasoning being that 'cc_' provides
some protection against module name collisions when importing.
-rw-r--r--cloudinit/config/__init__.py19
-rw-r--r--cloudinit/config/cc_apt_pipelining.py (renamed from cloudinit/config/apt_pipelining.py)0
-rw-r--r--cloudinit/config/cc_apt_update_upgrade.py (renamed from cloudinit/config/apt_update_upgrade.py)0
-rw-r--r--cloudinit/config/cc_bootcmd.py (renamed from cloudinit/config/bootcmd.py)0
-rw-r--r--cloudinit/config/cc_byobu.py (renamed from cloudinit/config/byobu.py)0
-rw-r--r--cloudinit/config/cc_ca_certs.py (renamed from cloudinit/config/ca_certs.py)0
-rw-r--r--cloudinit/config/cc_chef.py (renamed from cloudinit/config/chef.py)0
-rw-r--r--cloudinit/config/cc_disable_ec2_metadata.py (renamed from cloudinit/config/disable_ec2_metadata.py)0
-rw-r--r--cloudinit/config/cc_final_message.py (renamed from cloudinit/config/final_message.py)0
-rw-r--r--cloudinit/config/cc_foo.py (renamed from cloudinit/config/foo.py)0
-rw-r--r--cloudinit/config/cc_grub_dpkg.py (renamed from cloudinit/config/grub_dpkg.py)0
-rw-r--r--cloudinit/config/cc_keys_to_console.py (renamed from cloudinit/config/keys_to_console.py)0
-rw-r--r--cloudinit/config/cc_landscape.py (renamed from cloudinit/config/landscape.py)0
-rw-r--r--cloudinit/config/cc_locale.py (renamed from cloudinit/config/locale.py)0
-rw-r--r--cloudinit/config/cc_mounts.py (renamed from cloudinit/config/mounts.py)0
-rw-r--r--cloudinit/config/cc_phone_home.py (renamed from cloudinit/config/phone_home.py)0
-rw-r--r--cloudinit/config/cc_resizefs.py (renamed from cloudinit/config/resizefs.py)0
-rw-r--r--cloudinit/config/cc_rightscale_userdata.py (renamed from cloudinit/config/rightscale_userdata.py)0
-rw-r--r--cloudinit/config/cc_rsyslog.py (renamed from cloudinit/config/rsyslog.py)0
-rw-r--r--cloudinit/config/cc_runcmd.py (renamed from cloudinit/config/runcmd.py)0
-rw-r--r--cloudinit/config/cc_salt_minion.py (renamed from cloudinit/config/salt_minion.py)0
-rw-r--r--cloudinit/config/cc_scripts_per_boot.py (renamed from cloudinit/config/scripts_per_boot.py)0
-rw-r--r--cloudinit/config/cc_scripts_per_instance.py (renamed from cloudinit/config/scripts_per_instance.py)0
-rw-r--r--cloudinit/config/cc_scripts_per_once.py (renamed from cloudinit/config/scripts_per_once.py)0
-rw-r--r--cloudinit/config/cc_scripts_user.py (renamed from cloudinit/config/scripts_user.py)0
-rw-r--r--cloudinit/config/cc_set_hostname.py (renamed from cloudinit/config/set_hostname.py)0
-rw-r--r--cloudinit/config/cc_set_passwords.py (renamed from cloudinit/config/set_passwords.py)0
-rw-r--r--cloudinit/config/cc_ssh.py (renamed from cloudinit/config/ssh.py)0
-rw-r--r--cloudinit/config/cc_ssh_import_id.py (renamed from cloudinit/config/ssh_import_id.py)0
-rw-r--r--cloudinit/config/cc_timezone.py (renamed from cloudinit/config/timezone.py)0
-rw-r--r--cloudinit/config/cc_update_etc_hosts.py (renamed from cloudinit/config/update_etc_hosts.py)0
-rw-r--r--cloudinit/config/cc_update_hostname.py (renamed from cloudinit/config/update_hostname.py)0
32 files changed, 11 insertions, 8 deletions
diff --git a/cloudinit/config/__init__.py b/cloudinit/config/__init__.py
index 5cd08575..74e2f275 100644
--- a/cloudinit/config/__init__.py
+++ b/cloudinit/config/__init__.py
@@ -25,29 +25,32 @@ from cloudinit import log as logging
LOG = logging.getLogger(__name__)
-# TODO remove this from being a prefix??
-TRANSFORM_PREFIX = '' # "cc_"
+# This prefix is used to make it less
+# of a change that when importing
+# we will not find something else with the same
+# name in the lookup path...
+MOD_PREFIX = "cc_"
-def form_transform_name(name, mod=__name__):
+def form_module_name(name):
canon_name = name.replace("-", "_")
if canon_name.lower().endswith(".py"):
canon_name = canon_name[0:(len(canon_name) - 3)]
canon_name = canon_name.strip()
if not canon_name:
return None
- if not canon_name.startswith(TRANSFORM_PREFIX):
- canon_name = '%s%s' % (TRANSFORM_PREFIX, canon_name)
- return ".".join([str(mod), str(canon_name)])
+ if not canon_name.startswith(MOD_PREFIX):
+ canon_name = '%s%s' % (MOD_PREFIX, canon_name)
+ return canon_name
-def fixup_transform(mod, def_freq=PER_INSTANCE):
+def fixup_module(mod, def_freq=PER_INSTANCE):
if not hasattr(mod, 'frequency'):
setattr(mod, 'frequency', def_freq)
else:
freq = mod.frequency
if freq and freq not in FREQUENCIES:
- LOG.warn("Transform %s has an unknown frequency %s", mod, freq)
+ LOG.warn("Module %s has an unknown frequency %s", mod, freq)
if not hasattr(mod, 'handle'):
def empty_handle(_name, _cfg, _cloud, _log, _args):
pass
diff --git a/cloudinit/config/apt_pipelining.py b/cloudinit/config/cc_apt_pipelining.py
index f460becb..f460becb 100644
--- a/cloudinit/config/apt_pipelining.py
+++ b/cloudinit/config/cc_apt_pipelining.py
diff --git a/cloudinit/config/apt_update_upgrade.py b/cloudinit/config/cc_apt_update_upgrade.py
index f5b4b58f..f5b4b58f 100644
--- a/cloudinit/config/apt_update_upgrade.py
+++ b/cloudinit/config/cc_apt_update_upgrade.py
diff --git a/cloudinit/config/bootcmd.py b/cloudinit/config/cc_bootcmd.py
index 635e3a1f..635e3a1f 100644
--- a/cloudinit/config/bootcmd.py
+++ b/cloudinit/config/cc_bootcmd.py
diff --git a/cloudinit/config/byobu.py b/cloudinit/config/cc_byobu.py
index 741aa934..741aa934 100644
--- a/cloudinit/config/byobu.py
+++ b/cloudinit/config/cc_byobu.py
diff --git a/cloudinit/config/ca_certs.py b/cloudinit/config/cc_ca_certs.py
index 56c41561..56c41561 100644
--- a/cloudinit/config/ca_certs.py
+++ b/cloudinit/config/cc_ca_certs.py
diff --git a/cloudinit/config/chef.py b/cloudinit/config/cc_chef.py
index 4e8ef346..4e8ef346 100644
--- a/cloudinit/config/chef.py
+++ b/cloudinit/config/cc_chef.py
diff --git a/cloudinit/config/disable_ec2_metadata.py b/cloudinit/config/cc_disable_ec2_metadata.py
index c7d26029..c7d26029 100644
--- a/cloudinit/config/disable_ec2_metadata.py
+++ b/cloudinit/config/cc_disable_ec2_metadata.py
diff --git a/cloudinit/config/final_message.py b/cloudinit/config/cc_final_message.py
index c257b6d0..c257b6d0 100644
--- a/cloudinit/config/final_message.py
+++ b/cloudinit/config/cc_final_message.py
diff --git a/cloudinit/config/foo.py b/cloudinit/config/cc_foo.py
index 99135704..99135704 100644
--- a/cloudinit/config/foo.py
+++ b/cloudinit/config/cc_foo.py
diff --git a/cloudinit/config/grub_dpkg.py b/cloudinit/config/cc_grub_dpkg.py
index 02f05ce3..02f05ce3 100644
--- a/cloudinit/config/grub_dpkg.py
+++ b/cloudinit/config/cc_grub_dpkg.py
diff --git a/cloudinit/config/keys_to_console.py b/cloudinit/config/cc_keys_to_console.py
index 40758198..40758198 100644
--- a/cloudinit/config/keys_to_console.py
+++ b/cloudinit/config/cc_keys_to_console.py
diff --git a/cloudinit/config/landscape.py b/cloudinit/config/cc_landscape.py
index 29ce41b9..29ce41b9 100644
--- a/cloudinit/config/landscape.py
+++ b/cloudinit/config/cc_landscape.py
diff --git a/cloudinit/config/locale.py b/cloudinit/config/cc_locale.py
index 7f273123..7f273123 100644
--- a/cloudinit/config/locale.py
+++ b/cloudinit/config/cc_locale.py
diff --git a/cloudinit/config/mounts.py b/cloudinit/config/cc_mounts.py
index 700fbc44..700fbc44 100644
--- a/cloudinit/config/mounts.py
+++ b/cloudinit/config/cc_mounts.py
diff --git a/cloudinit/config/phone_home.py b/cloudinit/config/cc_phone_home.py
index a8752527..a8752527 100644
--- a/cloudinit/config/phone_home.py
+++ b/cloudinit/config/cc_phone_home.py
diff --git a/cloudinit/config/resizefs.py b/cloudinit/config/cc_resizefs.py
index 1690094a..1690094a 100644
--- a/cloudinit/config/resizefs.py
+++ b/cloudinit/config/cc_resizefs.py
diff --git a/cloudinit/config/rightscale_userdata.py b/cloudinit/config/cc_rightscale_userdata.py
index 8385e281..8385e281 100644
--- a/cloudinit/config/rightscale_userdata.py
+++ b/cloudinit/config/cc_rightscale_userdata.py
diff --git a/cloudinit/config/rsyslog.py b/cloudinit/config/cc_rsyslog.py
index f2c1de1e..f2c1de1e 100644
--- a/cloudinit/config/rsyslog.py
+++ b/cloudinit/config/cc_rsyslog.py
diff --git a/cloudinit/config/runcmd.py b/cloudinit/config/cc_runcmd.py
index f121484b..f121484b 100644
--- a/cloudinit/config/runcmd.py
+++ b/cloudinit/config/cc_runcmd.py
diff --git a/cloudinit/config/salt_minion.py b/cloudinit/config/cc_salt_minion.py
index 16f5286d..16f5286d 100644
--- a/cloudinit/config/salt_minion.py
+++ b/cloudinit/config/cc_salt_minion.py
diff --git a/cloudinit/config/scripts_per_boot.py b/cloudinit/config/cc_scripts_per_boot.py
index 364e1d02..364e1d02 100644
--- a/cloudinit/config/scripts_per_boot.py
+++ b/cloudinit/config/cc_scripts_per_boot.py
diff --git a/cloudinit/config/scripts_per_instance.py b/cloudinit/config/cc_scripts_per_instance.py
index d75ab47d..d75ab47d 100644
--- a/cloudinit/config/scripts_per_instance.py
+++ b/cloudinit/config/cc_scripts_per_instance.py
diff --git a/cloudinit/config/scripts_per_once.py b/cloudinit/config/cc_scripts_per_once.py
index 80f8c325..80f8c325 100644
--- a/cloudinit/config/scripts_per_once.py
+++ b/cloudinit/config/cc_scripts_per_once.py
diff --git a/cloudinit/config/scripts_user.py b/cloudinit/config/cc_scripts_user.py
index f4fe3a2a..f4fe3a2a 100644
--- a/cloudinit/config/scripts_user.py
+++ b/cloudinit/config/cc_scripts_user.py
diff --git a/cloudinit/config/set_hostname.py b/cloudinit/config/cc_set_hostname.py
index 3ac8a8fa..3ac8a8fa 100644
--- a/cloudinit/config/set_hostname.py
+++ b/cloudinit/config/cc_set_hostname.py
diff --git a/cloudinit/config/set_passwords.py b/cloudinit/config/cc_set_passwords.py
index e7049f22..e7049f22 100644
--- a/cloudinit/config/set_passwords.py
+++ b/cloudinit/config/cc_set_passwords.py
diff --git a/cloudinit/config/ssh.py b/cloudinit/config/cc_ssh.py
index e5e99560..e5e99560 100644
--- a/cloudinit/config/ssh.py
+++ b/cloudinit/config/cc_ssh.py
diff --git a/cloudinit/config/ssh_import_id.py b/cloudinit/config/cc_ssh_import_id.py
index d57e4665..d57e4665 100644
--- a/cloudinit/config/ssh_import_id.py
+++ b/cloudinit/config/cc_ssh_import_id.py
diff --git a/cloudinit/config/timezone.py b/cloudinit/config/cc_timezone.py
index 747c436c..747c436c 100644
--- a/cloudinit/config/timezone.py
+++ b/cloudinit/config/cc_timezone.py
diff --git a/cloudinit/config/update_etc_hosts.py b/cloudinit/config/cc_update_etc_hosts.py
index 75615db1..75615db1 100644
--- a/cloudinit/config/update_etc_hosts.py
+++ b/cloudinit/config/cc_update_etc_hosts.py
diff --git a/cloudinit/config/update_hostname.py b/cloudinit/config/cc_update_hostname.py
index 58444fab..58444fab 100644
--- a/cloudinit/config/update_hostname.py
+++ b/cloudinit/config/cc_update_hostname.py