chef / chef/chef

`dnf_package` resource's `flush_cache` property does not respect `:after`

Open
#14,491 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Untriaged
Dominant language
Ruby
Stars
8.2k
Forks
2.5k
Avg merge
4d 5h
Merged PRs (30d)
23

Description

Description

There is a documented flush_cache property that should allow avoiding use of the in-memory cache after an install/remove action is taken. It looks like the functionality was removed in aebaee14c2d6c106914d1b3e3c9c3cbdf5bc29cb, and we always flush the cache after install

Initially this could be thought to be merely a documentation bug, but there's an interesting use case for avoiding a call to the Python helper, which is when the underlying Chef Infra Client RPM has been changed, and the path to the dnf_helper.py script (in DNF_HELPER is now broken.

So there's two parts to this fix:

  1. Update the documentation so that the assumed default for :after is true (ie the current behaviour).
  2. Use flushcache if new_resource.flush_cache[:before] == false or something roughly similar in install_package and remove_package methods.

Chef Version

Chef 18.5.0 (this bug goes back to Chef 12.21.3, though)

Platform Version

CentOS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dnf_package resource documentation and the install_package and remove_package methods mentioned in the issue, then inspect the linked DNF_HELPER implementation in lib/chef/provider/package/dnf/python_helper.rb. Verify the documented :before and :after behavior against the current cache handling, and consider the work complete when implementation and documentation agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, ruby
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.