When running the command: "webapp-config -C <webapp> <webapp version> -d <webapp directory>" webapp-config shows no discrimination when uninstalling the webapp and the version. I tested this on multiple webapps using these commands: "webapp-config -C drupal 7.21 -d drupal" (I had 7.20 installed) result: It doesn't check for the version number of drupal and just uninstalls whatever is in that directory. "webapp-config -C drupal 7.20 -d phpBB" result: webapp-config will not check what webapp is installed in that directory and will remove whatever is in there, even if the webapp and version don't match up with the actual webapp installed in that directory.
(In reply to comment #0) > When running the command: > > "webapp-config -C <webapp> <webapp version> -d <webapp directory>" > > webapp-config shows no discrimination when uninstalling the webapp and the > version. > > I tested this on multiple webapps using these commands: > > "webapp-config -C drupal 7.21 -d drupal" (I had 7.20 installed) > > result: > > It doesn't check for the version number of drupal and just uninstalls > whatever is in that directory. > > "webapp-config -C drupal 7.20 -d phpBB" > > result: > > webapp-config will not check what webapp is installed in that directory and > will remove whatever is in there, even if the webapp and version don't match > up with the actual webapp installed in that directory. Devan, did you look through the code and verify it at that level. It seems to me that by just adding another check compairing the command line version and the version stated in the .webapp file you can easily catch this and throw an error message saying "drupal 7.21 is not installed at $vhost_root, do you really want to proceed?" where $vhost_root is defined in /etc/vhost/webapp-config.
(In reply to comment #1) > Devan, did you look through the code and verify it at that level. It seems > to me that by just adding another check compairing the command line version > and the version stated in the .webapp file you can easily catch this and > throw an error message saying "drupal 7.21 is not installed at $vhost_root, > do you really want to proceed?" where $vhost_root is defined in > /etc/vhost/webapp-config. I haven't looked through any code yet, I did plan on it but I figured it'd be best to submit a bug lest I forget about doing it later :)
(In reply to Devan Franchini from comment #2) > (In reply to comment #1) > > Devan, did you look through the code and verify it at that level. It seems > > to me that by just adding another check compairing the command line version > > and the version stated in the .webapp file you can easily catch this and > > throw an error message saying "drupal 7.21 is not installed at $vhost_root, > > do you really want to proceed?" where $vhost_root is defined in > > /etc/vhost/webapp-config. > > I haven't looked through any code yet, I did plan on it but I figured it'd > be best to submit a bug lest I forget about doing it later :) Okay, I've looked through the code and I can see what it's doing. In config.py when you try and clean webapp from a directory it doesn't check to see if the package you're trying to uninstall is the package in the directory. However, it does check to see if the package and the version you're trying to list are installed on your system. So if you installed a drupal 7.22 webapp under the directory "drupal" and tried to do this: webapp-config -C foobar 7.20 -d drupal it would tell you it's unable to determine the master copy. HOWEVER, if you have another webapp installed on your system, for instance phpBB 3.0.11 and tried to execute the command: webapp-config -C phpBB 3.0.11 -d drupal it would uninstall the webapp in the drupal directory. It's verified in practice and I've checked the code for logic checks to see if the package and version being listed are the same as the one in the .webapp and I didn't find anything. I will try and hack something up to do it.
Created attachment 351506 [details, diff] Adds check for package name and version prior to uninstalling a webapp This patch adds a check to config.py when the -C flag is called by the user. It will check the package name and version being called by the user against the package name and version in the .webapp file located in the directory declared by the user. If the package name and version declared by the user, and the package name and version in the .webapp file don't match then the program will abort and it won't uninstall the webapp.
Created attachment 351606 [details, diff] Adds check for package name and version prior to uninstalling a webapp Commit message cleanup.
(In reply to Devan Franchini from comment #5) > Created attachment 351606 [details, diff] [details, diff] > Adds check for package name and version prior to uninstalling a webapp > > Commit message cleanup. committed http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=81058b615b023de50244c200d420cbbf3f7a49d4
(In reply to Anthony Basile from comment #6) > (In reply to Devan Franchini from comment #5) > > Created attachment 351606 [details, diff] [details, diff] [details, diff] > > Adds check for package name and version prior to uninstalling a webapp > > > > Commit message cleanup. > > committed > > http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit; > h=81058b615b023de50244c200d420cbbf3f7a49d4 please test webapp-config-1.51 which includes this commit