diff options
Diffstat (limited to 'cloudinit/CloudConfig/cc_chef.py')
-rw-r--r-- | cloudinit/CloudConfig/cc_chef.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cloudinit/CloudConfig/cc_chef.py b/cloudinit/CloudConfig/cc_chef.py index 8b2cfc2a..5f13c77d 100644 --- a/cloudinit/CloudConfig/cc_chef.py +++ b/cloudinit/CloudConfig/cc_chef.py @@ -32,8 +32,9 @@ def handle(name,cfg,cloud,log,args): chef_cfg = cfg['chef'] # Install chef packages from selected source + install_type = util.get_cfg_option_str(chef_cfg, "install_type", "packages") if not os.path.isfile('/usr/bin/chef-client'): - if chef_cfg['install_type'] == "gems": + if install_type == "gems": if chef_cfg.has_key('version'): chef_version = chef_cfg['version'] else: @@ -48,10 +49,12 @@ def handle(name,cfg,cloud,log,args): if chef_cfg.has_key('validation_cert'): with open('/etc/chef/validation.pem', 'w') as validation_cert_fh: validation_cert_fh.write(chef_cfg['validation_cert']) - + + validation_name = chef_cfg.get('validation_name','chef-validator') # create the chef config from template util.render_to_file('chef_client.rb', '/etc/chef/client.rb', - {'server_url': chef_cfg['server_url'], 'validation_name': chef_cfg['validation_name'] || 'chef-validator'}) + {'server_url': chef_cfg['server_url'], + 'validation_name': chef_cfg['validation_name']}) chef_args = ['-d'] # set the firstboot json @@ -65,6 +68,7 @@ def handle(name,cfg,cloud,log,args): chef_args.append('-j /etc/chef/firstboot.json') # and finally, run chef + log.debug("running chef-client %s" % chef_args) subprocess.check_call(['/usr/bin/chef-client'] + chef_args) def install_chef_from_gems(ruby_version, chef_version = None): |