diff options
-rw-r--r-- | cloudinit/parts.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cloudinit/parts.py b/cloudinit/parts.py index 9cd24c5a..6af1ab7c 100644 --- a/cloudinit/parts.py +++ b/cloudinit/parts.py @@ -137,9 +137,23 @@ def fixup_module(mod): setattr(mod, 'list_types', empty_types) if not hasattr(mod, frequency): setattr(mod, 'frequency', PER_INSTANCE) + if not hasattr(mod, 'handle_part'): + def empty_handler(data, ctype, filename, payload): + pass + setattr(mod, 'handle_part', empty_handler) return mod +def find_module_files(root_dir): + entries = dict() + for fname in glob.glob(os.path.join(root_dir, "*.py")): + if not os.path.isfile(fname): + continue + modname = os.path.basename(fname)[0:-3] + entries[fname] = modname + return entries + + def run_part(mod, data, ctype, filename, payload, frequency): # only add the handler if the module should run mod_freq = getattr(mod, "frequency") |