Skip to content

Commit

Permalink
TOOLS: get rid of strings duplications
Browse files Browse the repository at this point in the history
Reviewed-by: Alejandro López <[email protected]>
Reviewed-by: Pavel Březina <[email protected]>
  • Loading branch information
alexey-tikhonov authored and pbrezina committed Aug 7, 2023
1 parent 7902bd6 commit a540f91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
3 changes: 1 addition & 2 deletions src/tests/multihost/alltests/test_config_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,7 @@ 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 \
assert 'File ownership and permissions check failed' in result and \
sssctl_check.returncode == 1

@pytest.mark.tier1
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 a540f91

Please sign in to comment.