configure

in chef/cookbooks/cpe_chefctl/resources/cpe_chefctl.rb [33:75]


  def configure
    chefctl_path = CPE::Chefctl.path(
      node['cpe_chefctl']['config']['paths']['chefctl'],
    )
    cookbook_file chefctl_path do
      source 'chefctl.rb'
      user root_owner
      group node['root_group']
      mode '0755'
    end

    lock_dir = ::File.dirname(
      node['cpe_chefctl']['config']['chefctl']['lock_file'],
    )
    directory lock_dir do
      recursive true
    end
    
    unless windows?
      chefctl_symlink = ::File.join(
        node['cpe_chefctl']['config']['chefctl']['symlink'],
        'chefctl',
      )
      link chefctl_symlink do
        to chefctl_path
      end
    end

    conf = node['cpe_chefctl']['config']['chefctl'].compact
    return if conf.empty? || conf.nil?

    
    config_path = CPE::Chefctl.config(
      node['cpe_chefctl']['config']['paths']['chefctl_config'],
    )
    template config_path do
      source 'chefctl_config.rb.erb'
      variables(
        'config' => conf,
      )
    end
  end