Closed wwkimball closed 3 years ago
I added -d to check detailed logs and noticed that at the end the tool is trying to process STDIN although I don't have - pseudofile specified Logs:
-- | -- 17-Jan-2021 17:40:44 | DEBUG: yaml_merge::merge_multidoc: Reporting status, 0. 17-Jan-2021 17:40:44 | Processing STDIN... 17-Jan-2021 17:40:44 | DEBUG: Merger::_resolve_anchor_conflicts: LHS Anchors: 17-Jan-2021 17:40:44 | DEBUG: Merger::_resolve_anchor_conflicts: RHS Anchors: 17-Jan-2021 17:40:44 | DEBUG: Processor::_get_optional_nodes: Finally returning data of type <class 'ruamel.yaml.comments.CommentedMap'>: 17-Jan-2021 17:40:44 | DEBUG: Processor::_get_optional_nodes: [replicaCount]3<class 'int'> 17-Jan-2021 17:40:44 | DEBUG: Processor::get_nodes: Relaying optional node: 17-Jan-2021 17:40:44 | DEBUG: Processor::get_nodes: (path) 17-Jan-2021 17:40:44 | DEBUG: Processor::get_nodes: (node)[replicaCount]3<class 'int'> 17-Jan-2021 17:40:44 | DEBUG: Processor::get_nodes: (parent)None 17-Jan-2021 17:40:44 | DEBUG: Processor::get_nodes: (parentref)None 17-Jan-2021 17:40:44 | Please try --help for more information. 17-Jan-2021 17:40:44 | DEBUG: yaml_merge::merge_multidoc: Reporting status, 6.
Please use the New Issue template to gather up all of the detail I need to replicate your issue. At present, I am unable to reproduce this. Here's what I see when I attempt the merge with your exact input files:
$ yaml-merge --version
yaml-merge 3.4.0
$ cat first.yaml
replicaCount: 2
$ cat second.yaml
replicaCount: 3
$ yaml-merge first.yaml second.yaml
---
replicaCount: 3
$ echo $?
0
Also, specifying the -
pseudofile is optional. When you open an input handle to yaml-merge, it will attempt to read from it unless explicitly instructed to ignore it. I'll assume you're running yaml-merge through some other program/context that has a STDIN handle open. In order to tell yaml-merge to ignore this (unintentional/unexpected) input, please use the --nostdin
(-S
) flag, per https://github.com/wwkimball/yamlpath/wiki/yaml-merge.
That was it. I was running it with docker.
Issue is resolved. Thank you.
Ah! This is also relevant when running in a GitHub Actions Ubuntu environment.
I think the error message in this case could be more helpful.
Ah! This is also relevant when running in a GitHub Actions Ubuntu environment.
I think the error message in this case could be more helpful.
@AndydeCleyre I can take a look at the error messaging. I've added a task card for this to the upcoming 3.6.0 release: https://github.com/wwkimball/yamlpath/projects/3#card-61666733
Starting with yamlpath version 3.6.0, whenever this error condition is raised while the STDIN handle is open, the error above is expanded to become the following text:
ERROR: Impossible to add Scalar value, , to a Hash without a key. Change the value to a 'key: value' pair, a '{key: value}' Hash, or change the merge target to an Array or other Scalar value. You may be seeing this because your workflow inadvertently opened a STDIN handle to yaml-merge. If this may be the case, try adding --nostdin or -S so as to block unintentional STDIN reading. This issue occurred at YAML Path: / Please try --help for more information.
When STDIN is closed, the message continues to be the shorter, original version.
I have published version 3.6.0 which includes this change, and many more.
Hey there. I can't get 2 simple yaml files merged with this error thrown: ERROR: Impossible to add Scalar value, , to a Hash without a key. Change the value to a 'key: value' pair, a '{key: value}' Hash, or change the merge target to an Array or other Scalar value. This issue occurred at YAML Path: / I'm using a command:
yaml-merge first.yaml second.yaml
first.yamlreplicaCount: 2
second.yamlreplicaCount: 3
Basically at this point I've tried to merge lot's of different yamls and always get the same error. I've installed yamlPath with:pip3 install yamlpath
Logs:17-Jan-2021 17:02:16 | Downloading yamlpath-3.4.0.tar.gz (183 kB) 17-Jan-2021 17:02:17 | Collecting ruamel.yaml>=0.15.96 17-Jan-2021 17:02:17 | Downloading ruamel.yaml-0.16.12-py2.py3-none-any.whl (111 kB) 17-Jan-2021 17:02:17 | Building wheels for collected packages: yamlpath 17-Jan-2021 17:02:17 | Building wheel for yamlpath (setup.py): started 17-Jan-2021 17:02:18 | Building wheel for yamlpath (setup.py): finished with status 'done' 17-Jan-2021 17:02:18 | Created wheel for yamlpath: filename=yamlpath-3.4.0-py3-none-any.whl size=191879 sha256=bddb9fa117410c4ce366a7f59e4499037e45285fda782271c7ebcffe65dad516 17-Jan-2021 17:02:18 | Stored in directory: /tmp/.cache/pip/wheels/53/7d/0d/714e41a8161d84d39310352f4bc15ef1b2ceb8e14292edd3b4 17-Jan-2021 17:02:18 | Successfully built yamlpath 17-Jan-2021 17:02:18 | Installing collected packages: ruamel.yaml, yamlpath 17-Jan-2021 17:02:18 | Successfully installed ruamel.yaml-0.16.12 yamlpath-3.4.0 17-Jan-2021 17:02:19 | ERROR: Impossible to add Scalar value, , to a Hash without a key. Change the value to a 'key: value' pair, a '{key: value}' Hash, or change the merge target to an Array or other Scalar value. This issue occurred at YAML Path: /`
Do you know what could be the reason?
Originally posted by @Ndubovoi in https://github.com/wwkimball/yamlpath/discussions/108#discussioncomment-288984