tosca-parser/toscaparser/utils/gettextutils.py
shangxdy 9baadf93b5 Add input validation in substitution_mapping class
Add input validation in class of substitution_mapping according to
specification of
http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/
TOSCA-Simple-Profile-YAML-v1.0.html:
1) The properties of substituted node template which be mapped must be
in the inputs of nested service template which defines substutition
mappings;
2) The inputs of nested service template which are not in properties of
the substituted node template must have default values.
3) If the properties of node_type is required and no default value,
 must provide inputs for them;
4) Property names and the input names must be the same.

This patch is related to bp:https://review.openstack.org/#/c/345492/

Change-Id: Ib928434ec67661e689ac80cca1749b53d17e4ba8
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
2016-12-06 01:12:05 +08:00

24 lines
841 B
Python

# 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.
import gettext
import os
_localedir = os.environ.get('tosca-parser'.upper() + '_LOCALEDIR')
_t = gettext.translation('tosca-parser', localedir=_localedir,
fallback=True)
def _(msg):
# type: (object) -> object
return _t.gettext(msg)