configproviders: pass filemode when opening volume

This commit is contained in:
Jimmy Zelinskie 2016-10-13 14:53:50 -04:00 committed by Joseph Schorr
parent 0c5400b7d1
commit 6eb26d7998
2 changed files with 3 additions and 3 deletions

View file

@ -80,7 +80,7 @@ class BaseProvider(object):
""" Returns whether the file with the given name exists under the config override volume. """
raise NotImplementedError
def get_volume_file(self, filename):
def get_volume_file(self, filename, mode='r'):
""" Returns a Python file referring to the given name under the config override volume. """
raise NotImplementedError

View file

@ -49,8 +49,8 @@ class FileConfigProvider(BaseProvider):
def volume_file_exists(self, filename):
return os.path.exists(os.path.join(self.config_volume, filename))
def get_volume_file(self, filename):
return open(os.path.join(self.config_volume, filename))
def get_volume_file(self, filename, mode='r'):
return open(os.path.join(self.config_volume, filename), mode=mode)
def write_volume_file(self, filename, contents):
filepath = os.path.join(self.config_volume, filename)