Skip to content

Commit

Permalink
Tests: Fix the permission of snippet file
Browse files Browse the repository at this point in the history
Fix the permission of snippet file
  • Loading branch information
aborah-sudo committed Dec 20, 2024
1 parent b7d4a80 commit ad0d328
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tests/multihost/alltests/test_config_merging.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_0001_verifypermission(self, multihost):
content = "[%s]\nuse_fully_quailified_name = False" % section
snippet_file = "/etc/sssd/conf.d/01_snippet.conf"
multihost.client[0].put_file_contents(snippet_file, content)
multihost.client[0].run_command(f"chmod o-rwx {snippet_file}")
returncode = multihost.client[0].service_sssd('start')
if returncode == 0:
config_check = 'sssctl config-check'
Expand Down Expand Up @@ -63,6 +64,7 @@ def test_0002_hiddenfiles(self, multihost):
file_content = "[%s]\nuse_fully_quailified_name = False" % dom_section
snippet_file = "/etc/sssd/conf.d/._01_snippet.conf"
multihost.client[0].put_file_contents(snippet_file, file_content)
multihost.client[0].run_command(f"chmod o-rwx {snippet_file}")
start = multihost.client[0].service_sssd('start')
sssctl_cmd = 'sssctl config-check'
if start == 0:
Expand All @@ -87,6 +89,7 @@ def test_0003_lastreadparameter(self, multihost):
multihost.client[0].put_file_contents(snippet_file, content)
chmod = 'chmod 600 %s' % snippet_file
multihost.client[0].run_command(chmod)
multihost.client[0].run_command(f"chmod o-rwx {snippet_file}")
start = multihost.client[0].service_sssd('start')
cmd = multihost.client[0].run_command(['sssctl', 'config-check'])
if cmd.returncode == 0 and start == 0:
Expand Down Expand Up @@ -115,6 +118,7 @@ def test_0004_formatsnippetfile(self, multihost):
multihost.client[0].put_file_contents(snippet_file, file_content)
cmd_chmod = 'chmod 600 %s' % snippet_file
multihost.client[0].run_command(cmd_chmod, raiseonerr=False)
multihost.client[0].run_command(f"chmod o-rwx {snippet_file}")
start = multihost.client[0].service_sssd('start')
if start == 0:
config_check = 'sssctl config-check'
Expand Down Expand Up @@ -192,7 +196,7 @@ def test_0006_bz1372258(self, multihost):
sssctl_check = multihost.client[0].run_command(sssctl_cmd,
raiseonerr=False)
result = sssctl_check.stdout_text.strip()
assert '/etc/sssd/conf.d/False_snippet.conf' in result
assert 'Configuration validation failed:' in result or "did not pass access check" in result
for idx in ['True', 'False']:
snippet_file = "/etc/sssd/conf.d/%s_snippet.conf" % idx
cmd = "rm -f %s" % snippet_file
Expand Down

0 comments on commit ad0d328

Please sign in to comment.