-
Notifications
You must be signed in to change notification settings - Fork 21
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
generate_new_metadata in tidy_backup_clean.rb needs to preserve metadata.json #105
Comments
I think the only thing that should happen here is:
Most of the logic around hacking up metadata.rb in knife tidy should be eliminated from the codebase. |
….rb needs to preserve metadata.json. It skips the new generation of files if both metadata.json and metadata.rb exist It creates minimal data if both metadata.json or metadata.rb does not exist It creates metadata.json if only metadata.rb exist as knife cookbook metadata does. No metadata.rb is generated if only metadata.json exist only fields of the existing metadata.json gets fixed if there any repair to file require which as per old logic. Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
Okay so I now have a bit more complete information on what is going on. The problem is that this runs on a checkout of the filesystem from "knife ec backup". For old chef servers there may have been no enforcement of the metadata.json file being uploaded to the manifest of the cookbook. All the information is accessible from the API, but knife ec backup will only download the filesystem contents. Since it is throwing away necessary data, this seems to violate the principle that it should be a "backup" tool. So what needs to happen is that If knife download/upload aka chef_fs need to be changed at the same time that would probably be a good way to implement this. Once that is done THEN we can assume in knife tidy that cookbooks MUST always have a valid metadata.json (and can raise and suggest the user upgrade their knife-ec-backup gem if the cookbook does not). |
….rb needs to preserve metadata.json. It skips the new generation of files if both metadata.json and metadata.rb exist It creates minimal data if both metadata.json or metadata.rb does not exist It creates metadata.json if only metadata.rb exist as knife cookbook metadata does. No metadata.rb is generated if only metadata.json exist only fields of the existing metadata.json gets fixed if there any repair to file require which as per old logic. Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
….rb needs to preserve metadata.json. It skips the new generation of files if both metadata.json and metadata.rb exist It creates minimal data if both metadata.json or metadata.rb does not exist It creates metadata.json if only metadata.rb exist as knife cookbook metadata does. No metadata.rb is generated if only metadata.json exist only fields of the existing metadata.json gets fixed if there any repair to file require which as per old logic. Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
If the cookbook has a metadata.json that file should never be stripped, removed or tampered with at all (no matter if metadata.rb exists or not, client programs should never attempt to regenerate metadata.json from the metadata.rb in the cookbook if it is present, the metadata.json file MUST be considered authoritative. The metadata.rb file MAY require build time artifacts which are not present in the shipping cookbook and trying to recompile it after the metadata.json has been generated is guaranteed to fail on some cookbooks.
If the cookbook has a metadata.rb file that should also not be tampered with, but it should also be ignored completely if the metadata.json file is present (so if the metadata.json and metadata.rb files are present then nothing should be done with either file THE metadata.rb file may not be parseable and THIS IS NOT A BUG TO FIX -- downstream utilities must be modified to prefer the metadata.json file.
ONLY IF one of the files exists and the other does not should knife tidy attempt to generate or reconstruct one from the other.
I can't sort out precisely what knife tidy is actually doing, but I'm reasonably confident it isn't following these guidelines.
The text was updated successfully, but these errors were encountered: