windows_install

in chef/cookbooks/cpe_crowdstrike_falcon_sensor/resources/cpe_crowdstrike_falcon_sensor.rb [196:232]


  def windows_install(reg_token)
    
    version = node['cpe_crowdstrike_falcon_sensor']['pkg']['version']
    install_args = node['cpe_crowdstrike_falcon_sensor']['pkg']['args']
    file_name = "#{node['cpe_crowdstrike_falcon_sensor']['pkg']['app_name']}-#{version}.exe"
    exe_path = ::File.join(Chef::Config[:file_cache_path], file_name)
    install_string = "#{exe_path} /install /quiet /norestart CID=#{reg_token}"
    install_string += ' VDI=1' if install_args['vdi']
    install_string += ' NO_START=1' if install_args['no_start']
    
    install_string += ' ProvNoWait=1' if install_args['prov_no_wait']
    cpe_remote_file node['cpe_crowdstrike_falcon_sensor']['pkg']['app_name'] do
      backup 1
      file_name file_name
      checksum node['cpe_crowdstrike_falcon_sensor']['pkg']['checksum']
      path exe_path
      mode '0644'
    end
    
    execute 'Install Crowdstrike Falcon Windows' do
      command install_string
      only_if { ::File.exists?(exe_path) }
      
      
      not_if { check_falcon_agent_status_windows.include?('RUNNING') }
    end

    
    c_version = get_falcon_agent_version_windows
    if Gem::Version.new(version) > Gem::Version.new(c_version)
      execute 'Upgrade Crowdstrike Falcon Windows' do
        command install_string
        only_if { ::File.exists?(exe_path) }
      end
    end
  end