Further fixes to the Kubernetes config provider, and a new set of proper unit tests
This commit is contained in:
parent
babb7bb803
commit
2ae69dc651
8 changed files with 181 additions and 107 deletions
|
@ -30,24 +30,12 @@ class FileConfigProvider(BaseFileProvider):
|
|||
def save_config(self, config_obj):
|
||||
export_yaml(config_obj, self.yaml_path)
|
||||
|
||||
def write_volume_file(self, filename, contents):
|
||||
filepath = os.path.join(self.config_volume, filename)
|
||||
_ensure_parent_dir(filepath)
|
||||
|
||||
try:
|
||||
with open(filepath, mode='w') as f:
|
||||
f.write(contents)
|
||||
except IOError as ioe:
|
||||
raise CannotWriteConfigException(str(ioe))
|
||||
|
||||
return filepath
|
||||
|
||||
def remove_volume_file(self, filename):
|
||||
filepath = os.path.join(self.config_volume, filename)
|
||||
def remove_volume_file(self, relative_file_path):
|
||||
filepath = os.path.join(self.config_volume, relative_file_path)
|
||||
os.remove(filepath)
|
||||
|
||||
def save_volume_file(self, filename, flask_file):
|
||||
filepath = os.path.join(self.config_volume, filename)
|
||||
def save_volume_file(self, flask_file, relative_file_path):
|
||||
filepath = os.path.join(self.config_volume, relative_file_path)
|
||||
_ensure_parent_dir(filepath)
|
||||
|
||||
# Write the file.
|
||||
|
|
Reference in a new issue