Deploy a bundle without manageRootDir or manageRootDir=true (which is the defualt). See that it works. Today, me and jay are seeing it broken.
We need to determine which versions this impacts
looks like our unit tests in this area didn't cover this scenario. We do have covered the scenario where, upon initial deployment, the manageRootDir=false: org.rhq.plugins.ant.AntBundlePluginComponentTest.testAntBundleNoManageRootDir() but not the inverse. I just added: org.rhq.plugins.ant.AntBundlePluginComponentTest.testAntBundleManageRootDir() and it does indeed fail. What does this mean? It means if you have a destination directory (call it /dir/foo) and it isn't empty (i.e. it already has files in it), upon initial bundle deployment, those files will not be removed - they will remain even after the full bundle has been completely deployed. It is possible that upon bundle upgrade, those files will be removed. I'll add some tests to confirm.
fyi: There are several other unit test classes covering the deployment stuff in core/util module.
The problem here is that when you do an INITIAL bundle deployment, and you asked that RHQ manage the destination directory, any files that happened to already exist in the deployment's destination directory were not touched. This should not have been. The dest dir should have started empty because we are being told that we should manage the full destination directory content - which means if there are files in here that are NOT part of the bundle should be removed. This happened correctly during a bundle UPDATE but not when we did the initial deployment for the first time. Now, when we do the initial deployment AND we are to manage the destination directory, we will backup whatever files we find in the metadata directory's backup location, then we remove the files to get them out of the way. This ensures we start with a clean, empty destination directory. The main change was done in org.rhq.core.util.updater.Deployer.performInitialDeployment
git commit to master: 9946f3e2b2b4b0a86ebe001594818f016a4c4130
forgot to fix a unit test... commited this to master: d8bd668
Bundles: https://tcms.engineering.redhat.com/run/33098/ ---COMPLETE
Verified on build#1409 (Version: 4.4.0-SNAPSHOT Build Number: 103c02) Deployed a bundle without manageRootDir and other with manageRootDir=true Verified that the initial deployment creates a backup for the existing files in the destination directory and the files are removed from destination directory. Below is the audit trail for initial deployment: DEPLOYMENT DETAILS: Added Files: 2 /store/bundle/deploydest bundle.properties Deleted Files: 2 test.html test1.txt Changed Files: 0 Backed Up Files: 2 test.html -> /store/test1/.rhqdeployments/10001/backup/test.html test1.txt -> /store/test1/.rhqdeployments/10001/backup/test1.txt Restored Files: 0 Ignored Files: 0 Realized Files: 2 /store/bundle/deploydest bundle.properties Was Cleaned?: false Errors: 0 Verified that the manageRootDir=true creates a backup during upgrade. Below is the deployment audit trail: DEPLOYMENT DETAILS: Added Files: 0 Deleted Files: 1 helloworld.war Changed Files: 1 /store/bundle/deploydest Backed Up Files: 1 helloworld.war -> /store/test1/.rhqdeployments/10011/backup/helloworld.war Restored Files: 0 Ignored Files: 0 Realized Files: 2 /store/bundle/deploydest bundle.properties Was Cleaned?: false Errors: 0