Ensure files are created with 0600 perms
Network Manager in Rocky Linux 10 is complaning on 100644 for .nmconnection keyfiles Change-Id: I36085f721408dfb33f6a1bf9b599ced5382fc4f1 Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
This commit is contained in:
@@ -1394,6 +1394,7 @@ def finish_files(files_to_write, args):
|
||||
log.debug("Writing output file : %s" % k)
|
||||
with safe_open(k, 'w') as outfile:
|
||||
outfile.write(files_to_write[k])
|
||||
|
||||
log.debug(" ... done")
|
||||
break
|
||||
except IOError as e:
|
||||
@@ -1412,6 +1413,10 @@ def finish_files(files_to_write, args):
|
||||
else:
|
||||
raise
|
||||
|
||||
if '/etc/NetworkManager/system-connections/' in k:
|
||||
# NetworkManager refuses to load nmconnection files with 644 perms
|
||||
os.chmod(k, 0o600)
|
||||
|
||||
|
||||
def is_interface_live(interface, sys_root):
|
||||
try:
|
||||
|
||||
@@ -176,7 +176,9 @@ class TestGlean(base.BaseTestCase):
|
||||
new_callable=mock.Mock)
|
||||
@mock.patch('glean.cmd.is_keyfile_format', return_value=False,
|
||||
new_callable=mock.Mock)
|
||||
@mock.patch('os.chmod', return_value=0, new_callable=mock.Mock)
|
||||
def _assert_distro_provider(self, distro, provider, interface,
|
||||
mock_os_chmod,
|
||||
mock_is_keyfile,
|
||||
mock_vendor_linux_distribution,
|
||||
mock_open,
|
||||
|
||||
Reference in New Issue
Block a user