Cloud Foundry Yaml解析错误 [英] Cloud Foundry yaml parse error

查看:64
本文介绍了Cloud Foundry Yaml解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试为memcached服务代理推送yaml文件时,在cf push上出现错误:

I'm getting an error on cf push when I try to push a yaml file for a memcached service broker:

#cf push
FAILED
Error reading manifest file:
yaml: [] mapping values are not allowed in this context at line 2, column 7
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/cloudfoundry-incubator/candiedyaml/decode.go:95 (0x2c0d87)
/usr/local/go/src/pkg/runtime/panic.c:248 (0x16276)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/cloudfoundry-incubator/candiedyaml/decode.go:144 (0x2c1609)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/cloudfoundry-incubator/candiedyaml/decode.go:161 (0x2c17e5)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/cloudfoundry-incubator/candiedyaml/decode.go:471 (0x2c3cd4)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/cloudfoundry-incubator/candiedyaml/decode.go:196 (0x2c1c6e)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/cloudfoundry-incubator/candiedyaml/decode.go:394 (0x2c336d)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/cloudfoundry-incubator/candiedyaml/decode.go:193 (0x2c1d38)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/cloudfoundry-incubator/candiedyaml/decode.go:171 (0x2c199e)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/cloudfoundry-incubator/candiedyaml/decode.go:137 (0x2c146d)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/manifest/manifest_disk_repository.go:82 (0xb13ef)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/manifest/manifest_disk_repository.go:50 (0xb0f72)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/manifest/manifest_disk_repository.go:33 (0xb0e13)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/manifest/manifest.go:1 (0xb300e)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/commands/application/push.go:377 (0x23e2c3)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/commands/application/push.go:356 (0x23e062)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/commands/application/push.go:120 (0x23ada2)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/command_runner/runner.go:50 (0xa70a9)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/command_runner/runner.go:1 (0xa73d4)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/tmp/cli_gopath/src/github.com/cloudfoundry/cli/cf/app/app.go:76 (0x8ecce)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/codegangsta/cli/command.go:101 (0xcb140)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/Godeps/_workspace/src/github.com/codegangsta/cli/app.go:125 (0xc9654)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/main/main.go:154 (0x3729)
/Users/pivotal/go-agent/pipelines/Mac-OSX-Testing/src/github.com/cloudfoundry/cli/main/main.go:91 (0x2eb9)
/usr/local/go/src/pkg/runtime/proc.c:220 (0x1804f)
/usr/local/go/src/pkg/runtime/proc.c:1394 (0x1a580)

显然,我的Yaml文件存在someethign错误。但是我不知道这就是我拥有的东西:

So obviously someethign is wrong with my yaml file. But I don't know what. Here's what I have:

domain: cloudeast.mycompany.com
  nats:  secret
    machines:
      - 10.10.100.10
    password: secret
    port: 4222
    user: nats

  networks:
    apps: default
    management: default

  memcache_broker:
    broker_password: secret
    memcache:
      vip: 10.100.100.100:11211
      servers:
      - 10.100.100.101:11211
      - 10.100.100.102:11211
    plans:
      small:
        name: small
        description: A small cache with no redundency
        free: true

  memcache_hazelcast:
    heap_size: 512M
    host:
      src_api: https://memcache-hazelcast.cf-deployment.com
      password: secret
    memcache:
      secret_key: secret
    hazelcast:
      max_cache_size: 268435456
      machines:
        zone1:
        - 10.100.100.101
        zone2:
        - 10.100.100.102
    plans:
      small:
        backup: 0
        async_backup: 1
        eviction_policy: LRU
        max_idle_seconds: 86400
        max_size_used_heap: 100
      medium:
        backup: 0
        async_backup: 1
        eviction_policy: LRU
        max_idle_seconds: 86400
        max_size_used_heap: 200

为什么此yaml文件无法正确解析,我可以得到一些帮助吗?

Could I get some help with why this yaml file isn't parsing correctly?

推荐答案

在第一行中,您有一个标量( domain ),后跟一个冒号(),然后是标量(),这意味着在顶部(不缩进)开始映射,而 domain 是关键标量, cloudeast.mycompany.com 是值标量。

On the first line you have a scalar (domain) followed by a colon (:) followed by a scalar (cloudeast.mycompany.com), this means at the top, non indented, level you start a mapping and domain is a key scalar and cloudeast.mycompany.com a value scalar.

在下一行中,您应该再次具有关键标量,并且必须将其缩进到与上一行相同的级别上(或者您可以完成前一行,流结束( ... )进行级别映射或开始新文档( --- )。开始一个缩进的值,该值是一个映射,而解析器不知道您要使用该值。

On the next line you should, once more, have a key scalar and it has to be indented at the same level as the previous line (or you finish the top-level mapping with an end of stream (...) or start a new document (---). You start an indented value that is a mapping and the parser doesn't know what you want to do with that.

一个人只能尝试猜测您要做什么。如果 cloudeast.mycompany.com 是域的名称,则应使用新的缩进标量值(键为 name ),则对于机器键和随后的3个键,会出现相同的缩进错误,之后文件就可以了:

One can only try and guess what you try to do. If cloudeast.mycompany.com is the name of the domain, you should make that a new indented scalar value (with key name), then the same indentation error occurs for the key machines. and following 3 keys, after that the file is OK:

domain: 
  name: cloudeast.mycompany.com   # scalar key "name" added
  nats:  secret
  machines:                       # this scalar key and next 3  dedented
  - 10.10.100.10
  password: secret
  port: 4222
  user: nats

  # from here everything as it was
  networks:
    apps: default
    management: default

  memcache_broker:
    broker_password: secret
    memcache:
      vip: 10.100.100.100:11211
      servers:
      - 10.100.100.101:11211
      - 10.100.100.102:11211
    plans:
      small:
        name: small
        description: A small cache with no redundency
        free: true

  memcache_hazelcast:
    heap_size: 512M
    host:
      src_api: https://memcache-hazelcast.cf-deployment.com
      password: secret
    memcache:
      secret_key: secret
    hazelcast:
      max_cache_size: 268435456
      machines:
        zone1:
        - 10.100.100.101
        zone2:
        - 10.100.100.102
    plans:
      small:
        backup: 0
        async_backup: 1
        eviction_policy: LRU
        max_idle_seconds: 86400
        max_size_used_heap: 100
      medium:
        backup: 0
        async_backup: 1
        eviction_policy: LRU
        max_idle_seconds: 86400
        max_size_used_heap: 200

当然,您也忽略了cloudeaset.mycompany.com值。在这两种情况下,YAML文件的顶级都将是具有单个键标量的映射: domain 。该键的值再次是具有 nats networks memcache_broker

Of course you also leave out the cloudeaset.mycompany.com value. In both the cases the top level of the YAML file will be a mapping with a single key scalar: domain. The value for that key is again a mapping with keys like nats, networks, memcache_broker

这篇关于Cloud Foundry Yaml解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆