diff --git a/sahara/config.py b/sahara/config.py index 336374be00..f34a7a10dd 100644 --- a/sahara/config.py +++ b/sahara/config.py @@ -129,6 +129,7 @@ def list_opts(): from sahara.conductor import api from sahara import main as sahara_main from sahara.service.edp import job_utils + from sahara.service.heat import heat_engine from sahara.service import periodic from sahara.utils import cluster_progress_ops as cpo from sahara.utils.openstack import base @@ -157,7 +158,8 @@ def list_opts(): proxy.opts, cpo.event_log_opts, wsgi.wsgi_opts, - base.opts)), + base.opts, + heat_engine.heat_engine_opts)), (poll_utils.timeouts.name, itertools.chain(poll_utils.timeouts_opts)), (api.conductor_group.name, diff --git a/sahara/service/heat/heat_engine.py b/sahara/service/heat/heat_engine.py index a6214b18ad..444e7c4320 100644 --- a/sahara/service/heat/heat_engine.py +++ b/sahara/service/heat/heat_engine.py @@ -42,6 +42,13 @@ ROLLBACK_STAGES = [c_u.CLUSTER_STATUS_ROLLBACK_SPAWNING, c_u.CLUSTER_STATUS_ROLLBACK_WAITING, c_u.CLUSTER_STATUS_ROLLBACK__PREPARING] +heat_engine_opts = [ + cfg.ListOpt('heat_stack_tags', default=['data-processing-cluster'], + help="List of tags to be used during operating with stack.") +] + +CONF.register_opts(heat_engine_opts) + class HeatEngine(e.Engine): def get_type_and_version(self): diff --git a/sahara/service/heat/templates.py b/sahara/service/heat/templates.py index 2d581ebb68..e1442e3e99 100644 --- a/sahara/service/heat/templates.py +++ b/sahara/service/heat/templates.py @@ -126,6 +126,9 @@ class ClusterStack(object): 'template': main_tmpl, 'files': self.files} + if CONF.heat_stack_tags: + kwargs['tags'] = ",".join(CONF.heat_stack_tags) + if not update_existing: LOG.debug("Creating Heat stack with args: {args}" .format(args=kwargs)) diff --git a/sahara/utils/openstack/heat.py b/sahara/utils/openstack/heat.py index eed05fe596..09f2511ea7 100644 --- a/sahara/utils/openstack/heat.py +++ b/sahara/utils/openstack/heat.py @@ -55,7 +55,8 @@ def client(): def get_stack(stack_name, raise_on_missing=True): for stack in base.execute_with_retries( - client().stacks.list, filters={'name': stack_name}): + client().stacks.list, show_hidden=True, + filters={'name': stack_name}): return stack if not raise_on_missing: