treasure-data / chef-td-agent

Chef Cookbook for td-agent (Treasure Agent or Fluentd)
https://supermarket.chef.io/cookbooks/td-agent
Apache License 2.0
127 stars 121 forks source link

Bug: Race Condition with a Bad Config #110

Closed jacknagz closed 6 years ago

jacknagz commented 6 years ago

Background

Currently, the td-agent::default recipe is responsible for installing TD agent, and configuring the main config file along with starting and enabling the td-agent service.

Issue

The designated workflow suggests the recipe td-agent::default be included prior to using the custom resources (td_agent_match, etc) to setup the application based on your own requirements.

The problem is that if you incorrectly configure td-agent, Chef is unable to correct the problem due to the default recipe attempting to start the service. This causes failed Chef runs because the custom resources cannot change the offending configurations.

Solution

Split the configuration/service resources in td-agent::default into their own recipe, potentially called td-agent::configure. The default recipe logic will remain the same, and this solution will give more flexibility and reliability to the user on how to use the cookbook with custom resources.