Virtualmin enable-feature bug

reproduce :

virtualmin disable-feature --all-domains --dns --web --webalizer --logrotate --virtualmin-awstats

Then :

virtualmin enable-feature --all-domains --dns --web --webalizer --logrotate --virtualmin-awstats --skip-warnings

For the parked domains , i receive this error : AWstats reporting cannot be enabled for a server without a home directory or AWstats reporting is already enabled for this domain

This error is OK , but the error cause other features (--dns , --web , --logrotate ) not get enabled till I run this command : virtualmin enable-feature --all-domains --dns --web --webalizer --logrotate --skip-warnings

Status: 
Closed (works as designed)

Comments

That is expected .. you can't enable AWstats for a parked (alias) domain, as it doesn't have a home directory or separate website logs. A better API command to do what you want would be :

for dom in \`virtualmin list-domains --name-only --with-feature dir\`; do
  virtualmin enable-feature --domain $dom --virtualmin-awstats
done
Mostafa's picture
Submitted by Mostafa on Sun, 09/11/2011 - 13:00

Yes, I know this is OK, but I mean the other features I tried to enable them (--dns --web --webalizer --logrotate) wouldn't get enabled because of this error. In fact, this error or warning message stop enabling other features requested in the command.

That's also expected .. if any of the features failed, none of them will be enabled.

A work-around is to do the enable in two separate steps, with commands like :

enable-feature --all-domains --dns --web --webalizer --logrotate
enable-feature --all-domains --virtualmin-awstats
Mostafa's picture
Submitted by Mostafa on Sun, 09/11/2011 - 14:36

OK !

This is a bit unnatural , in fact unnatural but force expected !

I suppose I could have made the enable-feature command work the other way and enable some features, but personally I don't like APIs that partially succeed - they should either totally work or totally fail.

Mostafa's picture
Submitted by Mostafa on Sun, 09/11/2011 - 14:46

OK, This sounds good.

As the final suggestion, this particular current awstats error can change to a warning , instead of a dying error.

For example :

Awstats is not available for alias domains, skipping ... and processing other features ...

Instead of :

AWstats reporting cannot be enabled for a server without a home directory

But for the virtual-servers or sub-servers It should be a dying error.

The next release of the AWstats plugin for Virtualmin will make it behave like this when enabling the feature for multiple domains..