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

Tidy removing needed/required/used cookbook versions #131

Open
MrCyrus opened this issue Jul 29, 2020 · 1 comment
Open

Tidy removing needed/required/used cookbook versions #131

MrCyrus opened this issue Jul 29, 2020 · 1 comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.

Comments

@MrCyrus
Copy link

MrCyrus commented Jul 29, 2020

Version:

2.1.0

Environment:

Amazon Linux AMI
4.14.181-140.257.amzn2.x86_64

Scenario:

We've a production Chef-infra where an 'export' is produced.
On a new Chef-infra (that will eventually replace our old production Chef-Infra) we are wanting to 'import' to this new server and this works OK.
Since our old Chef-Infra server is 3 years old, it has a LOT of old and unused cookbook versions we'd like to remove/clean up so we want to run 'tidy' to remove unneeded cookbooks.
Unfortunately, required/used cookbook versions are being removed.

Steps to Reproduce:

On our new Chef-infra server the 'export' from our current Chef-infra is placed in /tmp/export.
We then run:

  • /usr/bin/knife tidy backup clean --backup-path /tmp/export
  • /usr/bin/knife ec restore /tmp/Agilent-CS-Chef-Infra-Server-export --with-user-sql --with-key-sql -c /etc/opscode/pivotal.rb --yes
  • cd /tmp
  • /usr/bin/knife tidy server report
  • /usr/bin/knife tidy server clean --backup-path /tmp/reports --yes
    and required cookbook versions get removed.

Expected Result:

We have environments pinned to certain roles which contain absolute pinnings for all included cookbooks.
All of our nodes are assigned a role and an environment, so the environment pinning points to a specific role version which in turn points to specific cookbook versions.

When I look at /tmp/reports/ORG_unused_cookbooks.json I see, for example, that for 'windows' it is saying that version '5.3.1' is OK to delete even though we've a role cookbook with absolute pinnings requiring this version.

As a workaround, I can edit /tmp/reports/ORG_unused_cookbooks.json removing 5.3.1 from the 'windows' list, but I shouldn't have to do this.

Actual Result:

Required and needed versions or cookbooks are deleted.

@MrCyrus MrCyrus added Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected. labels Jul 29, 2020
@ecottom
Copy link

ecottom commented Jan 25, 2022

I ran into this issue as well and suspect it was the feature that added keep_versions. It looks like line 85 of tidy_server_report.rb used_cookbooks = keep_cookbook_versions(cb_list, keep_versions) resets used_cookbooks using the list of call cookbooks ignoring all of the node data.

vkarve-chef added a commit to chef/chef-server that referenced this issue Oct 18, 2022
vkarve-chef added a commit to chef/chef-server that referenced this issue Oct 18, 2022
jashaik pushed a commit to chef/chef-server that referenced this issue Oct 19, 2022
jashaik pushed a commit to chef/chef-server that referenced this issue Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

2 participants