diff options
author | Joshua Harlow <harlowja@gmail.com> | 2014-10-11 19:30:12 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2014-10-11 19:30:12 -0700 |
commit | 32bb2f37593482b179c8627bb254d50121a8be01 (patch) | |
tree | f8c1fb3fcf1f1dcfb287460bfd2fb29089ca7a41 /cloudinit/config/cc_chef.py | |
parent | fc380079288da045b1bfd61fb9ef2490a7cc1f82 (diff) | |
download | vyos-cloud-init-32bb2f37593482b179c8627bb254d50121a8be01.tar.gz vyos-cloud-init-32bb2f37593482b179c8627bb254d50121a8be01.zip |
Have the caller find the param paths instead of the param creator
Diffstat (limited to 'cloudinit/config/cc_chef.py')
-rw-r--r-- | cloudinit/config/cc_chef.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py index 28562caf..66187659 100644 --- a/cloudinit/config/cc_chef.py +++ b/cloudinit/config/cc_chef.py @@ -119,11 +119,7 @@ def get_template_params(iid, chef_cfg, log): 'validation_name': util.get_cfg_option_str(chef_cfg, 'validation_name'), }) - paths = set() - for (k, v) in params.items(): - if k in CHEF_RB_PATH_KEYS and v: - paths.add(os.path.dirname(v)) - return params, paths + return params def handle(name, cfg, cloud, log, _args): @@ -154,9 +150,12 @@ def handle(name, cfg, cloud, log, _args): template_fn = cloud.get_template_filename('chef_client.rb') if template_fn: iid = str(cloud.datasource.get_instance_id()) - params, paths = get_template_params(iid, chef_cfg, log) - for d in paths: - util.ensure_dir(d) + params = get_template_params(iid, chef_cfg, log) + param_paths = set() + for (k, v) in params.items(): + if k in CHEF_RB_PATH_KEYS and v: + param_paths.add(os.path.dirname(v)) + util.ensure_dirs(param_paths) templater.render_to_file(template_fn, CHEF_RB_PATH, params) else: log.warn("No template found, not rendering to %s", |