DBPASS_DOMAIN variable is not passing to prepost installation script

As noted on http://virtualmin.com/node/33498 I have replaced

#!/bin/sh
if [ "$VIRTUALSERVER_ACTION" = "DBPASS_DOMAIN" ]; then
  some action here
fi

with

if [ "$VIRTUALSERVER_ACTION" = "MODIFY_DOMAIN" ]; then
  some action here
fi

to make it work. However, it is not very convenient when the intent was to do only some password-related actions and the script is, unfortunately, triggered on EVERY single edit of the virtual server.

The http://www.virtualmin.com/documentation/developer/prepost page states:

The action being performed can be determined by looking at the $VIRTUALSERVER_ACTION environment variable, which will be set to one of :

CREATE_DOMAIN A new virtual server is being created MODIFY_DOMAIN Some attribute of a virtual server is being changed DELETE_DOMAIN A virtual server has been deleted DISABLE_DOMAIN The virtual server is being temporarily disabled ENABLE_DOMAIN The virtual server is being re-enabled DBNAME_DOMAIN The database login for a virtual server is being changed DBPASS_DOMAIN The database password for a virtual server is being changed RESTORE_DOMAIN A virtual server is being restored from a backup

So please see why DBPASS_DOMAIN is not passed as VIRTUALSERVER_ACTION to the post installation script or, if it was note meant to, then correct the wording of the above mention page.

Thanks!

Status: 
Closed (fixed)

Comments

The DBPASS_DOMAIN mode is only used when just the domain's DB password is changed. It is possible for other modifications to also update the password, depending on whether you keep it in sync with the admin login or not.

To detect this, your script could compare $VIRTUALSERVER_OLDSERVER_PASS with $VIRTUALSERVER_PASS - if they differ, the password has been changed.

Thanks for explanation, I see the difference now.