Page MenuHomeDevCentral

Read correctly empty configuration file
ClosedPublic

Authored by dereckson on Thu, Sep 25, 17:00.
Tags
None
Referenced Files
F12062181: D3725.diff
Mon, Sep 29, 08:46
F12061421: D3725.id9634.diff
Mon, Sep 29, 05:48
F12061012: D3725.id9633.diff
Mon, Sep 29, 02:55
F12060935: D3725.id9634.diff
Mon, Sep 29, 02:18
F12060704: D3725.diff
Mon, Sep 29, 01:06
F12060670: D3725.id9633.diff
Mon, Sep 29, 00:45
F12060590: D3725.id.diff
Mon, Sep 29, 00:19
F12060575: D3725.id9633.diff
Mon, Sep 29, 00:18
Subscribers
None

Details

Summary

When a configuration file exists but is empty, YAML parser returns None.

This change returns an empty dict to represent the empty configuration.

This fixes the following issue for empty config file:

File "/home/dereckson/dev/python/general/lib64/python3.13/site-packages/mergedictionaries/app/app.py", line 118, in <lambda>
  self.context["config"].get("git", []), self.context["git"]
  ^^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'get'

Test Plan
  • create an empty configuration file
  • merge-dictionaries --extract

Diff Detail

Repository
rMD Merge dev dictionaries
Lint
Lint Errors
SeverityLocationCodeMessage
Errorsrc/mergedictionaries/app/app.py:66E501flake8 E501
Errorsrc/mergedictionaries/app/app.py:103E501flake8 E501
Unit
No Test Coverage
Branch
empty-git-config-issue
Build Status
Buildable 5973
Build 6255: arc lint + arc unit

Event Timeline

dereckson created this revision.
This revision is now accepted and ready to land.Thu, Sep 25, 17:00
This revision was landed with ongoing or failed builds.Thu, Sep 25, 17:01
This revision was automatically updated to reflect the committed changes.