summaryrefslogtreecommitdiff
path: root/cloudinit/helpers.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2013-07-23 11:57:25 -0400
committerScott Moser <smoser@ubuntu.com>2013-07-23 11:57:25 -0400
commita8d2b2f8d7b9315d729873b15ed8dedb9c1b069f (patch)
treeca67cdb7f131382746353fae8eebfb2e00b50f5b /cloudinit/helpers.py
parentd66973bc6850b18b7ad69341e5b626919d8606f5 (diff)
parentd655d019fb0a45389d87db39b0ef5001e27e2616 (diff)
downloadvyos-cloud-init-a8d2b2f8d7b9315d729873b15ed8dedb9c1b069f.tar.gz
vyos-cloud-init-a8d2b2f8d7b9315d729873b15ed8dedb9c1b069f.zip
finalize handlers even when another handler fails.
Instead of previously initializing and not finalizing the handles that completed successfully when a handler initializing or running failed we should attempt to always give said handlers a chance to finalize (even when another handler fails). LP: #1203368
Diffstat (limited to 'cloudinit/helpers.py')
-rw-r--r--cloudinit/helpers.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py
index b91c1290..1c46efde 100644
--- a/cloudinit/helpers.py
+++ b/cloudinit/helpers.py
@@ -281,6 +281,7 @@ class ContentHandlers(object):
def __init__(self):
self.registered = {}
+ self.initialized = []
def __contains__(self, item):
return self.is_registered(item)
@@ -291,11 +292,13 @@ class ContentHandlers(object):
def is_registered(self, content_type):
return content_type in self.registered
- def register(self, mod):
+ def register(self, mod, initialized=False):
types = set()
for t in mod.list_types():
self.registered[t] = mod
types.add(t)
+ if initialized and mod not in self.initialized:
+ self.initialized.append(mod)
return types
def _get_handler(self, content_type):