Skip to content

Commit

Permalink
TOOLS: get rid of strings duplications
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-tikhonov committed Jul 20, 2023
1 parent 23a36ef commit f13d25b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
5 changes: 2 additions & 3 deletions src/tests/multihost/alltests/test_config_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,8 @@ def test_0028_bz1723273(self, multihost, backupsssdconf):
result = sssctl_check.stdout_text.strip()
rm_dir = 'rm -rf /tmp/test'
multihost.client[0].run_command(rm_dir, raiseonerr=False)
assert 'File ownership and permissions check failed. Expected ' \
'root:root and 0600' in result and \
sssctl_check.returncode == 1
assert 'File ownership and permissions check failed'
in result and sssctl_check.returncode == 1

@pytest.mark.tier1
def test_0029_bz1723273(self, multihost, backupsssdconf):
Expand Down
21 changes: 2 additions & 19 deletions src/tools/sssctl/sssctl_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,32 +114,15 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline,
config_path,
config_snippet_path);

if (ret == ERR_INI_OPEN_FAILED) {
PRINT("Failed to open %s\n", config_path);
if (ret != EOK) {
PRINT("Failed to read '%s': %s\n", config_path, sss_strerror(ret));
goto done;
}

if (!sss_ini_exists(init_data)) {
PRINT("File %1$s does not exist.\n", config_path);
}

if (ret == ERR_INI_INVALID_PERMISSION) {
PRINT("File ownership and permissions check failed. "
"Expected root:root and 0600.\n");
goto done;
}

if (ret == ERR_INI_PARSE_FAILED) {
PRINT("Failed to load configuration from %s.\n",
config_path);
goto done;
}

if (ret == ERR_INI_ADD_SNIPPETS_FAILED) {
PRINT("Error while reading configuration directory.\n");
goto done;
}

/* Used snippet files */
ra_success = sss_ini_get_ra_success_list(init_data);
num_ra_success = ref_array_len(ra_success);
Expand Down

0 comments on commit f13d25b

Please sign in to comment.