Skip to content

Commit 36548c4

Browse files
committed
Added better verbose output
Signed-off-by: Victor Moene <victor.moene@northern.tech>
1 parent 797bed8 commit 36548c4

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

cf-agent/cf-agent.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,11 +1678,19 @@ PromiseResult ScheduleAgentOperationsTopDownOrder(EvalContext *ctx, const Bundle
16781678
PromiseResult result = PROMISE_RESULT_SKIPPED;
16791679
for (int pass = 1; pass < CF_DONEPASSES; pass++)
16801680
{
1681+
char *last_promise_type = "";
16811682
for (size_t ppi = 0; ppi < SeqLength(bp->all_promises); ppi++)
16821683
{
1684+
EvalContextSetPass(ctx, pass);
16831685
Promise *pp = SeqAt(bp->all_promises, ppi);
16841686
BundleSection *parent_section = pp->parent_section;
16851687

1688+
if (!StringEqual(last_promise_type, parent_section->promise_type))
1689+
{
1690+
SpecialTypeBannerFromString(parent_section->promise_type, pass);
1691+
}
1692+
last_promise_type = parent_section->promise_type;
1693+
16861694
EvalContextStackPushBundleSectionFrame(ctx, parent_section);
16871695

16881696
PromiseResult promise_result = ExpandPromise(ctx, pp, KeepAgentPromise, NULL);

libpromises/ornaments.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,20 @@ void SpecialTypeBanner(TypeSequence type, int pass)
130130
}
131131
}
132132

133+
void SpecialTypeBannerFromString(char *type, int pass)
134+
{
135+
if (StringEqual(type, "classes"))
136+
{
137+
Log(LOG_LEVEL_VERBOSE, "C: .........................................................");
138+
Log(LOG_LEVEL_VERBOSE, "C: BEGIN classes / conditions (pass %d)", pass);
139+
}
140+
if (StringEqual(type, "vars"))
141+
{
142+
Log(LOG_LEVEL_VERBOSE, "V: .........................................................");
143+
Log(LOG_LEVEL_VERBOSE, "V: BEGIN variables (pass %d)", pass);
144+
}
145+
}
146+
133147
void PromiseBanner(EvalContext *ctx, const Promise *pp)
134148
{
135149
char handle[CF_MAXVARSIZE];

libpromises/ornaments.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <eval_context.h>
3535

3636
void SpecialTypeBanner(TypeSequence type, int pass);
37+
void SpecialTypeBannerFromString(char *type, int pass);
3738
void PromiseBanner(EvalContext *ctx, const Promise *pp);
3839
void Banner(const char *s);
3940
void Legend();

0 commit comments

Comments
 (0)