Heat stack creation with tags

Sahara should create heat stack with tags to
hide these stack from users.

Change-Id: I7656608ae4e8d24eca7eaf6e186ea3f5cbf1d02d
Closes-bug: 1495991
This commit is contained in:
Vitaly Gridnev 2015-09-16 15:25:40 +03:00
parent 57523a684f
commit 95a5fd14ef
4 changed files with 15 additions and 2 deletions

View File

@ -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,

View File

@ -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):

View File

@ -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))

View File

@ -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: