def create_cluster(values): cluster = s.create_cluster(values) plugin = plugin_base.PLUGINS.get_plugin(cluster.plugin_name) # validating cluster try: context.model_update(cluster, status="Validating") plugin.validate(cluster) except Exception as ex: with excutils.save_and_reraise_exception(): context.model_update(cluster, status="Error", status_description=str(ex)) context.spawn(_provision_cluster, cluster.id) return cluster