缺少 Juju 动作要求。为什么?

缺少 Juju 动作要求。为什么?

我在将所需参数传递给 Juju Action 时遇到了很多麻烦。这是我的actions.yaml 的内容:

create-root-cert:
  description: "Generate a Root CA Certificate"
  params:
    subject:
      type: object
      description: "Relative Distinguished Names (RDNs)"
      properties:
        cn:
          type: string
          description: "Common Name"
  required: [subject.cn]

但是当我运行时:

juju action do strongswan/0 create-root-cert subject.cn="beenswerving.com"

我收到以下错误:

ERROR validation failed: (root) : "subject.cn" property is missing and required, given {"subject":{"cn":"beenswerving.com"}}

我在跑:

jammin@ADARA:$ juju version
1.24-alpha1-trusty-amd64

答案1

“required” 键与“properties”键是同级键。当您的架构包含一个对象时,它会获得自己的属性和必需键(以及其他键)。您可以像这样更新您的actions.yaml,它应该可以工作:

create-root-cert:
  description: "Generate a Root CA Certificate"
  params:
    subject:
      type: object
      description: "Relative Distinguished Names (RDNs)"
      properties:
        cn:
          type: string
          description: "Common Name"
      required: [cn]

注意“required”是缩进的,并且必填字段名称是本地的,而不是在“subject”范围内

相关内容