Fix ASO deployment using wmagent scripts.

I updated those 2 pull requests https://github.com/dmwm/WMCore/pull/4967 and https://github.com/dmwm/WMCore/pull/4965 into this one. Patch has been tested. Please could you review and merge?