New domain creation failure lacks grace

When creating a domain fails before the final step, it leaves behind residue which needs to be cleaned up in order to actually create the domain again. Some cases seem to be gracefully handled, while others are not.

Specifically, I noted this on a box that had incorrect Webalizer configuration settings (though they were the default settings and webalizer was installed and detected by Virtualmin during configuration check). It failed with the following errors, amidst all of the other successful bits:

Setting up scheduled Webalizer reporting ..
.. Webalizer reporting failed! : Missing file to open at main::../ line 1476 at ../ line 732.

Setting up log file rotation ..
.. Log file rotation failed! : Missing file to open at main::../ line 1476 at ../ line 732.

And the final "big" error is:

Failed to create virtual server : Missing file to open at postfix::../ line 1476

Interestingly, it also failed on the following log file rotation bit with the same error. Once Webalizer configuration is fixed, this goes away.

Maybe just detecting and gracefully failing (with an error) on this particular webalizer setup bit will be sufficient. Or maybe a more transactional approach is required, where failures can roll-back.

I think it will be sufficient if it just skips the bit that is broken, and explains as plainly as we can what is broken and what needs to be done to fix it--wrapping all of this in a transaction style interface is probably too complex to be reliable. Hopefully, our customers will never run into this, as our setup tools will configure things correctly from the first installation...but if they modify things, or install software from an odd source (or from source) and screw up their configuration, we don't want them getting stuck with users, DNS records and VirtualHost entries (and whatever else happens) that they don't know how to get rid of or recover from enough to regenerate the domain.

Closed (fixed)