butane icon indicating copy to clipboard operation
butane copied to clipboard

Anchor merge key is reported as "Unused key <<"

Open richardkraus-adesso opened this issue 1 year ago • 1 comments

Using Anchors in Butane works fine, but when using a merge key a warning at $.passwd.users.1.<<, line 11 col 7: Unused key << is shown when compiling the following config (this also happens for other variants):

podman run --rm -i quay.io/coreos/butane:latest > /dev/null << EOF
variant: flatcar
version: 1.1.0
passwd:
  users:
    - &nologin-user
      name: test1
      uid: 1000
      shell: /usr/bin/nologin
      no_create_home: true
      no_log_init: true
    - << : *nologin-user
      name: test2
      uid: 1001
EOF

This does not break any functionality (at least that Im aware of), but I just find it a little annoying..

richardkraus-adesso avatar Jan 25 '24 08:01 richardkraus-adesso

It would also be nice to be able to use an x-foo prefix like Docker Compose allows. The output already works fine, but the warning is indeed annoying. I've silenced lines matching regex Unused key (x-|<<) in my wrapper script in the meantime.

x-user: &user
  user:
    name: 'core'
  group:
    name: 'core'

variant: 'fcos'
version: '1.6.0'
storage:
  directories:
    - path: '/home/core/.config'
      <<: &user
    - path: '/home/core/.config/containers'
      <<: &user
    - path: '/home/core/.config/containers/systemd'
      <<: &user

kj avatar May 17 '25 12:05 kj