Skip to content

Commit

Permalink
Handle defaults so they are not written to the config
Browse files Browse the repository at this point in the history
  • Loading branch information
drewsonne committed Apr 21, 2018
1 parent 22fd7a9 commit e5c7b70
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions onelogin_aws_cli/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class ConfigurationFile(configparser.ConfigParser):
def __init__(self, config_file=None):
super().__init__(
default_section='defaults',
defaults=dict(self.DEFAULTS)
)

self.file = config_file
Expand Down Expand Up @@ -119,7 +118,11 @@ def __setitem__(self, key, value):
def __getitem__(self, item):
if item in self._overrides:
return self._overrides[item]
return self.config.get(self.section_name, item)

if item in self:
return self.config.get(self.section_name, item)

return self.config.DEFAULTS[item]

def __contains__(self, item):
return self.config.has_option(self.section_name, item)

0 comments on commit e5c7b70

Please sign in to comment.