云计算yaml分析错误

云计算yaml分析错误,yaml,cloud-foundry,Yaml,Cloud Foundry,当我尝试为memcached service broker推送yaml文件时,cf推送出现错误: #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/cl

当我尝试为memcached service broker推送yaml文件时,cf推送出现错误:

#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文件有问题。但我不知道是什么。以下是我所拥有的:

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文件没有正确解析的帮助吗?

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

在下一行中,您应该再次拥有一个键标量,并且它必须在与前一行相同的级别缩进(或者使用流结束(
)完成顶级映射,或者启动一个新文档(
--
)。您启动一个缩进值,该值是一个映射,而解析器不知道您要对其执行什么操作

您只能尝试猜测您尝试执行的操作。如果
cloudeast.mycompany.com
是域的名称,您应该将其设置为一个新的缩进标量值(使用键
name
),则键
机器
会出现相同的缩进错误。然后,以下3个键表示文件正常:

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文件的顶层将是一个带有单个键标量的映射:
。该键的值同样是一个带有键的映射,如
nats
网络
memcache\u broker

@Anthon已经解释了为什么要使用YAML无效。但更正后,这将不是有效的cf清单。您是打算将代理作为在cf本身上运行的应用程序运行,还是以某种方式运行(例如,BOSH部署),因为您文件中的一些数据看起来像是部署CF本身的BOSH清单中的数据,而不是运行在CF上的应用程序。@AmitKumarGupta感谢您对此进行了扩展。我不熟悉cloudfoundry,我查看了他们的文档页面,找到了与配置文件格式相关的任何内容,并在sear之后放弃了在CF上运行的应用程序可以使用命令行标志或通过称为“清单”的配置文件进行配置文件。看起来您是有意创建该文件的,以下是有关清单文件的更多详细信息:。但不清楚您要解决的更大问题。由于您对cloud foundry不太熟悉,是否确实需要从memcached部署service broker?