def main(project, env, action, verbose, format, template_path):
if verbose >= 2:
level = 5
elif verbose == 1:
level = logging.DEBUG
else:
logging.getLogger('googleapiclient').setLevel(logging.ERROR)
logging.getLogger('oauth2client').setLevel(logging.ERROR)
level = logging.INFO
logging.addLevelName(5, "TRACE")
logging.basicConfig(format='%(asctime)s %(levelname)s:%(name)s:%(message)s',
datefmt='%Y-%m-%d %H:%M:%S', level=level)
logger.debug('Debug log enabled')
logger.info("Log level: {}".format(level))
if action in ['apply', 'template']:
if template_path is None:
logging.error('A path to a template file is required for {}'.format(action))
sys.exit(1)
template_class = load_template_module(template_path)
template = template_class(project, env)
if format == "json":
template.formatter = template.asJSON
if action == 'apply':
template.__repr__()
apply_deployment(project, template)
elif action == 'template':
t = template.__repr__()
logger.info('Template successfully rendered, printing to stdout...')
print(t)
sys.exit(0)
评论列表
文章目录