From fc03e0fdf3e7389ee668d66cf7224df2aaaaa95b Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Mon, 25 Nov 2019 10:13:00 -0600 Subject: T1824: set write permissions for cfg_group on vyos-migrate.log --- python/vyos/migrator.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'python/vyos') diff --git a/python/vyos/migrator.py b/python/vyos/migrator.py index 86e1af183..281c247db 100644 --- a/python/vyos/migrator.py +++ b/python/vyos/migrator.py @@ -80,6 +80,8 @@ class Migrator(object): """ self._log_file = os.path.join(vyos.defaults.directories['config'], 'vyos-migrate.log') + # on creation, allow write permission for cfg_group + os.umask(0o113) try: log = open('{0}'.format(self._log_file), 'w') log.write("List of executed migration scripts:\n") -- cgit v1.2.3 From 3d2cdbdbaadc5a6c7ad50254f61744c222dae438 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Mon, 25 Nov 2019 14:07:43 -0600 Subject: T1824: restore original umask --- python/vyos/migrator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'python/vyos') diff --git a/python/vyos/migrator.py b/python/vyos/migrator.py index 281c247db..f05228041 100644 --- a/python/vyos/migrator.py +++ b/python/vyos/migrator.py @@ -80,15 +80,18 @@ class Migrator(object): """ self._log_file = os.path.join(vyos.defaults.directories['config'], 'vyos-migrate.log') - # on creation, allow write permission for cfg_group - os.umask(0o113) + # on creation, allow write permission for cfg_group; + # restore original umask on exit + mask = os.umask(0o113) try: log = open('{0}'.format(self._log_file), 'w') log.write("List of executed migration scripts:\n") except Exception as e: + os.umask(mask) print("Logging error: {0}".format(e)) return None + os.umask(mask) return log def run_migration_scripts(self, config_file_versions, system_versions): -- cgit v1.2.3