in chef/cookbooks/cpe_anyconnect/resources/cpe_anyconnect.rb [49:114]
def macos_install
create_anyconnect_cache
sync_anyconnect_cache
download_package(pkg)
cc_xml_path = ::File.join(anyconnect_root_cache_path, 'pkg', 'ChoiceChanges.xml')
allow_downgrade = pkg['allow_downgrade']
if allow_downgrade
if node.os_at_least?('12.0') && node.sext_profile_removal_contains_extension?(
'com.cisco.anyconnect.macos.acsockext', 'DE8Y96K9QP', node['cpe_anyconnect']['profile_identifier']
)
execute '/opt/cisco/anyconnect/bin/anyconnect_uninstall.sh' do
not_if { node.macos_package_installed?(pkg['receipt'], pkg['version']) }
not_if { anyconnect_vpn_connected? }
only_if { ::File.exist?('/opt/cisco/anyconnect/bin/anyconnect_uninstall.sh') }
end
execute '/opt/cisco/anyconnect/bin/dart_uninstall.sh' do
not_if { node.macos_package_installed?(pkg['dart_receipt'], pkg['version']) }
not_if { anyconnect_vpn_connected? }
only_if { ::File.exist?('/opt/cisco/anyconnect/bin/dart_uninstall.sh') }
end
else
Chef::Log.warn('cpe_anyconnect - AnyConnect package has logic to fail if attempting to downgrade - you must '\
'manually uninstall the application first if you are not passing a system extension profile!')
Chef::Log.warn('cpe_anyconnect - forcing downgrade to false')
allow_downgrade = false
end
end
execute "/usr/sbin/installer -applyChoiceChangesXML #{cc_xml_path} -pkg #{pkg_path(pkg)} -target /" do
if allow_downgrade
not_if { node.macos_package_installed?(pkg['receipt'], pkg['version']) }
else
not_if { node.macos_min_package_installed?(pkg['receipt'], pkg['version']) }
end
not_if { anyconnect_vpn_connected? }
notifies :create, 'file[trigger_gui]', :immediately
end
gui_la_label = node['cpe_anyconnect']['la_gui_identifier']
file 'trigger_gui' do
action :nothing
only_if { ::File.exist?("/Library/LaunchAgents/#{gui_la_label}.plist") }
path '/opt/cisco/anyconnect/gui_keepalive'
notifies :restart, "launchd[#{gui_la_label}]", :immediately
end
launchd gui_la_label do
type 'agent'
action :nothing
end
if node['cpe_anyconnect']['umbrella_diagnostic_link']
umbrella_diagnostic_link
end
end