[displaymanager] Handle case where config file doesn't exist or has no key
- If the config file doesn't exist, the dictionary is empty - If it **does** exist, it might not have key 'default_session' in it Either case should avoid a KeyError by using get() (or setdefault, in this context). Subsequent use of os.path.exists() is strange, since the value is a **group** (e.g. a dictionary) in the config file. Just check if it exists, and then fill something in.
This commit is contained in:
parent
11424195ef
commit
54fd81a87e
@ -859,7 +859,8 @@ class DMgreetd(DisplayManager):
|
|||||||
|
|
||||||
self.config_data['terminal'] = dict(vt = "next")
|
self.config_data['terminal'] = dict(vt = "next")
|
||||||
|
|
||||||
if not os.path.exists(self.config_data['default_session']):
|
default_session_group = self.config_data.get('default_session', None)
|
||||||
|
if not default_session_group:
|
||||||
self.config_data['default_session'] = {}
|
self.config_data['default_session'] = {}
|
||||||
|
|
||||||
self.config_data['default_session']['user'] = self.greeter_user
|
self.config_data['default_session']['user'] = self.greeter_user
|
||||||
|
Loading…
Reference in New Issue
Block a user