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

Missing restart of rsyslog service when the JSON lookup_table file is updated #229

Open
lmontand opened this issue Jul 5, 2023 · 0 comments

Comments

@lmontand
Copy link
Contributor

lmontand commented Jul 5, 2023

When only changing the JSON file of a lookup table, a refresh of the rsyslog systemd service is missing.

How to reproduce

This can be reproduced by simply using the first example of the readme and running the puppet agent once. Then modify the content of the JSON lookup table (lookup_json parameter), for example 3.3.3.3 instead of 2.2.2.2 and run puppet again. The rsyslog service is not restarted and the new lookup table is not used (the old table is still used, instead).

Suggestion to fix the problem

In lookup_table.pp#L20-L26, replace this code:

  file { "rsyslog::component::lookup_table_json::${title}":
    path    => $_json_file,
    content => inline_template('<%= JSON.pretty_generate @lookup_json %>'),
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
  }

with this new code (similar to what is done in generate_concat.pp):

  if $rsyslog::manage_service or $rsyslog::external_service {
    file { "rsyslog::component::lookup_table_json::${title}":
      path    => $_json_file,
      content => inline_template('<%= JSON.pretty_generate @lookup_json %>'),
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      notify  => Service[$rsyslog::service_name],
    }
  } else {
    file { "rsyslog::component::lookup_table_json::${title}":
      path    => $_json_file,
      content => inline_template('<%= JSON.pretty_generate @lookup_json %>'),
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
    }
  }

Maybe you also want to add the $reload_on_hup parameter in the if condition, I am not sure on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant