summaryrefslogtreecommitdiffstats
path: root/tosca2heat/tosca-parser/toscaparser/shell.py
diff options
context:
space:
mode:
authorshangxdy <shang.xiaodong@zte.com.cn>2017-08-29 12:45:34 +0800
committershangxdy <shang.xiaodong@zte.com.cn>2017-08-29 12:45:34 +0800
commit7407c6c4cb09a80ec35a48716d4436ff98aba23f (patch)
treef2adc6dc812952123493b9b734196828ed83cf1f /tosca2heat/tosca-parser/toscaparser/shell.py
parentd66af1c9113ec897049a55b80ca70496651502b7 (diff)
Add parameter validation in design time
Add validation for SDC from ONAP when use parse in design time: ignore parameter validation and only print warning message. JIRA: PARSER-142 Change-Id: I9372f20816f2acbda83c5f1e4f673f2ffc3c2e94 Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/shell.py')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/shell.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/shell.py b/tosca2heat/tosca-parser/toscaparser/shell.py
index 1d98f1a..0256dfc 100644
--- a/tosca2heat/tosca-parser/toscaparser/shell.py
+++ b/tosca2heat/tosca-parser/toscaparser/shell.py
@@ -49,23 +49,30 @@ class ParserShell(object):
required=True,
help=_('YAML template or CSAR file to parse.'))
+ parser.add_argument('-nrpv', dest='no_required_paras_valid',
+ action='store_true', default=False,
+ help=_('Ignore input parameter validation '
+ 'when parse template.'))
+
return parser
def main(self, argv):
parser = self.get_parser(argv)
(args, extra_args) = parser.parse_known_args(argv)
path = args.template_file
+ nrpv = args.no_required_paras_valid
if os.path.isfile(path):
- self.parse(path)
+ self.parse(path, no_required_paras_valid=nrpv)
elif toscaparser.utils.urlutils.UrlUtils.validate_url(path):
- self.parse(path, False)
+ self.parse(path, False, no_required_paras_valid=nrpv)
else:
raise ValueError(_('"%(path)s" is not a valid file.')
% {'path': path})
- def parse(self, path, a_file=True):
+ def parse(self, path, a_file=True, no_required_paras_valid=False):
output = None
- tosca = ToscaTemplate(path, None, a_file)
+ tosca = ToscaTemplate(path, None, a_file,
+ no_required_paras_valid=no_required_paras_valid)
version = tosca.version
if tosca.version: