install

in chef/cookbooks/cpe_crowdstrike_falcon_sensor/resources/cpe_crowdstrike_falcon_sensor.rb [54:91]


  def install
    return unless node['cpe_crowdstrike_falcon_sensor']['install']

    
    run_install_logic = true
    [falcon_agent_prefs.to_hash, falcon_pkg_prefs.to_hash].each do |hash|
      
      hash.each_key do |preference|
        if hash[preference].nil? || hash[preference].to_s.empty?
          
          Chef::Log.warn("cpe_crowdstrike_falcon_sensor incorrectly configured preference - #{preference}")
          
          run_install_logic = false
        end
      end
    end

    unless run_install_logic
      Chef::Log.warn('cpe_crowdstrike_falcon_sensor incorrectly configured. Skipping install')
      return
    end

    if Gem::Version.new(minimum_supported_version) > Gem::Version.new(falcon_pkg_prefs['version'])
      Chef::Log.warn("cpe_crowdstrike_falcon_sensor only installs crowdstrike v#{minimum_supported_version} and "\
        'higher. Please use a prior version of this cookbook if you need earlier support.')
      return
    end

    
    cid = falcon_agent_prefs['customer_id']
    reg_token = falcon_agent_prefs['registration_token']
    receipt = falcon_pkg_prefs['mac_os_x_pkg_receipt']

    debian_install(cid, reg_token) if debian?
    macos_install(receipt, reg_token) if macos?
    windows_install(reg_token) if windows?
  end