# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # """Orchestration v1 Stack action implementations""" import logging import sys from osc_lib.command import command from osc_lib import exceptions as exc from osc_lib import utils from oslo_serialization import jsonutils import six from six.moves.urllib import request import yaml from heatclient._i18n import _ from heatclient.common import event_utils from heatclient.common import format_utils from heatclient.common import hook_utils from heatclient.common import http from heatclient.common import template_utils from heatclient.common import utils as heat_utils from heatclient import exc as heat_exc class CreateStack(command.ShowOne): """Create a stack.""" log = logging.getLogger(__name__ + '.CreateStack') def get_parser(self, prog_name): parser = super(CreateStack, self).get_parser(prog_name) parser.add_argument( '-e', '--environment', metavar='', action='append', help=_('Path to the environment. Can be specified multiple times') ) parser.add_argument( '--timeout', metavar='', type=int, help=_('Stack creating timeout in minutes') ) parser.add_argument( '--pre-create', metavar='', default=None, action='append', help=_('Name of a resource to set a pre-create hook to. Resources ' 'in nested stacks can be set using slash as a separator: ' '``nested_stack/another/my_resource``. You can use ' 'wildcards to match multiple stacks or resources: ' '``nested_stack/an*/*_resource``. This can be specified ' 'multiple times') ) parser.add_argument( '--enable-rollback', action='store_true', help=_('Enable rollback on create/update failure') ) parser.add_argument( '--parameter', metavar='', action='append', help=_('Parameter values used to create the stack. This can be ' 'specified multiple times') ) parser.add_argument( '--parameter-file', metavar='', action='append', help=_('Parameter values from file used to create the stack. ' 'This can be specified multiple times. Parameter values ' 'would be the content of the file') ) parser.add_argument( '--wait', action='store_true', help=_('Wait until stack goes to CREATE_COMPLETE or CREATE_FAILED') ) parser.add_argument( '--tags', metavar='', help=_('A list of tags to associate with the stack') ) parser.add_argument( '--dry-run', action='store_true', help=_('Do not actually perform the stack create, but show what ' 'would be created') ) parser.add_argument( 'name', metavar='', help=_('Name of the stack to create') ) parser.add_argument( '-t', '--template', metavar='