与实例 create 一起传递的元数据将覆盖到字符串"X-Frame-Options: SAMEORIGINlock GMT"



使用创建实例

gcloud compute instances create ...snip
... --metadata empty="",short="foo",long="thirty six character long string bla" ...

然后,在实例上,使用检索元数据

curl 
    "http://metadata.google.internal/computeMetadata/v1/instance/attributes/file-name" 
    -H "Metadata-Flavor: Google" -silent

我们最终使用

empty = X-Frame-Options: SAMEORIGINlock GMT
short = foorame-Options: SAMEORIGINlock GMT
long  = thirty six character long string bla

我不确定这是cURL、谷歌云的一个怪癖,还是当你通过http提供一个极短的字符串时会发生什么。

原来我传递了-silent而不是-silent作为curl的另一个arg,这会破坏输出。

相关内容

最新更新