summaryrefslogtreecommitdiff
path: root/heatclient/osc
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-02-21 07:54:54 +0000
committerGerrit Code Review <review@openstack.org>2020-02-21 07:54:54 +0000
commit6b071d397e9ba8ff81962f5709f3d14d6408dd2f (patch)
treeeec9367fa3da8d0add066965c7150f0c662a3567 /heatclient/osc
parent866e90374ec08727161a5e00b409804a7c2e945f (diff)
parentbd2bfaa514cfc6769b74bd0c213c58bcc1eef6ea (diff)
downloadpython-heatclient-6b071d397e9ba8ff81962f5709f3d14d6408dd2f.tar.gz
Merge "Add files-container option for stack create and update"
Diffstat (limited to 'heatclient/osc')
-rw-r--r--heatclient/osc/v1/stack.py32
-rw-r--r--heatclient/osc/v1/template.py16
2 files changed, 42 insertions, 6 deletions
diff --git a/heatclient/osc/v1/stack.py b/heatclient/osc/v1/stack.py
index 761b323..a25844b 100644
--- a/heatclient/osc/v1/stack.py
+++ b/heatclient/osc/v1/stack.py
@@ -48,6 +48,13 @@ class CreateStack(command.ShowOne):
help=_('Path to the environment. Can be specified multiple times')
)
parser.add_argument(
+ '-s', '--files-container',
+ metavar='<files-container>',
+ help=_('Swift files container name. Local files other than '
+ 'root template would be ignored. If other files are not '
+ 'found in swift, heat engine would raise an error.')
+ )
+ parser.add_argument(
'--timeout',
metavar='<timeout>',
type=int,
@@ -130,13 +137,15 @@ class CreateStack(command.ShowOne):
tpl_files, template = template_utils.process_template_path(
parsed_args.template,
- object_request=http.authenticated_fetcher(client))
+ object_request=http.authenticated_fetcher(client),
+ fetch_child=parsed_args.files_container is None)
env_files_list = []
env_files, env = (
template_utils.process_multiple_environments_and_files(
env_paths=parsed_args.environment,
- env_list_tracker=env_files_list))
+ env_list_tracker=env_files_list,
+ fetch_env_files=parsed_args.files_container is None))
parameters = heat_utils.format_all_parameters(
parsed_args.parameter,
@@ -160,6 +169,9 @@ class CreateStack(command.ShowOne):
if env_files_list:
fields['environment_files'] = env_files_list
+ if parsed_args.files_container:
+ fields['files_container'] = parsed_args.files_container
+
if parsed_args.tags:
fields['tags'] = parsed_args.tags
if parsed_args.timeout:
@@ -212,6 +224,13 @@ class UpdateStack(command.ShowOne):
help=_('Path to the template')
)
parser.add_argument(
+ '-s', '--files-container',
+ metavar='<files-container>',
+ help=_('Swift files container name. Local files other than '
+ 'root template would be ignored. If other files are not '
+ 'found in swift, heat engine would raise an error.')
+ )
+ parser.add_argument(
'-e', '--environment', metavar='<environment>',
action='append',
help=_('Path to the environment. Can be specified multiple times')
@@ -308,13 +327,15 @@ class UpdateStack(command.ShowOne):
tpl_files, template = template_utils.process_template_path(
parsed_args.template,
object_request=http.authenticated_fetcher(client),
- existing=parsed_args.existing)
+ existing=parsed_args.existing,
+ fetch_child=parsed_args.files_container is None)
env_files_list = []
env_files, env = (
template_utils.process_multiple_environments_and_files(
env_paths=parsed_args.environment,
- env_list_tracker=env_files_list))
+ env_list_tracker=env_files_list,
+ fetch_env_files=parsed_args.files_container is None))
parameters = heat_utils.format_all_parameters(
parsed_args.parameter,
@@ -338,6 +359,9 @@ class UpdateStack(command.ShowOne):
if env_files_list:
fields['environment_files'] = env_files_list
+ if parsed_args.files_container:
+ fields['files_container'] = parsed_args.files_container
+
if parsed_args.tags:
fields['tags'] = parsed_args.tags
if parsed_args.timeout:
diff --git a/heatclient/osc/v1/template.py b/heatclient/osc/v1/template.py
index c501812..f25263e 100644
--- a/heatclient/osc/v1/template.py
+++ b/heatclient/osc/v1/template.py
@@ -123,6 +123,13 @@ class Validate(format_utils.YamlFormat):
'specified multiple times')
)
parser.add_argument(
+ '-s', '--files-container',
+ metavar='<files-container>',
+ help=_('Swift files container name. Local files other than '
+ 'root template would be ignored. If other files are not '
+ 'found in swift, heat engine would raise an error.')
+ )
+ parser.add_argument(
'--ignore-errors',
metavar='<error1,error2,...>',
help=_('List of heat errors to ignore')
@@ -145,11 +152,13 @@ class Validate(format_utils.YamlFormat):
def _validate(heat_client, args):
tpl_files, template = template_utils.process_template_path(
args.template,
- object_request=http.authenticated_fetcher(heat_client))
+ object_request=http.authenticated_fetcher(heat_client),
+ fetch_child=args.files_container is None)
env_files_list = []
env_files, env = template_utils.process_multiple_environments_and_files(
- env_paths=args.environment, env_list_tracker=env_files_list)
+ env_paths=args.environment, env_list_tracker=env_files_list,
+ fetch_env_files=args.files_container is None)
fields = {
'template': template,
@@ -168,6 +177,9 @@ def _validate(heat_client, args):
if args.show_nested:
fields['show_nested'] = args.show_nested
+ if args.files_container:
+ fields['files_container'] = args.files_container
+
validation = heat_client.stacks.validate(**fields)
data = list(six.itervalues(validation))
columns = list(six.iterkeys(validation))