diff options
author | Joshua Harlow <harlowja@gmail.com> | 2013-07-23 12:05:04 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-07-23 12:05:04 -0400 |
commit | 838d6c7ddcac8544afb99cb78e8d044fd63b835f (patch) | |
tree | c44bde5e0e7a64a70d1981c38d468311435fafd5 /cloudinit/handlers/cloud_config.py | |
parent | a8d2b2f8d7b9315d729873b15ed8dedb9c1b069f (diff) | |
parent | 27f096a1ab2e60222f85d87c961e388fdefaf92c (diff) | |
download | vyos-cloud-init-838d6c7ddcac8544afb99cb78e8d044fd63b835f.tar.gz vyos-cloud-init-838d6c7ddcac8544afb99cb78e8d044fd63b835f.zip |
use constants for startswith in handlers. add strip_prefix_suffix.
Just cleans up some repeated strings into module constants + a util function to
do the boothook prefix cleanup (before writing).
Diffstat (limited to 'cloudinit/handlers/cloud_config.py')
-rw-r--r-- | cloudinit/handlers/cloud_config.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/handlers/cloud_config.py b/cloudinit/handlers/cloud_config.py index c97ca3e8..730672d7 100644 --- a/cloudinit/handlers/cloud_config.py +++ b/cloudinit/handlers/cloud_config.py @@ -49,6 +49,7 @@ MERGE_HEADER = 'Merge-Type' # # This gets loaded into yaml with final result {'a': 22} DEF_MERGERS = mergers.string_extract_mergers('dict(replace)+list()+str()') +CLOUD_PREFIX = "#cloud-config" class CloudConfigPartHandler(handlers.Handler): @@ -60,7 +61,7 @@ class CloudConfigPartHandler(handlers.Handler): def list_types(self): return [ - handlers.type_from_starts_with("#cloud-config"), + handlers.type_from_starts_with(CLOUD_PREFIX), ] def _write_cloud_config(self): @@ -78,7 +79,7 @@ class CloudConfigPartHandler(handlers.Handler): if self.cloud_buf is not None: # Something was actually gathered.... lines = [ - "#cloud-config", + CLOUD_PREFIX, '', ] lines.extend(file_lines) |