Closed jaylevitt closed 11 years ago
Actually, this may either be a bug or my total misunderstanding, because after changing roles/base.rb, without uploading it, I see the following:
chef-repo% knife diff **/*
chef-repo% knife diff roles
Only in remote/: roles
chef-repo% knife diff roles/*
chef-repo% knife diff roles/base.rb
/../../../../roles/base.rb: No such file or directory on remote or local
chef-repo%
It could be a bug; that output is saying strange things. What directory are you in when you are running knife diff; where is your repo directory at; and what directories do you have there? Also, do you have some roles?
Your intuition is right though, the rule is, "after a knife upload or knife download, knife diff will always return empty."
I'm right in the chef-repo itself when I type that. It does have some roles, and the usual subdirectories, as you can see:
chef-repo% tree -L 2 -I tmp
.
├── Cheffile
├── Cheffile.lock
├── Guardfile
├── README.md
├── Rakefile
├── certificates
│ └── README.md
├── chefignore
├── config
│ └── rake.rb
├── cookbooks
│ ├── apache2
│ ├── apt
| [...]
├── data_bags
│ ├── README.md
│ └── users
├── environments
│ └── README.md
├── roles
│ ├── README.md
│ ├── app.rb
│ ├── base.rb
│ └── search.rb
├── scripts
│ └── chef-backup
└── site-cookbooks
| [...]
Is there someplace I could add some puts
statements that would yield some clues? I looked at chef_fs
but I don't know enough about where things live on the server, etc. to understand how local and remote paths translate - or, for that matter, where /../../../../
is even coming from.
Yeah, the .. is going to be a local path. The only thing I can think is that your base_path (the root dir that contains the roles/, cookbooks/, etc. directories) is being set wrong. base_path is the https://github.com/jkeiser/knife-essentials/blob/master/lib/chef_fs/knife.rb#L16. The cookbook_path is grabbed from the knife.rb file. Ooooh, does your knife.rb file have a cookbook_path? Where is your knife.rb file located?
I also know that upload and download don't support .rb files (they expect .json format--if you knife download you should get the files). I'm going to need to add that if that's a thing people are doing :)
Hey, do you think you could paste your knife.rb (minus anything you consider sensitive :) and let me know where in the filesystem it is located? I am guessing the ../../../.. has to do with the cookbook_path being detected wrong. Thanks :)
I have made a number of changes related to cookbook paths in the latest version of knife-essentials; these may solve the problem you are having. cookbook_path now supports multiple paths, and you can directly specify chef_repo_path in your knife.rb if it's in a different place than cookbook_path. If you get a chance, could you please check (and reopen if it's still failing)? I'd appreciate it. Thanks!
As a chef and knife-essentials newbie, I expected
to produce empty output when I'd successfully uploaded everything. I can imagine why it does what it does, but I think the DWIM rule should apply here...