I'm using Cloudify 2.7 with OpenStack Icehouse.
I would like to exit from the deploy process of a service if a condition happens in the -service.groovy
file.
Can someone suggest to me how should I do it?
It is not entirely clear what you are trying to accomplish.
If you just want the instance to stop processing further lifecycle events, have you script exit with a non-zero exit code and use the 'disableSelfHealing' flag when you install the service (http://getcloudify.org/guide/2.7/deploying/deploying_srvs.html)
If you want to actually uninstall the service, you need to use the REST API (or the provided rest-client package - https://github.com/CloudifySource/cloudify/tree/master/rest-client) to uninstall the service.