From 6bd780887c0e13dc9272ec499ebc6f01cfaf7ea6 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Sat, 21 Aug 2021 07:08:30 -0500 Subject: T1950: fix permissions on component-versions.json file --- python/vyos/migrator.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'python') 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): """ -- cgit v1.2.3