Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_calyptia_fleet: add old configuration file to checks. #8091

Merged
merged 3 commits into from
Oct 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions plugins/in_calyptia_fleet/in_calyptia_fleet.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,35 @@ static int is_cur_fleet_config(struct flb_in_calyptia_fleet_config *ctx, struct
return ret;
}

static int is_old_fleet_config(struct flb_in_calyptia_fleet_config *ctx, struct flb_config *cfg)
{
flb_sds_t cfgcurname;
int ret = FLB_FALSE;


if (cfg == NULL) {
return FLB_FALSE;
}

if (cfg->conf_path_file == NULL) {
return FLB_FALSE;
}

cfgcurname = old_fleet_config_filename(ctx);
if (cfgcurname == NULL) {
flb_plg_error(ctx->ins, "unable to allocate configuration name");
return FLB_FALSE;
}

if (strcmp(cfgcurname, cfg->conf_path_file) == 0) {
ret = FLB_TRUE;
}

flb_sds_destroy(cfgcurname);

return ret;
}

static int is_timestamped_fleet_config(struct flb_in_calyptia_fleet_config *ctx, struct flb_config *cfg)
{
char *fname;
Expand Down Expand Up @@ -309,6 +338,7 @@ static int is_fleet_config(struct flb_in_calyptia_fleet_config *ctx, struct flb_

return is_new_fleet_config(ctx, cfg) ||
is_cur_fleet_config(ctx, cfg) ||
is_old_fleet_config(ctx, cfg) ||
is_timestamped_fleet_config(ctx, cfg);
}

Expand Down
Loading