diff options
author | John Estabrook <jestabro@vyos.io> | 2021-08-21 07:08:30 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2021-08-21 07:09:28 -0500 |
commit | 6bd780887c0e13dc9272ec499ebc6f01cfaf7ea6 (patch) | |
tree | 5bbb168ffab8a61058af0f9cea5a6c444f084700 /python/vyos/migrator.py | |
parent | fa07bc3b87be142572124a2ce5c077cb42272418 (diff) | |
download | vyos-1x-6bd780887c0e13dc9272ec499ebc6f01cfaf7ea6.tar.gz vyos-1x-6bd780887c0e13dc9272ec499ebc6f01cfaf7ea6.zip |
T1950: fix permissions on component-versions.json file
Diffstat (limited to 'python/vyos/migrator.py')
-rw-r--r-- | python/vyos/migrator.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/python/vyos/migrator.py b/python/vyos/migrator.py index 37c4e5902..4574bb6d1 100644 --- a/python/vyos/migrator.py +++ b/python/vyos/migrator.py @@ -170,9 +170,15 @@ class Migrator(object): """ Write component versions to a json file """ + mask = os.umask(0o113) version_file = vyos.defaults.component_version_json - with open(version_file, 'w') as f: - f.write(json.dumps(component_versions, indent=2, sort_keys=True)) + try: + with open(version_file, 'w') as f: + f.write(json.dumps(component_versions, indent=2, sort_keys=True)) + except OSError: + pass + finally: + os.umask(mask) def run(self): """ |