Git Product home page Git Product logo

knife-solo's Introduction

knife-solo's People

Contributors

a2ikm avatar aaronjensen avatar alexsiri7 avatar amoslanka avatar aried3r avatar bivab avatar cgunther avatar deepak avatar dqneo avatar hectcastro avatar hirose31 avatar hoffi avatar iavael avatar iidatomohiko avatar makern avatar matschaffer avatar olegps avatar retr0h avatar rosstimson avatar russellcardullo avatar searlm avatar smdern avatar teyrow avatar thbar avatar tknerr avatar tmatilai avatar vjpr avatar xtoddx avatar yozlet avatar yugui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

knife-solo's Issues

Move node json creation to cook command

Rather than creating a node on prepare only, we should create an empty node runlist on cook to avoid having to run an extra step following a knife bootstrap.

Chef dependency version constraint

Opscode is changing the versioning scheme for their gems to utilize the X in X.Y.Z. I modified mine with the >= operator. Not sure if this is what you eventually want for knife-solo.

Use ssh-agent if possible

If you have a private key that requires a password then it is a PITA to use knife-solo as you have to enter you password quite a lot.

I got around this by creating a new key set just for use with my chef user.

Use node syncing using rsync (instead of uploading)

I don't actually know what this means, but I saw it on http://groups.google.com/group/littlechef/browse_thread/thread/82a1838e5f479d15 and it sounded good:

Syncing

As the kitchen repository kept growing with many cookbooks and nodes,
uploading all files on every run was getting a bit slow. Markus
implemented node syncing using rsync (instead of uploading), which
speeds up things massively from the second run on.

How do configure rsync to "sync" instead of "upload"? And why would that be faster?

Should we at least add a --compress option? Would that speed it up at all?

Debian 6.0/Ubuntu 12.04: no curl, only wget by default

A default minimal install of Debian 6.0 squeeze does not come with curl, only wget is available:

knife prepare root@debian-host -V fails without providing a useful output. I had to do -VV to see:

DEBUG: `sudo` not available on app100
DEBUG: Running processed command uname -s
DEBUG: uname -s stdout: Linux

DEBUG: Initial command cat /etc/issue
DEBUG: Running processed command cat /etc/issue
DEBUG: cat /etc/issue stdout: Debian GNU/Linux 6.0 \n \l


DEBUG: Distro detection yielded: {:type=>"omnibus", :version=>"squeeze"}
DEBUG: Initial command curl -LO http://opscode.com/chef/install.sh
DEBUG: Running processed command curl -LO http://opscode.com/chef/install.sh
DEBUG: curl -LO http://opscode.com/chef/install.sh stdout: bash: curl: command not found

DEBUG: Initial command sudo bash install.sh
DEBUG: Running processed command  bash install.sh
DEBUG:  bash install.sh stdout: bash: install.sh: No such file or directory

I think this problem was introduced with the following commit:

7186c93

Mention knife-solo_data_bag gem in the docs

knife-solo_data_bag should handle any data bag related stuff but we should update the docs to tell people how to do that.

(original report)

I've been working on a similar project lately, then I saw yours and I'm evaluating to switch and possibly contribute to it. The main difference I see is the lack of a built-in utility to manipulate encrypted data bags (encrypt and decrypt them). If there's any plan for this feature to be introduced, I may provide a possible solution in a pull request.

My idea is basically to assume an encryption key file to be present in root or data_bags folder, and encrypt any *.rb file in data_bags folder to the corresponding json file (and vice versa for decryption).

What do you think about it?

Windows (Client) Compatibility

I'm using knife-solo on a windows box (but bootstrapping an Ubuntu VM).

knife kitchen foo works as expected
knife prepare user@host also works

but then

knife cook user@host fails with

D:\kitchens\foobar>knife cook [email protected] -P vagrant -VV
Checking cookbook syntax...
The system cannot find the path specified.
W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/knife-solo-0.0.13/lib/chef/knife/cook.rb:63:in `block in check_syntax': Syntax error in cookbooks/apache2/attributes/default.rb (RuntimeError)
        from W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/knife-solo-0.0.13/lib/chef/knife/cook.rb:61:in `each'
        from W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/knife-solo-0.0.13/lib/chef/knife/cook.rb:61:in `check_syntax'
        from W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/knife-solo-0.0.13/lib/chef/knife/cook.rb:50:in `run'
        from W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/knife.rb:402:in `run_with_pretty_exceptions'
        from W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/knife.rb:168:in `run'
        from W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/knife.rb:123:in `run'
        from W:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/bin/knife:25:in `<top (required)>'
        from W:/tools/vagrant/vagrant/vagrant/embedded/bin/knife:19:in `load'
        from W:/tools/vagrant/vagrant/vagrant/embedded/bin/knife:19:in `<main>'

Prepare not finishing (Ubuntu, Lucid)

Hi,

I'm running on a dedicated box, using XEN to run my own VPS's and I install bare minimum lucid distro's. I have been using knife prepare with great success when I used Vagrant locally for testing. But now that I'm attempting to deploy to production, running knife prepare on this box doesn't seem to do much.

It's a very minimalistic install of lucid so it doesn't even include wget or curl by default. But, i'm not sure why it just stops progressing at some point. Here is the command run with -VV.

Sudoers path: /etc/sudoers
Authentication methods: 'pam'
Syslog facility if syslog is being used for logging: authpriv
Syslog priority to use when user authenticates successfully: notice
Syslog priority to use when user authenticates unsuccessfully: alert
Send mail if the user is not in sudoers
Use a separate timestamp for each user/tty combo
Lecture user the first time they run sudo
Require users to authenticate by default
Root may run sudo
Allow some information gathering to give useful error messages
Require fully-qualified hostnames in the sudoers file
Visudo will honor the EDITOR environment variable
Set the LOGNAME and USER environment variables
Length at which to wrap log file lines (0 for no wrap): 80
Authentication timestamp timeout: 15 minutes
Password prompt timeout: 0 minutes
Number of tries to enter a password: 3
Umask to use or 0777 to use user's: 022
Path to mail program: /usr/sbin/sendmail
Flags for mail program: -t
Address to send mail to: root
Subject line for mail messages: *** SECURITY information for %h ***
Incorrect password message: Sorry, try again.
Path to authentication timestamp dir: /var/run/sudo
Default password prompt: [sudo] password for %p: 
Default user to run commands as: root
Value to override user's $PATH with: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
Path to the editor for use by visudo: /usr/bin/editor
When to require a password for 'list' pseudocommand: any
When to require a password for 'verify' pseudocommand: all
File containing dummy exec functions: /usr/lib/sudo/sudo_noexec.so
File descriptors >= 3 will be closed before executing a command
Reset the environment to a default set of variables
Environment variables to check for sanity:
    TERM
    LINGUAS
    LC_*
    LANGUAGE
    LANG
    COLORTERM
Environment variables to remove:
    RUBYOPT
    RUBYLIB
    PYTHONINSPECT
    PYTHONPATH
    PYTHONHOME
    TMPPREFIX
    ZDOTDIR
    READNULLCMD
    NULLCMD
    FPATH
    PERL5DB
    PERL5OPT
    PERL5LIB
    PERLLIB
    PERLIO_DEBUG 
    JAVA_TOOL_OPTIONS
    SHELLOPTS
    GLOBIGNORE
    PS4
    BASH_ENV
    ENV
    TERMCAP
    TERMPATH
    TERMINFO_DIRS
    TERMINFO
    _RLD*
    LD_*
    PATH_LOCALE
    NLSPATH
    HOSTALIASES
    RES_OPTIONS
    LOCALDOMAIN
    PS4
    SHELLOPTS
    CDPATH
    IFS
Environment variables to preserve:
    XAUTHORIZATION
    XAUTHORITY
    TZ
    PS2
    PS1
    PATH
    MAIL
    LS_COLORS
    KRB5CCNAME
    HOSTNAME
    HOME
    DISPLAY
    COLORS
Locale to use while parsing sudoers: C
Local IP address and netmask pairs:
    xxxxxxxxxxxx / 255.255.255.0
    fe80::216:3eff:fe21:c132 / ffff:ffff:ffff:ffff::

DEBUG: Running processed command uname -s
DEBUG: uname -s stdout: Linux

DEBUG: Initial command cat /etc/issue
DEBUG: Running processed command cat /etc/issue
DEBUG: cat /etc/issue stdout: Ubuntu 10.04.4 LTS \n \l


DEBUG: Initial command lsb_release -cs
DEBUG: Running processed command lsb_release -cs
DEBUG: lsb_release -cs stdout: lucid

DEBUG: Distro detection yielded: typeubuntu_omnibusversionlucid
DEBUG: Initial command wget http://opscode.com/chef/install.sh
DEBUG: Running processed command wget http://opscode.com/chef/install.sh
DEBUG: wget http://opscode.com/chef/install.sh stdout: --2012-06-27 04:49:33--  http://opscode.com/chef/install.sh
Resolving opscode.com... 
DEBUG: wget http://opscode.com/chef/install.sh stdout: 184.106.28.83
Connecting to opscode.com|184.106.28.83|:80... 
DEBUG: wget http://opscode.com/chef/install.sh stdout: connected.
HTTP request sent, awaiting response... 
DEBUG: wget http://opscode.com/chef/install.sh stdout: 301 Moved Permanently
Location: http://www.opscode.com/chef/install.sh [following]
--2012-06-27 04:49:33--  http://www.opscode.com/chef/install.sh
Resolving www.opscode.com... 
DEBUG: wget http://opscode.com/chef/install.sh stdout: 184.106.28.83
Reusing existing connection to opscode.com:80.
HTTP request sent, awaiting response... 
DEBUG: wget http://opscode.com/chef/install.sh stdout: 301 Moved Permanently
Location: http://s3.amazonaws.com/opscode-full-stack/install.sh [following]
--2012-06-27 04:49:34--  http://s3.amazonaws.com/opscode-full-stack/install.sh
Resolving s3.amazonaws.com... 207.171.163.161
Connecting to s3.amazonaws.com|207.171.163.161|:80... 
DEBUG: wget http://opscode.com/chef/install.sh stdout: connected.
HTTP request sent, awaiting response... 
DEBUG: wget http://opscode.com/chef/install.sh stdout: 200 OK
Length: 5204 (5.1K) []
Saving to: `install.sh.3'

 0% [                                       ] 0           --.-K/s              
100%[======================================>] 5,204       --.-K/s   in 0.1s    

2012-06-27 04:49:34 (51.3 KB/s) - `install.sh.3' saved [5204/5204]


DEBUG: Initial command sudo bash install.sh
DEBUG: Running processed command sudo -p 'knife sudo password: ' bash install.sh
DEBUG: sudo -p 'knife sudo password: ' bash install.sh stdout: Downloading Chef 10.12.0-1 for ubuntu...

DEBUG: sudo -p 'knife sudo password: ' bash install.sh stdout: --2012-06-27 04:49:34--  http://s3.amazonaws.com/opscode-full-stack/ubuntu-10.04-x86_64/chef-full_10.12.0-1_amd64.deb
Resolving s3.amazonaws.com... 207.171.163.161
Connecting to s3.amazonaws.com|207.171.163.161|:80... 
DEBUG: sudo -p 'knife sudo password: ' bash install.sh stdout: connected.
HTTP request sent, awaiting response... 
DEBUG: sudo -p 'knife sudo password: ' bash install.sh stdout: 200 OK
Length: 18050120 (17M) [application/x-debian-package]
Saving to: `/tmp/chef-full_10.12.0-1_amd64.deb'

 0% [                                       ] 0           --.-K/s              
 0% [                                       ] 44,868       148K/s              
 0% [                                       ] 147,068      242K/s              
 2% [                                       ] 423,008      521K/s              
 5% [>                                      ] 916,488      824K/s              
11% [===>                                   ] 2,009,540   1.49M/s              
24% [========>                              ] 4,463,312   2.86M/s              
44% [================>                      ] 8,104,792   4.58M/s              
62% [=======================>               ] 11,323,068  5.72M/s              
81% [==============================>        ] 14,764,748  6.74M/s              
100%[======================================>] 18,050,120  7.12M/s   in 2.4s    

2012-06-27 04:49:37 (7.12 MB/s) - `/tmp/chef-full_10.12.0-1_amd64.deb' saved [18050120/18050120]


DEBUG: sudo -p 'knife sudo password: ' bash install.sh stdout: Installing Chef 10.12.0-1

(Reading database ... 80%o password: ' bash install.sh stdout: (Reading database ... 
(Reading database ... 39383 files and directories currently installed.)

DEBUG: sudo -p 'knife sudo password: ' bash install.sh stdout: Preparing to replace chef 10.12.0-1.ubuntu.10.04 (using .../chef-full_10.12.0-1_amd64.deb) ...

DEBUG: sudo -p 'knife sudo password: ' bash install.sh stdout: Unpacking replacement chef ...

DEBUG: sudo -p 'knife sudo password: ' bash install.sh stdout: Setting up chef (10.12.0-1.ubuntu.10.04) ...

DEBUG: sudo -p 'knife sudo password: ' bash install.sh stdout: Thank you for installing Chef!


DEBUG: Initial command sudo apt-get update
DEBUG: Running processed command sudo -p 'knife sudo password: ' apt-get update
0% [Working]-p 'knife sudo password: ' apt-get update stdout: 
Get:1 http://security.ubuntu.com lucid-security Release.gpg [198B]
Get:2 http://archive.ubuntu.com lucid Release.gpg [189B]
Get:3 http://archive.ubuntu.com lucid-updates Release.gpg [198B]
99% [Waiting for headers]                           
Get:4 http://security.ubuntu.com lucid-security Release [57.3kB]
1% [Waiting for headers] [4 Release 0B/57.3kB 0%]
Get:5 http://archive.ubuntu.com lucid Release [57.2kB]stdout: 
5% [5 Release 0B/57.2kB 0%] [4 Release 5428B/57.3kB 9%]
99% [5 Release gpgv 57.2kB] [Waiting for headers] [Waiting for headers]
Get:6 http://archive.ubuntu.com lucid-updates Release [57.3kB]         
66% [6 Release 0B/57.3kB 0%] [Waiting for headers]
Get:7 http://security.ubuntu.com lucid-security/main Packages [421kB]
23% [6 Release 27.2kB/57.3kB 47%] [7 Packages 0B/421kB 0%]
38% [6 Release gpgv 57.3kB] [Waiting for headers] [7 Packages 54.6kB/421kB 12%]
41% [Waiting for headers] [7 Packages 72.5kB/421kB 17%]                        
Get:8 http://archive.ubuntu.com lucid/main Packages [1383kB]: 
13% [8 Packages 0B/1383kB 0%] [7 Packages 90.8kB/421kB 21%]
47% [7 Packages bzip2 0B] [8 Packages 350kB/1383kB 25%] [Waiting for headers]
Get:9 http://security.ubuntu.com lucid-security/restricted Packages [2840B]  
Get:10 http://security.ubuntu.com lucid-security/universe Packages [147kB]     
47% [7 Packages bzip2 0B] [8 Packages 414kB/1383kB 29%] [10 Packages 0B/147kB 0
Get:11 http://security.ubuntu.com lucid-security/main Sources [124kB]          
59% [7 Packages bzip2 893kB] [8 Packages 605kB/1383kB 43%] [11 Sources 0B/124kB
Get:12 http://security.ubuntu.com lucid-security/restricted Sources [1259B]    
Get:13 http://security.ubuntu.com lucid-security/universe Sources [40.8kB]     
70% [7 Packages bzip2 1364kB] [8 Packages 718kB/1383kB 51%]                    
Get:14 http://archive.ubuntu.com lucid/restricted Packages [6193B]
Get:15 http://archive.ubuntu.com lucid/universe Packages [5430kB]
29% [7 Packages bzip2 2757kB] [15 Packages 0B/5430kB 0%]
35% [10 Packages bzip2 0B] [15 Packages 453kB/5430kB 8%]dout: 
48% [11 Sources bzip2 0B] [15 Packages 1461kB/5430kB 26%]out: 
73% [13 Sources bzip2 0B] [15 Packages 3408kB/5430kB 62%]out: 
79% [8 Packages bzip2 0B] [15 Packages 3856kB/5430kB 71%]out: 
Get:16 http://archive.ubuntu.com lucid/multiverse Packages [176kB]
Get:17 http://archive.ubuntu.com lucid/main Sources [659kB]
92% [8 Packages bzip2 319kB] [17 Sources 0B/659kB 0%]
Get:18 http://archive.ubuntu.com lucid/restricted Sources [3775B]
Get:19 http://archive.ubuntu.com lucid/universe Sources [3165kB]
73% [8 Packages bzip2 733kB] [19 Sources 0B/3165kB 0%]
Get:20 http://archive.ubuntu.com lucid-updates/main Packages [617kB]
Get:21 http://archive.ubuntu.com lucid-updates/restricted Packages [4638B]
Get:22 http://archive.ubuntu.com lucid-updates/universe Packages [287kB]
Get:23 http://archive.ubuntu.com lucid-updates/multiverse Packages [11.5kB]
Get:24 http://archive.ubuntu.com lucid-updates/main Sources [223kB]
98% [8 Packages bzip2 2056kB] [24 Sources 0B/223kB 0%]
Get:25 http://archive.ubuntu.com lucid-updates/restricted Sources [2194B]
Get:26 http://archive.ubuntu.com lucid-updates/universe Sources [101kB]
99% [8 Packages bzip2 2220kB]                         
99% [15 Packages bzip2 0B]   ssword: ' apt-get update stdout: 
99% [15 Packages bzip2 10.9MB]sword: ' apt-get update stdout: 
99% [15 Packages bzip2 22.5MB]sword: ' apt-get update stdout: 
99% [16 Packages bzip2 0B]    sword: ' apt-get update stdout: 
99% [17 Sources bzip2 0B]  password: ' apt-get update stdout: 
99% [19 Sources bzip2 0B]o password: ' apt-get update stdout: 
99% [19 Sources bzip2 10.5MB]ssword: ' apt-get update stdout: 
99% [20 Packages bzip2 0B]   ssword: ' apt-get update stdout: 
99% [22 Packages bzip2 0B] password: ' apt-get update stdout: 
99% [23 Packages bzip2 0B] password: ' apt-get update stdout: 
99% [24 Sources bzip2 0B]  password: ' apt-get update stdout: 
99% [26 Sources bzip2 0B]o password: ' apt-get update stdout: 
Fetched 13.0MB in 3s (3765kB/s)word: ' apt-get update stdout: 
Reading package lists... 0%
Reading package lists... 1%password: ' apt-get update stdout: 
Reading package lists... 18%assword: ' apt-get update stdout: 
Reading package lists... 74%assword: ' apt-get update stdout: 
Reading package lists... 76%assword: ' apt-get update stdout: 
Reading package lists... 86%assword: ' apt-get update stdout: 
Reading package lists... 90%assword: ' apt-get update stdout: 
Reading package lists... 97%assword: ' apt-get update stdout: 
Reading package lists... 99%assword: ' apt-get update stdout: 
Reading package lists... Donessword: ' apt-get update stdout: 

DEBUG: Initial command sudo apt-get install rsync
DEBUG: Running processed command sudo -p 'knife sudo password: ' apt-get install rsync
Reading package lists... Donessword: ' apt-get install rsync stdout: 

Building dependency tree... 0%sword: ' apt-get install rsync stdout: 
Building dependency tree... 50%word: ' apt-get install rsync stdout: 
Building dependency tree       word: ' apt-get install rsync stdout: 
Reading state information... Done

DEBUG: sudo -p 'knife sudo password: ' apt-get install rsync stdout: rsync is already the newest version.

DEBUG: sudo -p 'knife sudo password: ' apt-get install rsync stdout: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Note that I tried to install RVM after this but decided it probably wouldn't be a good idea since I'm pretty sure Chef will use be using sudo and ignore it anyway. In any case, before and after RVM was installed, it keeps quitting after the "rsync" thing, but ruby wasn't installed. I also had to manually apt-get install wget curl since it hung there as well. rsync is installed however. Any ideas why it doesn't finish the entire process?

Cheers

Chef output garbled?

While cooking a Windows node:

  • the chef output is wrapping at 80 characters even if the terminal width is much larger
  • to be verified: some lines are dropped out of the output (unsure)

Cover node search in integration testing

Right now integration testing is just a basic prepare and no-recipe cook. We should also include a test recipe in the test. Ideally something that exercises the node search patch.

'knife kitchen kitchen' fails (can't name your kitchen "kitchen")

Here's the backtrace:

/home/tyler/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:1508:in `path': can't convert nil into String (TypeError)
    from /home/tyler/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:1508:in `block in fu_list'
    from /home/tyler/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:1508:in `map'
    from /home/tyler/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:1508:in `fu_list'
    from /home/tyler/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:171:in `mkdir'
    from /home/tyler/.rvm/gems/ruby-1.9.3-p0@deployment/gems/knife-solo-0.0.8/lib/chef/knife/kitchen.rb:12:in `run'
    from /home/tyler/.rvm/gems/ruby-1.9.3-p0@deployment/gems/chef-0.10.8/lib/chef/knife.rb:392:in `run_with_pretty_exceptions'
    from /home/tyler/.rvm/gems/ruby-1.9.3-p0@deployment/gems/chef-0.10.8/lib/chef/knife.rb:167:in `run'
    from /home/tyler/.rvm/gems/ruby-1.9.3-p0@deployment/gems/chef-0.10.8/lib/chef/application/knife.rb:128:in `run'
    from /home/tyler/.rvm/gems/ruby-1.9.3-p0@deployment/gems/chef-0.10.8/bin/knife:25:in `<top (required)>'
    from /home/tyler/.rvm/gems/ruby-1.9.3-p0@deployment/bin/knife:19:in `load'
    from /home/tyler/.rvm/gems/ruby-1.9.3-p0@deployment/bin/knife:19:in `<main>'

Should be an easy fix, I'd guess :)

Fail-fast system calls

Currently most of the code calls "system" to launch command, but doesn't check for exit code.

It would be better to check the result and stop straight away, unless it's safe to continue.

(this made debugging Windows support harder, for instance).

What do you think? I can prepare a patch on this.

knife prepare command broken in 0.0.9 when used with Vagrant

I've just started learning Chef and have found this gem invaluable, thanks.

However I upgraded to the latest gem 0.0.9 and can no longer use the knife prepare command to setup my test VM which uses Vagrant.

My Vagrant VM is a minimal Debian Squeeze amd64 box which does not have ruby installed so that I can use knife prepare to set everything up. I have tried both the host-only network IP and the bridged network options within Vagrant, examples from Vagrantfile below:

# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
# any other machines on the same network, but cannot be accessed (through this
# network interface) by any external networks.
# config.vm.network :hostonly, "192.168.33.10"

# Assign this VM to a bridged network, allowing you to connect directly to a
# network using the host's network device. This makes the VM appear as another
# physical device on your network.
config.vm.network :bridged

When I run knife prepare [email protected] I get asked for the password then there is no output at all until it finally falls back to my prompt. When I vagrant ssh into the box to check it over nothing has been installed.

I had been running fine prior to the gem update so I tried creating a Gemfile in my 'kitchen' to specify the 0.0.8 version then used bundle install and bundle exec to explicitly use the older 0.0.8 version and everything works fine again. Therefore I can only assume that the latest gem has changed something that causes an issue with the knife prepare command.

I'm afraid I can only test this with Vagrant VMs at the moment; I'm also not sure how else I can provide you with further details on this - I'm not being given any obvious errors at all, it just fails to do anything.

PS I'm on OSX Lion 10.7.4, Ruby 1.9.3p194 (RVM 1.13.0), Rubygems 1.8.23.

Include option for setting host name

Since host name is usually important for a given host, we should probably include a command or switch to set the host name while preparing the box.

Since this varies per distro the prepare command already has the switching it would need.

Ruby 1.9 support

Is there any way we can get Ruby 1.9+ bootstrap support in the future? I would love to use knife-solo but I would like to have chef-solo to be on a 1.9 installation so I can use the new hash syntax.

Cook saying it needs a prepare after already run

I am trying to cook an instance and I am getting the following error:

RuntimeError: The chef gem on [server] is out of date. Please run /usr/local/bin/knife prepare user@[server] to upgrade Chef to ~>0.10.4

The version of chef on my local machine is 0.10.8 and on the instance it is 0.10.12

Could there be a string compare on the version or something of the sort that is causing 12 not to be recognized as > 4?

Thanks!

Allow the bootstrap script to be customized/overridden

It would be nice if you could customize the bootstrap script, similar to how the knife command lets you (http://wiki.opscode.com/display/chef/Knife+Bootstrap).

For example, http://www.agileweboperations.com/chef-rvm-ruby-enterprise-edition-as-default-ruby provides a custom bootstrap that installs Ruby REE via RVM:

$ knife bootstrap www.example.com -t bootstrap/ubuntu10.04-rvm-ree.erb

But knife bootstrap doesn't really work with chef-solo (from what I can tell). Which is why I'd like knife-solo to provide a similar feature. :)

Specifically, what I would like my bootstrap script to do is to install rvm (multi-user install) and then install the latest ruby (1.9.3-p0 last I checked) using rvm.

I certainly don't want ruby 1.8 installed on my brand-new server, which is what knife prepare currently will do... :(

'prepare' task for windows

I'm getting ready to create a prepare task for windows, using Chef MSI installer.

It will require a bit of refactoring as unlike darwin/linux, this one is completely different.

Avoid OutOfKitchen error if git loses directories

I'm checking for the full directory structure right now which may be silly. Should probably just look for solo.rb and consider that enough. Or alternately include .gitkeep files so dirs don't disappear.

Try out encrypted data bags

Neither @matschaffer nor me did more extensive tests with those but they may work and it's certainly interesting to dive in.

If you happen to try that out, let us know!

Upload cookbooks to secure location

In order to keep my cookbooks more secure
As a developer
I want my cookbooks to be uploaded to a non-world-readable location


Right now since we upload using rsync potentially as a non-privileged user we put all cookbooks in /tmp/chef-solo. Ideally we should be writing these to /var/chef or something more secure, but we'll need to figure out how to get rsync doing that. See https://github.com/matschaffer/knife-solo/blob/master/lib/chef/knife/cook.rb#L67 for rsync stuff.

Unable to activate knife-solo-0.0.8, because net-ssh-2.2.2 conflicts with net-ssh (~> 2.1.3) (Gem::LoadError)

When I updated chef to 0.10.10 and run knife, I get the following error:

/Users/jravetch/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in raise_if_conflicts': Unable to activate knife-solo-0.0.8, because net-ssh-2.2.2 conflicts with net-ssh (~> 2.1.3) (Gem::LoadError) from /Users/jravetch/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:inactivate'
from /Users/jravetch/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:212:in rescue in try_activate' from /Users/jravetch/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:209:intry_activate'
from /Users/jravetch/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in rescue in require' from /Users/jravetch/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:inrequire'
from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/knife-solo-0.0.8/lib/chef/knife/cook.rb:6:in <top (required)>' from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/lib/chef/knife/core/subcommand_loader.rb:37:inload'
from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/lib/chef/knife/core/subcommand_loader.rb:37:in block in load_commands' from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/lib/chef/knife/core/subcommand_loader.rb:37:ineach'
from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/lib/chef/knife/core/subcommand_loader.rb:37:in load_commands' from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/lib/chef/knife.rb:114:inload_commands'
from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/lib/chef/knife.rb:134:in list_commands' from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/lib/chef/application/knife.rb:179:inprint_help_and_exit'
from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/lib/chef/application/knife.rb:143:in validate_and_parse_options' from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/lib/chef/application/knife.rb:121:inrun'
from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/gems/chef-0.10.10/bin/knife:25:in <top (required)>' from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/bin/knife:23:inload'
from /Users/jravetch/.rvm/gems/ruby-1.9.3-p194/bin/knife:23:in `

'

Knife-Solo is too slow

Running time knife cook --skip-syntax-check --sync-only --skip-chef-check and timing all the rsync commands this is what I get:

Rsyncing kitchen

building file list ... done
deleting site-cookbooks/chef_solo_patches/libraries/search_patch.rb
deleting site-cookbooks/chef_solo_patches/libraries/parser.rb
deleting site-cookbooks/chef_solo_patches/libraries/
deleting site-cookbooks/chef_solo_patches/
deleting site-cookbooks/

sent 2085 bytes  received 20 bytes  382.73 bytes/sec
total size is 87930  speedup is 41.77

real    0m5.160s
user    0m0.009s
sys 0m0.006s
Adding patches
building file list ... done
parser.rb

sent 5254 bytes  received 42 bytes  962.91 bytes/sec
total size is 5164  speedup is 0.98

real    0m4.705s
user    0m0.008s
sys 0m0.005s
building file list ... done
search_patch.rb

sent 2638 bytes  received 42 bytes  595.56 bytes/sec
total size is 2542  speedup is 0.95

real    0m4.539s
user    0m0.008s
sys 0m0.005s

real    0m40.439s
user    0m1.821s
sys 0m0.304s

Is this unusual?

I'm working with EC2. Opening a SSH session takes about 5 seconds every time.

However, SCP transfer of my compressed repo is instantaneous.

40 seconds per change is unworkable for me.

deployment user unable to rsync after sudo/root has downloaded files into /tmp/chef-solo

Everything works fine cooking https://github.com/RiotGames/rbenv-cookbook with a non-root-user.

But a 2nd "cook"-cmd brings up the following errors:
rsync: delete_file: unlink(ruby-build/share/ruby-build/ree-1.8.7-2012.02) failed: Permission denied (13)
[...]
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
ERROR: RuntimeError: Failed to launch command rsync -rl --rsh="ssh user@ip" --delete --exclude revision-deploys --exclude tmp --exclude '.*' ./ :/tmp/chef-solo
s

Should there be a "chown user /tmp/solo" at the end of cooking? Can I do this myself?

Thx

rsync and file_cache_path

(updated description)

If you specify a custom file_cache_path inside a local solo.rb so that the data is not stored under /tmp, this directory will not be created automatically and knife-solor cook runs into an exception:

➜  chef git:(master) ✗ knife cook root@web100
Checking cookbook syntax...
rsync: mkdir "/root/chef/chef-solo" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(605) [Receiver=3.0.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
ERROR: RuntimeError: Failed to launch command rsync -rl --rsh="ssh root@web100" --delete --exclude revision-deploys --exclude tmp --exclude '.*'  ./ :/root/chef/chef-solo

custom solo.rb

file_cache_path "/root/chef/chef-solo"
data_bag_path   "/root/chef/chef-solo/data_bags"
cookbook_path   [ "/root/chef/chef-solo/site-cookbooks",
                  "/root/chef/chef-solo/cookbooks" ]
role_path       "/root/chef/chef-solo/roles"

EC2 integration tests fail if EC2 default security group doesn't allow incoming 22 & 80

After cloning the project, running sudo /scripts/newb and amending the test/support/config.yml file, running the integration tests fails as follows.

mrdavidlaing@commander:~/Projects/knife-solo$ rake test:integration
Run options: --seed 15097

# Running tests:

WARNING: No knife configuration file found
.E

Finished tests in 843.955595s, 0.0130 tests/s, 0.0225 assertions/s.

  1) Error:
test_apache2(Centos5_6Test):
Errno::ETIMEDOUT: Connection timed out - connect(2)
    /usr/lib/ruby/1.9.1/net/http.rb:762:in `initialize'
    /usr/lib/ruby/1.9.1/net/http.rb:762:in `open'
    /usr/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
    /usr/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
    /usr/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
    /usr/lib/ruby/1.9.1/net/http.rb:762:in `connect'
    /usr/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
    /usr/lib/ruby/1.9.1/net/http.rb:744:in `start'
    /usr/lib/ruby/1.9.1/net/http.rb:454:in `get_response'
    /usr/lib/ruby/1.9.1/net/http.rb:431:in `get'
    /home/mrdavidlaing/Projects/knife-solo/test/integration/cases/apache2_cook.rb:14:in `http_response'
    /home/mrdavidlaing/Projects/knife-solo/test/integration/cases/apache2_cook.rb:26:in `test_apache2'
    /usr/lib/ruby/gems/1.9.1/gems/mocha-0.11.4/lib/mocha/integration/mini_test/version_230_to_262.rb:28:in `run'

...snip...

11 tests, 19 assertions, 0 failures, 3 errors, 0 skips
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.9.1 -I"lib:test" -I"/usr/li...]

Integration test Yum install

In order to keep knife-solo more stable on CentOS and Scientific Linux
As a developer
I want a yum integration test


Base integration testing is in place. Needs to be cleaned up and probably turned into proper tests.

Sync only the cookbooks used on the target node

In $HOME/.chef/knife.rb you can specify cookbook_path. What would be ideal would be it would only transfer those cookbooks which recipes we depend on. First we look in the local repository, then we look into the user defined cookbook_path then the global cookbook_path if one exists.

cookbooks = json[:run_list].map{ |r| r.gsub(/recipe\[(\w+)(-(\d|\.)+)?(:{2}(\w+))*\]/, "\\1") }

cookbooks.map! { |c| File.join(Chef::Config.cookbook_path, c) }

Then somehow include those in with the rsync command.

knife kitchen - current directory option

It would be nice to be able use the knife kitchen command to setup the current directory rather than being forced into passing a name to setup a new directory.

Upgrade json gem dependency

It would be really helpful if you could support 1.6.6. of the json gem in the dependencies. I'm having problems getting my gem bundle to all agree. Thanks!

cook and prepare require sudo access on the host

All my recepies required a certain user to run on. While the user has sudo access, this created permissions problems with all my recepies. Sudo should really be optional since nothing else with chef requires sudo.

Check syntax is too broad

The chefignore support is nice, but ultimately Cook#chef_syntax is doing too much. We should really only be checking the syntax of the bits that chef uses (roles, cookbooks, databags, node json) rather than **/*.rb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.