Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fnichol/knife-server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.0
Choose a base ref
...
head repository: fnichol/knife-server
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jul 26, 2013

  1. Up version for development.

    fnichol committed Jul 26, 2013
    Copy the full SHA
    8b36539 View commit details

Commits on Aug 28, 2013

  1. enable ssh on firewall

    taylor committed Aug 28, 2013
    Copy the full SHA
    5553437 View commit details

Commits on Jan 9, 2014

  1. Merge pull request #43 from taylor/master

    enable ssh on firewall
    fnichol committed Jan 9, 2014
    Copy the full SHA
    a899070 View commit details

Commits on Aug 28, 2014

  1. Copy the full SHA
    57eb609 View commit details
  2. Copy the full SHA
    526431c View commit details

Commits on Aug 30, 2014

  1. Copy the full SHA
    a51987e View commit details

Commits on Sep 1, 2014

  1. 1
    Copy the full SHA
    f4705ac View commit details

Commits on Sep 2, 2014

  1. Copy the full SHA
    93c70fd View commit details

Commits on Sep 3, 2014

  1. Copy the full SHA
    c110492 View commit details
  2. Copy the full SHA
    b2520f4 View commit details
  3. Copy the full SHA
    60c68e8 View commit details

Commits on Sep 9, 2014

  1. Copy the full SHA
    d5479e6 View commit details
  2. Copy the full SHA
    f72f7ca View commit details

Commits on Sep 10, 2014

  1. Copy the full SHA
    9413b62 View commit details
  2. Copy the full SHA
    dcfb4a4 View commit details
  3. Copy the full SHA
    756cf01 View commit details
  4. Copy the full SHA
    b11a108 View commit details
  5. Shunt stderr/ioctl warnings to a tmp log file for knife configure.

    This error is thrown when piping the user password into the Knife
    plugin, which is the only way (currently) to do this non-interactively.
    fnichol committed Sep 10, 2014
    Copy the full SHA
    f6145bf View commit details
  6. Copy the full SHA
    7a7d701 View commit details

Commits on Sep 11, 2014

  1. Copy the full SHA
    2123b64 View commit details
  2. Add OpenStack support to knife-server command.

    This commit adds the support necessary to use all of the bootstrap
    commands against an OpenStack endpoint for launching new instances of
    Chef Server. It utilizes the knife-openstack plugin, similar to how
    Linode does, and adds the appropriate credentials.
    John Bellone authored and fnichol committed Sep 11, 2014
    Copy the full SHA
    2b088c4 View commit details
  3. Copy the full SHA
    4753971 View commit details
  4. Copy the full SHA
    1ffadb4 View commit details

Commits on Sep 12, 2014

  1. Re-use existing private user key for omnibus bootstraps.

    This means that if your Knife configuration already has a pem keyfile
    present, its public key will be uploaded to the new Chef Server.
    
    The result is that you can re-use your user pem key, much like how
    hosted or enterprise chef uses only one user key for all organizations.
    fnichol committed Sep 12, 2014
    Copy the full SHA
    acce3a3 View commit details
  2. Copy the full SHA
    85051ed View commit details
  3. Copy the full SHA
    a1faca4 View commit details
  4. Copy the full SHA
    1eeddd8 View commit details
  5. Validate that node_name & client_key are set when running plugins.

    This gives the user a hint that their local knife.rb is not currently
    set up enough (or correctly) and where to go for help (the project
    website).
    
    Closes #10
    Closes #9
    fnichol committed Sep 12, 2014
    Copy the full SHA
    f58d1b1 View commit details
  6. Copy the full SHA
    c6838ef View commit details
  7. Copy the full SHA
    a6c600f View commit details

Commits on Sep 13, 2014

  1. Copy the full SHA
    83d3bad View commit details
  2. Up version for development.

    fnichol committed Sep 13, 2014
    Copy the full SHA
    b6a5be7 View commit details
  3. Copy the full SHA
    7cd110b View commit details

Commits on Sep 15, 2014

  1. Add Digital Ocean support!

    fnichol committed Sep 15, 2014
    Copy the full SHA
    98327f6 View commit details
  2. Merge pull request #55 from fnichol/digital-ocean

    Add Digital Ocean support!
    fnichol committed Sep 15, 2014
    Copy the full SHA
    e13c8cc View commit details
  3. Copy the full SHA
    7365a83 View commit details
  4. Up version for development.

    fnichol committed Sep 15, 2014
    Copy the full SHA
    2b65bcf View commit details

Commits on Sep 23, 2014

  1. An Chef Server.

    fnichol committed Sep 23, 2014
    Copy the full SHA
    9c5c57a View commit details

Commits on Dec 3, 2014

  1. Copy the full SHA
    a1bfd7e View commit details
  2. Copy the full SHA
    d9a85b7 View commit details
  3. Copy the full SHA
    fcdeaf3 View commit details
  4. Drop CI testing for Ruby 1.9.3 & Chef 10.x.

    There are several dependencies for testing purposes that require more
    modern requirements:
    
    * knife-openstack requires Chef 11+
    * knife-digital_ocean requires Ruby 2.0+
    fnichol committed Dec 3, 2014
    Copy the full SHA
    cc1ca48 View commit details
  5. Upgrade to finstyle 1.3.0.

    fnichol committed Dec 3, 2014
    Copy the full SHA
    76c00fa View commit details
  6. Copy the full SHA
    9a112c7 View commit details
  7. Up version for development.

    fnichol committed Dec 3, 2014
    Copy the full SHA
    8b1bbae View commit details
Showing with 2,412 additions and 669 deletions.
  1. +1 −0 .cane
  2. +1 −0 .rspec
  3. +3 −0 .rubocop.yml
  4. +10 −8 .travis.yml
  5. +48 −1 CHANGELOG.md
  6. +8 −4 Gemfile
  7. +23 −0 Guardfile
  8. +74 −12 README.md
  9. +31 −10 Rakefile
  10. +19 −8 knife-server.gemspec
  11. +63 −10 lib/chef/knife/bootstrap/_omnibus.sh
  12. +2 −0 lib/chef/knife/bootstrap/chef10/rhel.erb
  13. +4 −1 lib/chef/knife/bootstrap/chef11/omnibus.erb
  14. +2 −0 lib/chef/knife/bootstrap/chef11/rhel.erb
  15. +24 −10 lib/chef/knife/server_backup.rb
  16. +68 −23 lib/chef/knife/server_bootstrap_base.rb
  17. +151 −0 lib/chef/knife/server_bootstrap_digitalocean.rb
  18. +33 −20 lib/chef/knife/server_bootstrap_ec2.rb
  19. +20 −13 lib/chef/knife/server_bootstrap_linode.rb
  20. +136 −0 lib/chef/knife/server_bootstrap_openstack.rb
  21. +28 −16 lib/chef/knife/server_bootstrap_standalone.rb
  22. +23 −9 lib/chef/knife/server_restore.rb
  23. +1 −0 lib/knife-server.rb
  24. +78 −42 lib/knife/server/credentials.rb
  25. +24 −21 lib/knife/server/ec2_security_group.rb
  26. +54 −18 lib/knife/server/ssh.rb
  27. +2 −1 lib/knife/server/version.rb
  28. +58 −44 spec/chef/knife/server_backup_spec.rb
  29. +303 −0 spec/chef/knife/server_bootstrap_digitalocean_spec.rb
  30. +108 −80 spec/chef/knife/server_bootstrap_ec2_spec.rb
  31. +93 −64 spec/chef/knife/server_bootstrap_linode_spec.rb
  32. +306 −0 spec/chef/knife/server_bootstrap_openstack_spec.rb
  33. +113 −76 spec/chef/knife/server_bootstrap_standalone_spec.rb
  34. +38 −37 spec/chef/knife/server_restore_spec.rb
  35. +248 −51 spec/knife/server/credientials_spec.rb
  36. +76 −68 spec/knife/server/ec2_security_group_spec.rb
  37. +138 −22 spec/knife/server/ssh_spec.rb
1 change: 1 addition & 0 deletions .cane
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--abc-exclude Knife::Server::SSH#exec_ssh
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--color
--format documentation
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Style/FileName:
Exclude:
- lib/knife-server.rb
18 changes: 10 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
language: ruby

rvm:
- 1.9.3
- 2.0.0
- 1.9.2
- ruby-head
- 2.1
- 2.0.0
- ruby-head

env:
- "CHEF_VERSION=11.4.0"
- "CHEF_VERSION=10.24.0"
- "CHEF_VERSION=0.10.10"
- "CHEF_VERSION="
- "CHEF_VERSION='~> 11.14.2'"
- "CHEF_VERSION='~> 11.4.4'"

bundler_args: --without guard

matrix:
allow_failures:
- rvm: ruby-head
- rvm: ruby-head
49 changes: 48 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
## 1.4.0 / 2014-12-03

### Upstream changes

* Fix support for knife-openstack >= 1.0.0. ([@fnichol][])
* Fix support for knife-digtal_ocean >= 2.0.0. ([@fnichol][])


## 1.3.0 / 2014-09-14

### New features

* Pull request [#55][]: Add Digital Ocean support! ([@fnichol][])


## 1.2.0 / 2014-09-13

### Upstream changes

* Pull request [#48][], issue [#50][]: Fix issue affecting newer Knife/Chef versions dealing with nil default options. ([@dldinternet][], [@fnichol][])
* Patch specific versions of Chef to fix `knife configure` bug. ([@fnichol][])

### New features

* Pull request [#51][]: Add OpenStack support to knife-server command. ([@johnbellone][])
* Re-use existing private user key for omnibus bootstraps. ([@fnichol][])
* Add support for downloading packages from a URL using the `--url` flag. ([@fnichol][])

### Improvements

* Pull request [#43][]: Enable ssh on firewall. ([@taylor][])
* Add output when backing up and writing keys locally. ([@fnichol][])
* Issue [#28][]: Shunt stderr/ioctl warnings to a tmp log file for knife configure. ([@fnichol][])
* Issue [#9][], issue [#10][]: Validate that node_name & client_key are set when running plugins, giving the user a hint that their local knife.rb is not currently set up correctly. ([@fnichol][])
* Update download URL for Omnibus packages. ([@fnichol][])
* Update testing dependencies, upgrade to RSpec 3.x, freshen TravisCI build matrix, add style and complexity support. ([@fnichol][])


## 1.1.0 / 2013-07-26

### New features
@@ -161,18 +199,27 @@ The initial release.
[#11]: https://github.com/fnichol/knife-server/issues/11
[#13]: https://github.com/fnichol/knife-server/issues/13
[#15]: https://github.com/fnichol/knife-server/issues/15
[#28]: https://github.com/fnichol/knife-server/issues/28
[#29]: https://github.com/fnichol/knife-server/issues/29
[#34]: https://github.com/fnichol/knife-server/issues/34
[#35]: https://github.com/fnichol/knife-server/issues/35
[#41]: https://github.com/fnichol/knife-server/issues/41
[#42]: https://github.com/fnichol/knife-server/issues/42
[#43]: https://github.com/fnichol/knife-server/issues/43
[#48]: https://github.com/fnichol/knife-server/issues/48
[#50]: https://github.com/fnichol/knife-server/issues/50
[#51]: https://github.com/fnichol/knife-server/issues/51
[#55]: https://github.com/fnichol/knife-server/issues/55
[@danryan]: https://github.com/danryan
[@dldinternet]: https://github.com/dldinternet
[@erikh]: https://github.com/erikh
[@fnichol]: https://github.com/fnichol
[@iafonov]: https://github.com/iafonov
[@johnbellone]: https://github.com/johnbellone
[@jssjr]: https://github.com/jssjr
[@ranjib]: https://github.com/ranjib
[@sawanoboly]: https://github.com/sawanoboly
[@stormsilver]: https://github.com/stormsilver
[@taylor]: https://github.com/taylor
[@wpeterson]: https://github.com/wpeterson
[@xdissent]: https://github.com/xdissent
[@xdissent]: https://github.com/xdissent
12 changes: 8 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
source 'https://rubygems.org'
# -*- encoding: utf-8 -*-
source "https://rubygems.org"

# Specify your gem's dependencies in knife-server.gemspec
gemspec

group :test do
gem 'rake', '~> 0.9'
group :guard do
gem "guard-rspec"
gem "guard-rubocop"
end

group :test do
# allow CI to override the version of Chef for matrix testing
gem 'chef', (ENV['CHEF_VERSION'] || '>= 0.10.10')
gem "chef", (ENV["CHEF_VERSION"] || ">= 0.10.10")
end
23 changes: 23 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
ignore %r{^\.gem/}

def rspec_opts
{ :cmd => "bundle exec rspec" }
end

def rubocop_opts
{ :all_on_start => false, :keep_failed => false, :cli => "-r finstyle -D" }
end

group :red_green_refactor, :halt_on_fail => true do
guard :rspec, rspec_opts do
watch(%r{^spec/(.*)_spec\.rb})
watch(%r{^lib/(.*)([^/]+)\.rb}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^spec/spec_helper\.rb}) { "spec" }
end

guard :rubocop, rubocop_opts do
watch(%r{.+\.rb$})
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
end
86 changes: 74 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# <a name="title"></a> Knife::Server

[![Gem Version](https://badge.fury.io/rb/knife-server.svg)](http://badge.fury.io/rb/knife-server)
[![Build Status](https://secure.travis-ci.org/fnichol/knife-server.png?branch=master)](http://travis-ci.org/fnichol/knife-server)
[![Code Climate](https://codeclimate.com/github/fnichol/knife-server.png)](https://codeclimate.com/github/fnichol/knife-server)
[![Dependency Status](https://gemnasium.com/fnichol/knife-server.png)](https://gemnasium.com/fnichol/knife-server)

An Opscode Chef knife plugin to manage Chef Servers. Bootstrap a new Chef
Server on Amazon's EC2, Linode or a standalone server. Backup and restore
your Chef Server or Hosted Chef's node, role, data bag, and environment JSON
data.
A Chef Knife plugin to manage Chef Servers. Bootstrap a new Chef
Server on Amazon's EC2, Digital Ocean, Linode, OpenStack or a standalone server.
Backup and restore your Chef Server or Hosted Chef's node, role, data bag, and
environment JSON data.

## <a name="usage"></a> Usage

@@ -20,7 +22,7 @@ $ knife server bootstrap ec2 \
--aws-secret-access-key $AWS_SECRET_ACCESS_KEY \
--region us-east-1 \
--availability-zone us-east-1b \
--image ami-de0d9eb7 \
--image ami-d017b2b8 \
--ssh-user ubuntu \
--flavor m1.small \
--ssh-key id_rsa-aws \
@@ -37,6 +39,19 @@ $ knife server bootstrap ec2 \
--ssh-user ubuntu
```

To spin up your Chef Server on [Digital Ocean][do_site]:

```bash
knife server bootstrap digitalocean \
--node-name chefapalooza.example.com \
--digital_ocean_access_token $DIGITAL_OCEAN_ACCESS_TOKEN \
--location sfo1 \
--size 1gb \
--image ubuntu-12-04-x64 \
--ssh-keys $DIGITAL_OCEAN_SSH_KEY_ID \
--identity-file ~/.ssh/id_rsa-do
```

To spin up your Chef Server on Linode:

```bash
@@ -46,7 +61,19 @@ knife server bootstrap linode \
--linode-api-key $LINODE_API_KEY \
--linode-datacenter 3 \
--linode-flavor 1 \
--linode-image 99 \
--linode-image 126 \
--ssh-password 'testing1234'
```

To spin up your Chef Server on [OpenStack][openstack]:

```bash
knife server bootstrap openstack \
--node-name openstack.example.com \
--openstack-node-name openstack \
--openstack-username $OS_USERNAME \
--openstack-password $OS_PASSWORD \
--openstack-auth-url $OS_AUTH_URL \
--ssh-password 'testing1234'
```

@@ -108,12 +135,15 @@ Add this line to your application's Gemfile:
gem 'knife-server'
```

**Note** If you want to use the `bootstrap ec2` or `bootstrap linode`
**Note** If you want to use the `bootstrap ec2`, `bootstrap digitalocean`,
`bootstrap linode`, or `bootstrap openstack`
subcommands you will need to explicitly add this to your Gemfile with:

```ruby
gem 'knife-ec2'
gem 'knife-digital_ocean'
gem 'knife-linode'
gem 'knife-openstack'
```

Finally execute:
@@ -128,8 +158,9 @@ Or install it yourself as:
$ gem install knife-server
```

(Don't forget a `gem install knife-ec2` or `gem install knife-linode` if using
the `bootstrap ec2` or `bootstrap linode` subcommands).
(Don't forget a `gem install knife-ec2`, `gem install knife-digital_ocean`,
`gem install knife-linode`, or `gem install knife-openstack` if using any
cloud-specific subcommands).

Next, you **must** set up a [knife.rb configuration](#installation-knife) so
that the shipped Knife subcommands know where to place and modify key files,
@@ -159,12 +190,12 @@ that if you do not explicitly set `client_key` and `validation_key`, the

For example, you could add lines similar to the following in your user's
`~/.chef/knife.rb` or your project's `.chef/knife.rb` file (assuming you
have a directory `"$HOME/.chef.d"` created with `mkdir -p $HOME/.chef.d`):
have a directory `"$HOME/.chef"` created with `mkdir -p $HOME/.chef`):

```ruby
node_name "gramsay"
client_key "#{ENV['HOME']}/.chef.d/gramsay.pem"
validation_key "#{ENV['HOME']}/.chef.d/chef-validator.pem"
client_key "#{ENV['HOME']}/.chef/gramsay.pem"
validation_key "#{ENV['HOME']}/.chef/chef-validator.pem"
```

Most options can be passed to the knife subcommands explicitly but this
@@ -182,6 +213,9 @@ knife[:flavor] = "t1.micro"

# for linode
knife[:linode_api_key] = "MY_KEY"

# for digitalocean
knife[:digital_ocean_acceess_token] = "MY_TOKEN"
```

Better yet, why not try a more generic [knife.rb][chef_bootstrap_knife_rb] file
@@ -394,6 +428,21 @@ The resulting set will include:
* `"Node=#{config[:chef_node_name]}"`
* `"Role=chef_server"`

### <a name="knife-server-bootstrap-digitalocean"></a> knife server bootstrap digitalocean

**Note:** You must install the [knife-digital_ocean gem][knife-digital_ocean]
to use this subcommand. This was done to keep the dependencies of this library
lighter and to make future cloud adapter support easier to add.

Provisions a Digital Ocean droplet and sets up an Open Source Chef Server as
described [above](#knife-server-bootstrap).

#### Configuration

This subcommand imports all relavent options from the knife-digital_ocean gem.
For detailed documentation relating to these options, please visit the [project
page][knife-digital_ocean].

### <a name="knife-server-bootstrap-linode"></a> knife server bootstrap linode

**Note:** You must install the [knife-linode gem][knife-linode] to use this
@@ -457,6 +506,15 @@ password so that you know how to connect later.

The default value is a random password.

### <a name="knife-server-bootstrap-openstack"></a> knife server bootstrap openstack

**Note:** You must install the [knife-openstack gem][knife-openstack] to use this
subcommand. This was done to keep the dependencies of this library lighter and
to make future cloud adapter support easier to add.

Provisions a Openstack instance and sets up an Open Source Chef Server as
described [above](#knife-server-bootstrap).

### <a name="knife-server-bootstrap-standalone"></a> knife server bootstrap standalone

Provisions a standalone server that is reachable on the network and sets up
@@ -615,12 +673,16 @@ Apache License, Version 2.0 (see [LICENSE][license])
[backup_restore]: https://github.com/stevendanna/knife-hacks/blob/master/plugins/backup_restore.rb
[chef_bootstrap_knife_rb]: https://github.com/fnichol/chef-bootstrap-repo/blob/master/.chef/knife.rb
[chef_bootstrap_repo]: https://github.com/fnichol/chef-bootstrap-repo/
[do_site]: https://www.digitalocean.com/
[docs_knife]: http://docs.opscode.com/config_rb_knife.html
[docs_knife_ec2]: http://docs.opscode.com/plugin_knife_ec2.html
[docs_knife_linode]: http://docs.opscode.com/plugin_knife_linode.html
[jtimberman]: https://github.com/jtimberman
[install_chef]: http://www.opscode.com/chef/install/
[knife-digital_ocean]: https://github.com/rmoriz/knife-digital_ocean
[knife-ec2]: https://github.com/opscode/knife-ec2
[knife-linode]: https://github.com/opscode/knife-linode
[knife-openstack]: https://github.com/opscode/knife-openstack
[stevendanna]: https://github.com/stevendanna
[vagrant_site]: http://vagrantup.com/
[openstack]: http://openstack.org
41 changes: 31 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
#!/usr/bin/env rake
# -*- encoding: utf-8 -*-

require "bundler/gem_tasks"

begin
require 'rspec/core/rake_task'
require "rspec/core/rake_task"
desc "Run all specs in spec directory"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = "spec/**/*_spec.rb"
end

task :default => :spec
desc "Run all test suites"
task :test => [:spec]

desc "Run all specs in spec directory"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/**/*_spec.rb'
end
require "finstyle"
require "rubocop/rake_task"
RuboCop::RakeTask.new(:style) do |task|
task.options << "--display-cop-names"
end

rescue LoadError
STDERR.puts "\n*** RSpec not available. (sudo) gem install rspec to run unit tests. ***\n\n"
require "cane/rake_task"
desc "Run cane to check quality metrics"
Cane::RakeTask.new do |cane|
cane.canefile = "./.cane"
end

desc "Display LOC stats"
task :stats do
puts "\n## Production Code Stats"
sh "countloc -r lib"
puts "\n## Test Code Stats"
sh "countloc -r spec"
end

desc "Run all quality tasks"
task :quality => [:cane, :style, :stats]

task :default => [:test, :quality]
Loading