Skip to content

Stop executing locale-gen on every chef run by adding -h flag#12833

Merged
johnmccrae merged 1 commit intochef:mainfrom
hrak:fix/locale_resource
Jun 14, 2022
Merged

Stop executing locale-gen on every chef run by adding -h flag#12833
johnmccrae merged 1 commit intochef:mainfrom
hrak:fix/locale_resource

Conversation

@hrak
Copy link
Copy Markdown
Contributor

@hrak hrak commented Apr 29, 2022

Signed-off-by: Hans Rakers hans@shoq.com

Description

The locale resource unnecessarily executes locale-gen on every chef run, which can be very costly on some systems.

This is caused by define_resource_requirements checking whether locale-gen is available by doing the following:

requirements.assert(:all_actions) do |a|
  # RHEL/CentOS type platforms don't have locale-gen
  a.assertion { shell_out("locale-gen") }
  a.failure_message(Chef::Exceptions::ProviderNotFound, "The locale resource requires the locale-gen tool")
end

This is causing locale-gen to be executed, regenerating all installed locales on every Chef run.

Related Issue

#12832

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

@hrak hrak requested review from a team as code owners April 29, 2022 09:28
@github-actions github-actions bot added the documentation How do we use this project? label Apr 29, 2022
Copy link
Copy Markdown
Member

@marcparadise marcparadise left a comment

Choose a reason for hiding this comment

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

See inline

@hrak hrak force-pushed the fix/locale_resource branch from d1f9209 to b2950db Compare May 11, 2022 09:26
@hrak
Copy link
Copy Markdown
Contributor Author

hrak commented May 11, 2022

PR updated, build failed but seems unrelated to the changes.

Would be nice to backport this to chef-17 branch too. Let me know if you want me to file a PR against the chef-17 branch.

Copy link
Copy Markdown
Collaborator

@jaymzh jaymzh left a comment

Choose a reason for hiding this comment

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

Thanks!

@PrajaktaPurohit
Copy link
Copy Markdown
Contributor

@hrak - it would be great if this can be backported to chef-17 and chef-16. Thanks!

@hrak
Copy link
Copy Markdown
Contributor Author

hrak commented May 20, 2022

@hrak - it would be great if this can be backported to chef-17 and chef-16. Thanks!

Done! See #12904 and #12905

@PrajaktaPurohit
Copy link
Copy Markdown
Contributor

This looks good. Thank you for creating the backport branches! Could you please rebase the PR with the latest main? That should make the failing tests pass. We can merge it in after.

@neha-p6
Copy link
Copy Markdown
Collaborator

neha-p6 commented May 31, 2022

@hrak Could you rebase with latest main so that it'll fix the failures?

@hrak
Copy link
Copy Markdown
Contributor Author

hrak commented May 31, 2022 via email

@neha-p6 neha-p6 added Status: Waiting on Contributor A pull request that has unresolved requested actions from the author. and removed documentation How do we use this project? labels May 31, 2022
@github-actions github-actions bot added the documentation How do we use this project? label Jun 9, 2022
Signed-off-by: Hans Rakers <hans@shoq.com>
@hrak hrak force-pushed the fix/locale_resource branch from f2298e1 to 67547c8 Compare June 9, 2022 08:37
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Jun 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@hrak
Copy link
Copy Markdown
Contributor Author

hrak commented Jun 9, 2022

All three PRs updated!

@hrak
Copy link
Copy Markdown
Contributor Author

hrak commented Jun 9, 2022

@neha-p6 the Windows builds keep failing unfortunately

@neha-p6 neha-p6 removed the Status: Waiting on Contributor A pull request that has unresolved requested actions from the author. label Jun 9, 2022
@johnmccrae johnmccrae merged commit a3ee270 into chef:main Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation How do we use this project?

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants