Skip to content

Commit dc93ff9

Browse files
arblllevan-m
andauthored
remove pycache directory during upgrades (#959)
* remove pycache directory during upgrades This PR removes /opt/datadog-agent/python-scripts/__pycache__ similarly to other installation methods. * empty commit for testing --------- Co-authored-by: Levan Machablishvili <levan.machablishvili@datadoghq.com> Co-authored-by: levan-m <116471169+levan-m@users.noreply.github.com>
1 parent 2926b72 commit dc93ff9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

recipes/_install-linux.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
package_retries = node['datadog']['agent_package_retries']
2929
package_retry_delay = node['datadog']['agent_package_retry_delay']
3030

31+
# Remove Python bytecode cache dir prior to installing/upgrading Agent (Linux only)
32+
directory '/opt/datadog-agent/python-scripts/__pycache__' do
33+
action :delete
34+
recursive true
35+
ignore_failure true
36+
only_if do
37+
platform_family?('debian', 'rhel', 'fedora', 'amazon', 'suse') &&
38+
![:remove, :purge].include?((package_action.is_a?(Symbol) ? package_action : package_action.to_sym))
39+
end
40+
end
41+
3142
# Install the regular package
3243
case node['platform_family']
3344
when 'debian'

0 commit comments

Comments
 (0)