Skip to content

Commit 6f1a898

Browse files
Fix: conf_parser: should save file in mode 0644
1 parent 953f8e2 commit 6f1a898

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crmsh/conf_parser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
Maintainer: XLiang@suse.com
55
"""
6-
6+
import os
77
from io import StringIO
88

99
from . import corosync
@@ -49,12 +49,13 @@ def __init__(self, config_file=None, config_data=None, sec_names_with_list=()):
4949
self._dom = corosync_config_format.DomParser(f).dom()
5050
self._dom_query = corosync_config_format.DomQuery(self._dom)
5151

52-
def save(self, config_file=None):
52+
def save(self, config_file=None, file_mode=0o644):
5353
"""save the config to config file"""
5454
if not config_file:
5555
config_file = self._config_file
5656
with utils.open_atomic(config_file, 'w', fsync=True, encoding='utf-8') as f:
5757
corosync_config_format.DomSerializer(self._dom, f)
58+
os.fchmod(f.fileno(), file_mode)
5859

5960
def get(self, path, index=0):
6061
"""

0 commit comments

Comments
 (0)