backport of CLOUDIFY-1405 from 2.5.0