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

fix: make yamlToDict give useful information instead of error in invalid config, fixes #5385 #5425

Merged
merged 1 commit into from Oct 24, 2023

Conversation

rfay
Copy link
Member

@rfay rfay commented Oct 14, 2023

The Issue

Invalid config, especially in .ddev/config.yaml (but could happen in global_config.yaml, and might happen in customer-provided yaml) was resulting in an incomprehensible message "Unable to YamlToDict: yamlToDict: type string not handled (post-start)"

How This PR Solves The Issue

Be more generous and just ignore and warn about the invalid yaml

Manual Testing Instructions

There are examples of config that causes the problem in #5385

hooks:
post-start:
    - host-exec: ddev auth ssh

and

hooks:
  post-start:

Use these in .ddev/config.yaml and see the results.

Also we can expect that a well-formed config.yaml doesn't cause trouble.

Automated Testing Overview

No changes

@github-actions
Copy link

@rfay rfay marked this pull request as ready for review October 15, 2023 06:38
@rfay rfay requested a review from a team as a code owner October 15, 2023 06:38
@rfay rfay requested a review from stasadev October 15, 2023 06:38
Copy link
Member Author

@rfay rfay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the right fix, and tested it with the previous problem configs.

Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before: unable to install add-on.

$ ddev get ddev/ddev-redis
Installing ddev/ddev-redis:v1.1.1
Downloading https://api.github.com/repos/ddev/ddev-redis/tarball/v1.1.1
v1.1.1_3526992483.tar.gz 8.06 KiB / ? [---------=------------------]  82.55% 0s 
Unable to YamlToDict: yamlToDict: type string not handled (hooks)

After: there is a warning about config, and add-on is installed.

$ ddev get ddev/ddev-redis
Installing ddev/ddev-redis:v1.1.1
Downloading https://api.github.com/repos/ddev/ddev-redis/tarball/v1.1.1
v1.1.1_2471001777.tar.gz 8.06 KiB / 8.06 KiB [======================] 100.00% 0s
Configuration has invalid type '<nil>' for 'hooks'
...
Installed redis:v1.1.1 from ddev/ddev-redis

@rfay rfay merged commit b99551f into ddev:master Oct 24, 2023
23 checks passed
@rfay rfay deleted the 20231014_fix_ddev_get_yamlToDict_failure branch October 24, 2023 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants