Comments (2)
I think the only thing that should happen here is:
- if metadata.rb and metadata.json both exist, do nothing at all.
- if metadata.json only exists, try to construct a simplified metadata.rb
- if metadata.rb only exists, generate metadata.json using the
knife cookbook metadata
approach most likely (this should never happen, don't worry about error conditions, just let it fail hard if it doesn't work) - if metadata.rb and metadata.json both don't exist, hard fail (this should never ever happen)
Most of the logic around hacking up metadata.rb in knife tidy should be eliminated from the codebase.
from knife-tidy.
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 knife ec backup
should GET <org>/cookbooks/NAME/version
and dump the metadata field in the response to metadata.json and use that as the source of truth of the metadata.json of the cookbook instead of the filesystem
contents.
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).
from knife-tidy.
Related Issues (20)
- notifications fail for chef orgs containing an underscore
- specifying backup directory with tab completion doesn't complete HOT 1
- the backup-path should default to current working directory HOT 3
- knife tidy server report should handle missing read permission HOT 2
- Installs, doesn't run HOT 5
- Exception: NoMethodError: undefined method `captures' for nil:NilClass
- backup path can be empty and clean can still proceed
- Have knife-tidy shipped as part of the standard gems in chef-server-core HOT 4
- Enhancement: add the ability to point knife-tidy at multiple chef-servers to see what's used
- Dependabot can't parse your Gemfile
- knife tidy backup clean throws an error with chef-dk/ws that includes chef >= 15.0.293 HOT 1
- Failing spec tests
- knife-tidy-2.0.9/lib/chef/tidy_acls.rb:205:in `[]': no implicit conversion of Symbol into Integer (TypeError)
- crashes on FFI_Yajl::ParseError
- Dependabot needs permission to see chefstyle HOT 1
- ERROR: Errno::ENAMETOOLONG: File name too long @ rb_sysopen
- knife tidy backup clean --gen-gsub fails due to missing file
- Sort the clients in the clients group object
- Tidy removing needed/required/used cookbook versions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knife-tidy.