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

Add property to configure logback.xml #143

Merged
merged 4 commits into from
Apr 10, 2024
Merged

Add property to configure logback.xml #143

merged 4 commits into from
Apr 10, 2024

Conversation

achamo
Copy link
Contributor

@achamo achamo commented Apr 4, 2024

  • Users are already able to configure logback for custom logging options outside of the cookbook. The main drawback is the restart of nexus required to take the changes into account.
  • Here we allow them to pass their options directly to the resource with a template file and the cookbook name, to apply the template in the same resource and notify the restart at the same time.

* Users are already able to configure logback for custom logging options
  outside of the cookbook. The main drawback is the restart of nexus
  required to take the changes into account.
* Here we allow them to pass their options directly to the resource with
  a template file and the cookbook name, to apply the template in the
  same resource and notify the restart at the same time.

Change-Id: If22eb60d0797487625c2b2f28b37d0897867ca3e
* Because the resource is very long and splitting it wouldn't make a lot
  of sense

Change-Id: Ida1197958d862a18d87d2ae21bdf66e00783d871
* Set an empty hash by default

Change-Id: Iee83bd04cff62484a8a60d1038ce01f246a3c198
* To customize the template, we need variables

Change-Id: Ifc3e96ad82f425f0f5e3f390814ce3ae5e73880a
Comment on lines +112 to +122
template ::File.join(new_resource.data, 'etc', 'logback', 'logback.xml') do
source new_resource.logback_variables['source']
cookbook new_resource.logback_variables['cookbook']
mode '0644'
owner new_resource.nexus3_user
group new_resource.nexus3_group
variables(config: new_resource.logback_variables['config'])
notifies :restart, "nexus3_service[#{new_resource.service_name}]", :delayed
notifies :run, "ruby_block[#{blocker}]", :delayed
not_if { new_resource.logback_variables.empty? }
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPT/FAR: we could have a more generic solution allowing to inject any arbitrary template (not only logback).
With a bit of refacto I have the impression we could reuse the same system for nexus.vmoptions, nexus.properties & nexus.rc, and any future config need.

@achamo achamo merged commit 3f90ed3 into master Apr 10, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants