Skip to content

Commit 2fbbc93

Browse files
arblltbavelierfanny-jiang
authored
remove pycache directory during upgrades (#871)
* remove pycache directory during upgrades This PR removes /opt/datadog-agent/python-scripts/__pycache__ similarly to other installation methods. * Remove un-necessary recurse and lint --------- Co-authored-by: Timothée Bavelier <[email protected]> Co-authored-by: Fanny Jiang <[email protected]>
1 parent cfaf56d commit 2fbbc93

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

manifests/init.pp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,14 @@
441441

442442
# Install agent
443443
if $manage_install {
444+
# Ensure legacy Python bytecode cache directory is removed before Agent package installation (Linux only)
445+
if ($facts['os']['name'] != 'Windows' and $facts['os']['family'] != 'Darwin') {
446+
file { '/opt/datadog-agent/python-scripts/__pycache__':
447+
ensure => absent,
448+
force => true,
449+
before => Package[$agent_flavor],
450+
}
451+
}
444452
case $facts['os']['name'] {
445453
'Ubuntu','Debian','Raspbian' : {
446454
if $use_apt_backup_keyserver != undef or $apt_backup_keyserver != undef or $apt_keyserver != undef {

0 commit comments

Comments
 (0)