def _default_handlers(self, opts=None): if opts is None: opts = {} opts.update({ 'paths': self.paths, 'datasource': self.datasource, }) # TODO(harlowja) Hmmm, should we dynamically import these?? def_handlers = [ cc_part.CloudConfigPartHandler(**opts), ss_part.ShellScriptPartHandler(**opts), bh_part.BootHookPartHandler(**opts), up_part.UpstartJobPartHandler(**opts), ] return def_handlers
def test_merge_cc_samples(self): tests = self._load_merge_files() paths = c_helpers.Paths({}) cc_handler = cloud_config.CloudConfigPartHandler(paths) cc_handler.cloud_fn = None for (payloads, (expected_merge, expected_fn)) in tests: cc_handler.handle_part(None, CONTENT_START, None, None, None, None) merging_fns = [] for (fn, contents) in payloads: cc_handler.handle_part(None, None, "%s.yaml" % (fn), contents, None, {}) merging_fns.append(fn) merged_buf = cc_handler.cloud_buf cc_handler.handle_part(None, CONTENT_END, None, None, None, None) fail_msg = "Equality failure on checking %s with %s: %s != %s" fail_msg = fail_msg % (expected_fn, ",".join(merging_fns), merged_buf, expected_merge) self.assertEqual(expected_merge, merged_buf, msg=fail_msg)