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

Chef/Modernize/CronDFileOrTemplate triggers on cron.daily #954

Closed
ddamw opened this issue Mar 9, 2022 · 1 comment
Closed

Chef/Modernize/CronDFileOrTemplate triggers on cron.daily #954

ddamw opened this issue Mar 9, 2022 · 1 comment
Labels
False Positive Cop has false positives (errors for no reason) Status: Good First Issue An issue ready for a new contributor. Triage: Confirmed Indicates and issue has been confirmed as described. Type: Bug Does not work as expected.

Comments

@ddamw
Copy link

ddamw commented Mar 9, 2022

Version:

Chef Workstation 22.2.807
Cookstyle 7.32.0

Environment:

Debian 11

Scenario:

We use a cookbook_file resource to process a file in /etc/cron.daily

Steps to Reproduce:

Add the following resource to a cookbook recipe:

cookbook_file '/etc/cron.daily/locate' do
  source 'locate'
  owner 'root'
  group 'root'
  mode '755'
end

Then run cookstyle

Expected Result:

I expect no warning from this.

Actual Result:

Chef/Modernize/CronDFileOrTemplate: Use the cron_d resource that ships with Chef Infra Client 14.4+ instead of manually creating the file with template, file, or cookbook_file resources (https://docs.chef.io/workstation/cookstyle/chef_modernize_crondfileortemplate) cookbook_file '/etc/cron.daily/locate' do ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I am guessing that the cop is triggering on cron.d*, instead of just cron.d

#946 seems to have a very similar issue

FYI: cron.daily is a directory where scripts can be dropped that run daily, cron.d is a directory where cron jobs with full cron configuration (i.e.: with time, user, etc) are placed.

@ddamw ddamw added Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected. labels Mar 9, 2022
@dafyddcrosby dafyddcrosby added Triage: Confirmed Indicates and issue has been confirmed as described. Status: Good First Issue An issue ready for a new contributor. False Positive Cop has false positives (errors for no reason) and removed Status: Untriaged An issue that has yet to be triaged. labels Jun 13, 2024
dafyddcrosby added a commit to dafyddcrosby/cookstyle that referenced this issue Jun 14, 2024
chef#959 fixed this, but the regression tests were missing

Signed-off-by: David Crosby <dcrosby@fb.com>
@dafyddcrosby
Copy link
Collaborator

Confirmed bug fixed with #959, but didn't have a regression test, so made one with #972

tpowell-progress added a commit that referenced this issue Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive Cop has false positives (errors for no reason) Status: Good First Issue An issue ready for a new contributor. Triage: Confirmed Indicates and issue has been confirmed as described. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

2 participants