geofffranks / spruce

A BOSH template merge tool
MIT License
431 stars 78 forks source link

Spruce CLI fails on go-patch #283

Closed andrew-edgar closed 5 years ago

andrew-edgar commented 5 years ago

Using the latest Spruce CLI the following fails.

--- base.yml
instance_groups:
- name : api
  azs:
  - z1
  - z2
  instances: 2
  vm_type: small

--- ops.yml
- type: replace
  path: /instance_groups/name=api:before
  value:
    azs:
    - z1
    - z2
    instances: 2
    name: bits

When I run the spruce CLI i get this ...

➜ temp spruce merge --go-patch base.yml ops.yml ops.yml: Expected to find exactly one matching array item for path '/instance_groups/name=api:before' but found 0

When I use aviator (https://github.com/JulzDiverse/aviator) (which includes the spruce 1.16.2 library) and the correct aviator file as defined here ...

spruce:
- base: base.yml
  go_patch: true
  merge:
  - with:
      files:
      - ops.yml
  to: final.yml

I get the correct "final.yml"

instance_groups:
- azs:
  - z1
  - z2
  instances: 2
  name: bits
- azs:
  - z1
  - z2
  instances: 2
  name: api
  vm_type: small

Also when using bosh int I get the correct value with the following command line ...

bosh int base.yml -o ops.yml

This also failed in the spruce playground. looks like the ":before" syntax is NOT supported in the CLI

andrew-edgar commented 5 years ago

Looking into this further. I think you need to bump the go-patch vendored package you are using.