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

a poorly indented config file results in a incomprehensible message : "Unexpected Exception : 'NoneType' object has no attribute 'items' #61

Open
PhilippeGregoire opened this issue Jan 17, 2024 · 0 comments
Labels

Comments

@PhilippeGregoire
Copy link

Here the cmd line is not well indented. This is not detected by yamllint command.

the command should report the error more clearly and in a way that help user to find it.

# cat bugindent.yaml 

services:
    hello:
        actions:
            start:
            cmd: echo Hello World

# yamllint bugindent.yaml 
bugindent.yaml
  1:1       error    too many blank lines (1 > 0)  (empty-lines)
  2:1       warning  missing document start "---"  (document-start)


#  milkcheck -c $PWD --dry-run
No actions specified, checking configuration...
[11:46:40] ERROR    - Unexpected Exception : 'NoneType' object has no attribute 'items'
[

#  milkcheck -c $PWD --dry-run --debug
[11:46:49] DEBUG    - Configuration
assumeyes: False
config_dir: /root/gregoirep/tmp/milkbug
confirm_actions: []
dryrun: True
fanout: 256
nodeps: False
report: full
reverse_actions: ['stop']
summary: False
tags: set([])
verbosity: 5
No actions specified, checking configuration...
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/MilkCheck/UI/Cli.py", line 560, in execute
    self.manager.load_config(self._conf['config_dir'])
  File "/usr/lib/python2.7/site-packages/MilkCheck/ServiceManager.py", line 192, in load_config
    self.fromdict(load_from_dir(conf))
  File "/usr/lib/python2.7/site-packages/MilkCheck/Engine/ServiceGroup.py", line 359, in fromdict
    service.fromdict(props)
  File "/usr/lib/python2.7/site-packages/MilkCheck/Engine/Service.py", line 253, in fromdict
    action.fromdict(props)
  File "/usr/lib/python2.7/site-packages/MilkCheck/Engine/Action.py", line 473, in fromdict
    BaseEntity.fromdict(self, actdict)
  File "/usr/lib/python2.7/site-packages/MilkCheck/Engine/BaseEntity.py", line 714, in fromdict
    for item, prop in entdict.items():
AttributeError: 'NoneType' object has no attribute 'items'

@cedeyn cedeyn added the bug label Sep 13, 2024
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