Google Deploy Manager(无效的配置文件:模板提取失败/找不到资源) [英] Google Deploy Manager (Invalid config files: Template fetching failed / Failed to find resource)
问题描述
使用Google Deploy Manager时:
When using Google Deploy Manager:
gcloud deployment-manager deployments create my-environment --config my-environment.jinja
我收到以下错误:
ErrorsValueListEntry INVALID_CONFIG
ErrorsValueListEntry INVALID_CONFIG
无效的配置文件:模板获取失败:找不到资源
Invalid config files: Template fetching failed: Failed to find resource
不管我的my-environment.jinja
内容如何-即使复制找到的示例文档中
Regardless of the content of my my-environment.jinja
- even when copying the samples found in the documentation
不确定我在做什么错吗?
Not sure what I'm doing wrong here?
推荐答案
Deployment Manager命令行工具对待模板(由.jinja
和.py
文件扩展名确定)的模板与顶级配置(可以具有其他任何文件扩展名)作为--config
标志的输入.
The Deployment Manager command-line tool treats templates (determined by .jinja
and .py
file extensions) differently than a top-level config (which can have any other file extension) as inputs to the --config
flag.
如果输入配置是模板,则该工具将寻找要在模板的模式文件(例如,foo.jinja.schema
)中定义的子导入,而不是像在顶层YAML中那样在配置本身中定义配置.
If the input configuration is a template, the tool will look for its sub-imports to be defined in the template's schema file (e.g., foo.jinja.schema
), rather than in the configuration itself as is done with top-level YAML configs.
我的猜测是上面的错误代码段不完整,完整的错误包含有关无法找到哪个模板的详细信息.可能是该子模板未正确导入.
My guess is the error snippet above is incomplete, and the full error contains details about which template it is failing to find. Likely that is a sub-template that wasn't properly imported.
YAML顶级配置my-environment.yaml
可能如下所示:
A top-level YAML configuration, my-environment.yaml
, may look like:
imports
- path: sub-template.jinja
resources:
- name: sub-template
type: sub-template.jinja
这是通过以下命令部署的:
This is deployed with the command:
gcloud deployment-manager deployments create env --config my-environment.yaml
模板
模板my-environment.jinja
将定义为:
resources:
- name: sub-template
type: sub-template.jinja
具有单独的文件my-environment.jinja.schema
,用于定义属性架构和导入:
with a separate file, my-environment.jinja.schema
, defining property schema and imports:
imports:
- path: sub-template.jinja
这可以使用以下命令进行部署:
This can be deployed with the command:
gcloud deployment-manager deployments create env --config my-environment.jinja
,甚至可以使用--properties
从命令行获取属性.
and can even take properties from the command-line with --properties
.
有关更多信息,请参见Deployment Manager文档中的使用架构.模式.
See Using Schemas in the Deployment Manager documentation for more info on schemas.
这篇关于Google Deploy Manager(无效的配置文件:模板提取失败/找不到资源)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!