Skip to content

Commit

Permalink
Notes and small fixes
Browse files Browse the repository at this point in the history
Ticket: ENT-5291
Changelog: None
  • Loading branch information
vpodzime committed May 26, 2020
1 parent 7f10fe5 commit 2390479
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions cf-agent/files_changes.c
Expand Up @@ -514,6 +514,7 @@ bool FileChangesCheckAndUpdateHash(EvalContext *ctx,
}
else
{
/* XXX: FAIL if found?!?!?! */
RecordFailure(ctx, pp, attr, "Hash for file '%s' changed", filename);
*result = PromiseResultUpdate(*result, PROMISE_RESULT_FAIL);
ret = true;
Expand Down
9 changes: 7 additions & 2 deletions cf-agent/verify_files.c
Expand Up @@ -361,8 +361,9 @@ static PromiseResult VerifyFilePromise(EvalContext *ctx, char *path, const Promi
}

ChopLastNode(basedir);
if (safe_chdir(basedir))
if (safe_chdir(basedir) != 0)
{
/* TODO: PROMISE_RESULT_FAIL?!?!?!?! */
char msg[CF_BUFSIZE];
snprintf(msg, sizeof(msg), "Failed to chdir into '%s'. (chdir: '%s')",
basedir, GetErrorStr());
Expand Down Expand Up @@ -412,9 +413,10 @@ static PromiseResult VerifyFilePromise(EvalContext *ctx, char *path, const Promi
{
if (a.havedepthsearch)
{
/* TODO: PROMISE_RESULT_DENIED */
Log(LOG_LEVEL_DEBUG,
"depth_search (recursion) is promised for a base object '%s' that is not a directory",
path);
path);
goto exit;
}
}
Expand All @@ -428,6 +430,7 @@ static PromiseResult VerifyFilePromise(EvalContext *ctx, char *path, const Promi
{
if (!S_ISDIR(dsb.st_mode))
{
/* TODO: PROMISE_RESULT_FAIL */
Log(LOG_LEVEL_ERR, "Cannot promise to link the children of '%s' as it is not a directory!",
a.link.source);
goto exit;
Expand Down Expand Up @@ -677,6 +680,8 @@ static PromiseResult RenderTemplateMustache(EvalContext *ctx, const Promise *pp,
pp->promiser, message);
result = PromiseResultUpdate(result, PROMISE_RESULT_CHANGE);

/* XXX: Really needed? The promise result should propagate
* from here. */
edcontext->num_rewrites++;
}
else
Expand Down
2 changes: 2 additions & 0 deletions cf-agent/verify_files_utils.c
Expand Up @@ -981,6 +981,7 @@ static PromiseResult SourceSearchAndCopy(EvalContext *ctx, const char *from, cha
RecordInterruption(ctx, pp, attr, "Can't make directory '%s'. (mkdir: %s)",
newto, GetErrorStr());
result = PromiseResultUpdate(result, PROMISE_RESULT_INTERRUPTED);
/* XXX: return result?!?!?! */
continue;
}
else
Expand Down Expand Up @@ -1875,6 +1876,7 @@ static PromiseResult VerifyName(EvalContext *ctx, char *path, const struct stat
{
if (attr->rename.disable)
{
/* XXX: Why should attr->rename.disable imply that the file doesn't exist? */
Log(LOG_LEVEL_WARNING, "File object '%s' exists, contrary to promise", path);
}
}
Expand Down

0 comments on commit 2390479

Please sign in to comment.