chimpler / pyhocon

HOCON parser for Python
Apache License 2.0
502 stars 118 forks source link

Fix broken overrides #287

Closed afanasev closed 1 year ago

afanasev commented 2 years ago

Trying to fix https://github.com/chimpler/pyhocon/issues/271 and similiar issues once again. Added some tests and make them pass. Did NOT check 4 inlude tests since they're not working on Win.

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.9%) to 95.295% when pulling 17a739c062a63e0290aa212a151fb9abf259f31a on afanasev:master into be660deb6d6a5a175d384792e208fd39986758ea on chimpler:master.

darthbear commented 1 year ago

Thank you @afanasev for your PR!

carolguo-dd commented 1 year ago

Seems like this fix has introduced another problem. we set the the POD_NAMESPACE env variable, but not the K8s_NAMESPACE variable and have below input file

{
    k8s {
        namespace = ${POD_NAMESPACE}
        namespace = ${?K8S_NAMESPACE}

    }
    host= test-${k8s.namespace}
}

this used to work in 0.3.59 version, but now it breaks with

  File "/Users/carol.guo/.pyenv/versions/3.9.7/lib/python3.9/site-packages/pyhocon/config_parser.py", line 695, in resolve_substitutions
    raise ConfigSubstitutionException("Cannot resolve {variables}. Check for cycles.".format(
pyhocon.exceptions.ConfigSubstitutionException: Cannot resolve ${k8s.namespace}: (line: 7, col: 21). Check for cycles.
fsonntag commented 8 months ago

This change also broke some of our configs, see here:

https://github.com/chimpler/pyhocon/issues/320

@darthbear Is it possible to revert this change?