[chef] Re: Re: Re: Re: Re: Knife bash completion - improved


Chronological Thread 
  • From: Ash Berlin < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: Knife bash completion - improved
  • Date: Thu, 20 Jan 2011 16:41:34 +0000

You don't need to use the -c option: knife looks for .chef/kinfe.rb in all directories up from the current one and stops when it finds one.

-ash


On 20 Jan 2011, at 16:10, Avishai Ish-Shalom wrote:
Great to hear you got it working on OSX.
You may be interested to know that I too am working with several chef servers. The problem is that bash_completion can not take into account the knife -c switch because it appears late on the command line. There are several work-arounds for this, the easiest would be
knife () {
    /absolute/path/to/knife $@ -c $CHEF_HOME/.chef/knife.rb
}
then set CHEF_HOME to a different directory when working with the other server. If, like me, you are constantly switching between chef servers it's convenient to set multiple knife functions, e.g.: server1_knife. This is what I do and it did require modifications to the script - revised version attached.
The revised version should work for regular knife as well, and feature data bag completion for bags and items.
Regards,
Avishai

On 01/20/2011 05:46 PM, Jacobo García wrote:
" type="cite">Hello,

Thanks for your script, it's great, specially for beginers on the chef CLI.

I tried your script in OS X too and the problems are related to differences between GNU sed and BSD sed. I just quick fixed them installing gsed with macports and changing sed references to gsed.

Also it's possible to have a knife config file per chef repository instead of ~/.chef/knife.rb. This way you can work over several chef servers. I am not sure how to fix that in the script but probably there's some clues on knife code. I found the script crashing here too.

Greetings.




Archive powered by MHonArc 2.6.16.

§