#!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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. """ This is the administration program for heat. It is simply a command-line interface for adding, modifying, and retrieving information about the stacks belonging to a user. It is a convenience application that talks to the heat API server. """ import gettext import optparse import os import os.path import sys import time import json import logging from urlparse import urlparse # If ../heat/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python... possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)) jeos_path = '' cfntools_path = '' if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): sys.path.insert(0, possible_topdir) jeos_path = '%s/heat/%s/' % (possible_topdir, "jeos") cfntools_path = '%s/heat/%s/' % (possible_topdir, "cfntools") jeos_path = os.path.join(possible_topdir, 'jeos') cfntools_path = os.path.join(possible_topdir, 'cfntools') else: for p in sys.path: jeos_path = os.path.join(p, 'heat', 'jeos') cfntools_path = os.path.join(p, 'heat', 'cfntools') if os.access(jeos_path, os.R_OK): break gettext.install('heat', unicode=1) from heat import client as heat_client from heat import version from heat.common import config from heat.common import exception from heat import utils @utils.catch_error('validate') def template_validate(options, arguments): ''' Validate a template. This command parses a template and verifies that it is in the correct format. Usage: heat validate \\ [--template-file=