Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_props can't read dotted key #1764

Open
steled opened this issue Aug 25, 2023 · 1 comment
Open

load_props can't read dotted key #1764

steled opened this issue Aug 25, 2023 · 1 comment
Labels

Comments

@steled
Copy link

steled commented Aug 25, 2023

Describe the bug
I'm trying to use merge from properties to set a yaml value via load_props with a properties file.
Unfortunately the yaml key is dotted and it seems that this is not working currently.

Note that any how to questions should be posted in the discussion board and not raised as an issue.

Version of yq: 4.34.1
Operating system: Ubuntu 22.04.2 LTS
Installed via: binary release

Input Yaml

flatcar.yml:

apiVersion: cluster.k8s.io/v1alpha1
kind: MachineDeployment
metadata:
  annotations:
    k8c.io/operating-system-profile: test
  name: test
  namespace: kube-system

machines_flatcar.properties:

metadata.name = flatcar
metadata.annotations.k8c.io/operating-system-profile = flatcar

Command
The command you ran:

yq '. *= load_props("machines_flatcar.properties:")' flatcar.yml

Actual behavior

apiVersion: cluster.k8s.io/v1alpha1
kind: MachineDeployment
metadata:
  annotations:
    k8c.io/operating-system-profile: test
  k8c:
      io/operating-system-profile: flatcar
  name: flatcar
  namespace: kube-system

Expected behavior

apiVersion: cluster.k8s.io/v1alpha1
kind: MachineDeployment
metadata:
  annotations:
    k8c.io/operating-system-profile: flatcar
  name: flatcar
  namespace: kube-system
@michalszelagsonos
Copy link

I think there is a general issue with reading keys with dots in properties file. It works with yaml:

echo "foo.bar: 1" | yq -p y '."foo.bar"'
1

Fails with properties:

echo "foo.bar=1" | yq -p p '."foo.bar"'
null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants