From d84523687db8e8d16bb816f754d22f5faa955b12 Mon Sep 17 00:00:00 2001 From: Jeroen Jacobs Date: Mon, 4 Apr 2016 13:19:49 +0200 Subject: [PATCH 01/28] Allows net-ssh v3.x There is only one breaking change in v3 and it has no impact on knife-solo: https://github.com/net-ssh/net-ssh/blob/v3.0.1/CHANGES.txt#L3 This fixes one of the two issues mentioned in https://github.com/matschaffer/knife-solo/issues/478. --- knife-solo.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knife-solo.gemspec b/knife-solo.gemspec index 77cf2819..83f0fb9e 100644 --- a/knife-solo.gemspec +++ b/knife-solo.gemspec @@ -31,6 +31,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'coveralls' s.add_dependency 'chef', '>= 10.20' - s.add_dependency 'net-ssh', '~> 2.7', '< 3.0' + s.add_dependency 'net-ssh', '>= 2.7', '< 4.0' s.add_dependency 'erubis', '~> 2.7.0' end From 5c310582c10ac21ba92c1649ea68d461d3025b31 Mon Sep 17 00:00:00 2001 From: Mark Woods Date: Sat, 16 Jan 2016 10:23:33 +0000 Subject: [PATCH 02/28] Shorten ssh control path My previous commit to "fix" the ssh control path by including the remote user and port also made it more likely that the resulting path would exceed the maximum allowed length of the path to a unix domain socket. I've replaced the use of '%r@%h:%p' in the ssh control path with '%C', which is substituted by a hash of the concatenation of '%l%h%p%r', so it still includes the remote user, host and port, but is also a predictable length and less likely to exceed the maximum allowed length of a path to a unix domain socket (104 "chars" on OSX, 108 I think on Linux). The change was made after I ran into a "too long for Unix domain socket" error myself when cooking a node, and has been tested in production. --- lib/knife-solo/ssh_command.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/knife-solo/ssh_command.rb b/lib/knife-solo/ssh_command.rb index e650a717..70440c0f 100644 --- a/lib/knife-solo/ssh_command.rb +++ b/lib/knife-solo/ssh_command.rb @@ -220,7 +220,7 @@ def ssh_args def ssh_control_path dir = File.join(ENV['HOME'], '.chef', 'knife-solo-sockets') FileUtils.mkdir_p(dir) - File.join(dir, '%r@%h:%p') + File.join(dir, '%C') end def custom_sudo_command From 172a061285e380b2cad7d9d5b3d2c9c6bde890da Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Wed, 6 Apr 2016 21:54:57 +0900 Subject: [PATCH 03/28] Changelog updates --- CHANGELOG.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 787fdfb9..b6d8d632 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,28 @@ +# 0.6.0 / Pending + +## Changes and new features + +* Added support for Mac OS 10.10 ([456][]) + +## Fixes + +* Loosen net-ssh requirement to gain compatibility with newer ChefDK releases ([481][]) +* Ensure non-interactive mode on Debian x86 boostrap ([471][]) +* Include user and port in control path ([468][]) +* Default control master to "no" when running from cygwin ([453][]) +* Pass node name down to solo.rb (forward port from 0.4.3) ([452][]) +* Use `const_get` to help spot bootstrap detection errors more easily ([467][]) + +## Thanks to our contributors! + +* [Austin Schutz][aaadschutz] +* [Shawn Xu][xunnanxu] +* [Derek Tamsen][derektamsen] +* [Przemysław Dąbek][szemek] +* [Mark Woods][thickpaddy] +* [Tomohiko IIDA][iidatomohiko] +* [Jeroen Jacobs][jeroenj] + # 0.5.1 / 2015-08-28 Re-release of 0.5.0 for test & doc fixes. From a5e7eced5f3ae372612d0e378ce2c542d3cada14 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Wed, 6 Apr 2016 21:55:08 +0900 Subject: [PATCH 04/28] Version bumps for 0.6.0 --- lib/knife-solo/info.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/knife-solo/info.rb b/lib/knife-solo/info.rb index 840981be..877f0927 100644 --- a/lib/knife-solo/info.rb +++ b/lib/knife-solo/info.rb @@ -1,6 +1,6 @@ module KnifeSolo def self.version - '0.5.2' + '0.6.0' end def self.post_install_message From d047b36b51144a1eb281de87d6824a016e2d71a1 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Wed, 6 Apr 2016 21:55:30 +0900 Subject: [PATCH 05/28] Remove shellout hack now that recent chef 12 versions have been fixed --- test/test_helper.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 65b4cfa6..f96c501c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,12 +1,6 @@ require 'rubygems' require 'bundler/setup' -# Avoids uninitialized constant Chef::Mixin::ShellOut - see https://github.com/chef/chef/pull/4153 -require 'chef/version' -if Gem::Requirement.new('>= 12.5.0').satisfied_by? Gem::Version.new(Chef::VERSION) - require 'chef/mixin/shell_out' -end - require 'coveralls' Coveralls.wear! From 5e74df9bb937865ac0f91b43e0ca77fb313e349a Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Wed, 6 Apr 2016 22:29:09 +0900 Subject: [PATCH 06/28] Disable test warnings Rake 11 turned this on by default, but chef and mixlib have a ton of warnings if we run with them on. --- Rakefile | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Rakefile b/Rakefile index e2069569..b0339c9b 100644 --- a/Rakefile +++ b/Rakefile @@ -71,21 +71,18 @@ task 'gh-pages' do end end -namespace :test do - Rake::TestTask.new(:performance) do |t| - t.libs << "test" - t.test_files = FileList['test/performance/*_test.rb'] - end - - Rake::TestTask.new(:integration) do |t| - t.libs << "test" - t.test_files = FileList['test/integration/*_test.rb'] +def test_task(name, glob) + Rake::TestTask.new(name) do |t| + t.libs << 'test' + t.warning = false + t.test_files = FileList[glob] end +end - Rake::TestTask.new(:units) do |t| - t.libs << "test" - t.test_files = FileList['test/*_test.rb'] - end +namespace :test do + test_task(:performance, 'test/performance/*_test.rb') + test_task(:integration, 'test/integration/*_test.rb') + test_task(:units, 'test/*_test.rb') desc 'Run both unit and integration tests' task :all => [:units, :integration] From 84f0fd974cbf554bcc4a13391deb3a785dff8dff Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Wed, 6 Apr 2016 22:35:57 +0900 Subject: [PATCH 07/28] Eliminate warnings in knife-solo code from running TestTask in the default mode --- lib/knife-solo/bootstraps.rb | 2 +- lib/knife-solo/cookbook_manager.rb | 2 +- lib/knife-solo/cookbook_manager_selector.rb | 2 +- lib/knife-solo/node_config_command.rb | 2 +- lib/knife-solo/ssh_command.rb | 6 +++--- lib/knife-solo/ssh_connection.rb | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/knife-solo/bootstraps.rb b/lib/knife-solo/bootstraps.rb index a8984842..52d6ab33 100644 --- a/lib/knife-solo/bootstraps.rb +++ b/lib/knife-solo/bootstraps.rb @@ -8,7 +8,7 @@ class OperatingSystemNotImplementedError < StandardError def self.class_exists_for?(os_name) begin true if self.class_for_operating_system(os_name).class == Class - rescue => exception + rescue false end end diff --git a/lib/knife-solo/cookbook_manager.rb b/lib/knife-solo/cookbook_manager.rb index c84e7164..0ff4c181 100644 --- a/lib/knife-solo/cookbook_manager.rb +++ b/lib/knife-solo/cookbook_manager.rb @@ -72,7 +72,7 @@ def enabled_by_chef_config? end def conf_file_exists?(base = nil) - File.exists?(conf_file(base)) + File.exist?(conf_file(base)) end # Runs the manager and returns the path to the cookbook directory diff --git a/lib/knife-solo/cookbook_manager_selector.rb b/lib/knife-solo/cookbook_manager_selector.rb index e2c77986..5ceb785d 100644 --- a/lib/knife-solo/cookbook_manager_selector.rb +++ b/lib/knife-solo/cookbook_manager_selector.rb @@ -54,7 +54,7 @@ def select_or_disable_by_chef_config! def select_by_existing_conf_file(base) managers.each do |manager| - if manager.conf_file_exists?(@base) + if defined?(@base) && manager.conf_file_exists?(@base) Chef::Log.debug "#{manager} selected because of existing #{manager.conf_file}" return manager end diff --git a/lib/knife-solo/node_config_command.rb b/lib/knife-solo/node_config_command.rb index 1d8aacaf..13b3c7aa 100644 --- a/lib/knife-solo/node_config_command.rb +++ b/lib/knife-solo/node_config_command.rb @@ -10,7 +10,7 @@ def self.included(other) other.class_eval do # Lazy load our dependencies if the including class did not call # Knife#deps yet. See KnifeSolo::SshCommand for more information. - deps { KnifeSolo::NodeConfigCommand.load_deps } unless @dependency_loader + deps { KnifeSolo::NodeConfigCommand.load_deps } unless defined?(@dependency_loader) option :chef_node_name, :short => '-N NAME', diff --git a/lib/knife-solo/ssh_command.rb b/lib/knife-solo/ssh_command.rb index 70440c0f..7e754d16 100644 --- a/lib/knife-solo/ssh_command.rb +++ b/lib/knife-solo/ssh_command.rb @@ -22,7 +22,7 @@ def self.included(other) # KnifeSolo::SshCommand.load_deps # end # - deps { KnifeSolo::SshCommand.load_deps } unless @dependency_loader + deps { KnifeSolo::SshCommand.load_deps } unless defined?(@dependency_loader) option :ssh_config, :short => '-F CONFIG_FILE', @@ -126,7 +126,7 @@ def validate_ssh_options! end def host_descriptor - return @host_descriptor if @host_descriptor + return @host_descriptor if defined?(@host_descriptor) parts = @name_args.first.split('@') @host_descriptor = { :host => parts.pop, @@ -189,7 +189,7 @@ def config_files end def detect_authentication_method - return @detected if @detected + return @detected if defined?(@detected) begin try_connection rescue Errno::ETIMEDOUT diff --git a/lib/knife-solo/ssh_connection.rb b/lib/knife-solo/ssh_connection.rb index e7e092e2..4b041b41 100644 --- a/lib/knife-solo/ssh_connection.rb +++ b/lib/knife-solo/ssh_connection.rb @@ -53,7 +53,7 @@ def run_command(command, output = nil) session.open_channel do |channel| channel.request_pty - channel.exec(command) do |ch, success| + channel.exec(command) do |_, success| raise "ssh.channel.exec failure" unless success channel.on_data do |ch, data| # stdout From 82519a8969c7e232a736c69af142874d5b2f3e0f Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Wed, 6 Apr 2016 22:53:11 +0900 Subject: [PATCH 08/28] Fix bad variable reference rather than just guarding access --- lib/knife-solo/cookbook_manager_selector.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/knife-solo/cookbook_manager_selector.rb b/lib/knife-solo/cookbook_manager_selector.rb index 5ceb785d..1532e834 100644 --- a/lib/knife-solo/cookbook_manager_selector.rb +++ b/lib/knife-solo/cookbook_manager_selector.rb @@ -54,7 +54,7 @@ def select_or_disable_by_chef_config! def select_by_existing_conf_file(base) managers.each do |manager| - if defined?(@base) && manager.conf_file_exists?(@base) + if manager.conf_file_exists?(base) Chef::Log.debug "#{manager} selected because of existing #{manager.conf_file}" return manager end From 1991e620a7c13851c91c123f9cb6fd7587a7d657 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Wed, 6 Apr 2016 23:06:48 +0900 Subject: [PATCH 09/28] Map missing changelog links --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6d8d632..7e1b6e2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,14 @@ * [Tomohiko IIDA][iidatomohiko] * [Jeroen Jacobs][jeroenj] +[456]: https://github.com/matschaffer/knife-solo/issues/456 +[481]: https://github.com/matschaffer/knife-solo/issues/481 +[471]: https://github.com/matschaffer/knife-solo/issues/471 +[468]: https://github.com/matschaffer/knife-solo/issues/468 +[453]: https://github.com/matschaffer/knife-solo/issues/453 +[452]: https://github.com/matschaffer/knife-solo/issues/452 +[467]: https://github.com/matschaffer/knife-solo/issues/467 + # 0.5.1 / 2015-08-28 Re-release of 0.5.0 for test & doc fixes. @@ -619,3 +627,9 @@ And a special thanks to [Teemu Matilainen][tmatilai] who is now on the list of d [yugui]: https://github.com/yugui [zeph]: https://github.com/zeph [aaadschutz]: https://github.com/aaadschutz +[xunnanxu]: https://github.com/xunnanxu +[derektamsen]: https://github.com/derektamsen +[szemek]: https://github.com/szemek +[thickpaddy]: https://github.com/thickpaddy +[iidatomohiko]: https://github.com/iidatomohiko +[jeroenj]: https://github.com/jeroenj From 57ed6af63fdf21ef680d513f241e095296dd4676 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Thu, 7 Apr 2016 15:04:40 +0900 Subject: [PATCH 10/28] Take out doc warning now that chefdk issue is worked out --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 1c1906e1..345d60a4 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,6 @@ knife-solo adds a handful of Knife commands that aim to make working with chef-solo as powerful as chef-server. -## WARNINGS - -knife-solo's Berkshelf integration is known to be incompatible with ChefDK >= 0.10.0, see [#478](https://github.com/matschaffer/knife-solo/issues/478) for details. - ## Usage Simply ensure the gem is installed using: From bf6c100db8c3536d66cb093b52a9156844b000ce Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Fri, 22 Apr 2016 20:46:44 +0900 Subject: [PATCH 11/28] Update amazon linux integration Apache2 cookbook no longer works on the 2012 release. --- ...otstrap_test.rb => amazon_linux_2016_03_bootstrap_test.rb} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename test/integration/{amazon_linux_2012_09_bootstrap_test.rb => amazon_linux_2016_03_bootstrap_test.rb} (72%) diff --git a/test/integration/amazon_linux_2012_09_bootstrap_test.rb b/test/integration/amazon_linux_2016_03_bootstrap_test.rb similarity index 72% rename from test/integration/amazon_linux_2012_09_bootstrap_test.rb rename to test/integration/amazon_linux_2016_03_bootstrap_test.rb index 5d63a53c..7f6211f2 100644 --- a/test/integration/amazon_linux_2012_09_bootstrap_test.rb +++ b/test/integration/amazon_linux_2016_03_bootstrap_test.rb @@ -1,12 +1,12 @@ require 'integration_helper' -class AmazonLinux2012_09BootstrapTest < IntegrationTest +class AmazonLinux2016_03BootstrapTest < IntegrationTest def user "ec2-user" end def image_id - "ami-1624987f" + "ami-4f111125" end def prepare_server From 786fb3c465a05f459da11f8f6116f2e416d527dc Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Fri, 22 Apr 2016 20:47:06 +0900 Subject: [PATCH 12/28] Default control master to "no" --- lib/knife-solo/ssh_command.rb | 9 +++------ test/ssh_command_test.rb | 25 ------------------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/lib/knife-solo/ssh_command.rb b/lib/knife-solo/ssh_command.rb index 7e754d16..0436ee6c 100644 --- a/lib/knife-solo/ssh_command.rb +++ b/lib/knife-solo/ssh_command.rb @@ -49,7 +49,8 @@ def self.included(other) option :ssh_control_master, :long => '--ssh-control-master SETTING', - :description => 'Control master setting to use when running rsync (use "no" to disable)' + :description => 'Control master setting to use when running rsync (use "auto" to enable)', + :default => 'no' option :identity_file, :short => '-i IDENTITY_FILE', @@ -114,10 +115,6 @@ def validate_ssh_options! host_descriptor[:user] ||= config[:ssh_user] end - if !config[:ssh_control_master] - config[:ssh_control_master] = KnifeSolo::Tools.cygwin_client? ? 'no' : 'auto' - end - # NOTE: can't rely on default since it won't get called when invoked via knife bootstrap --solo if config[:ssh_keepalive_interval] && config[:ssh_keepalive_interval] <= 0 ui.fatal '`--ssh-keepalive-interval` must be a positive number' @@ -189,7 +186,7 @@ def config_files end def detect_authentication_method - return @detected if defined?(@detected) + return @detected if @detected begin try_connection rescue Errno::ETIMEDOUT diff --git a/test/ssh_command_test.rb b/test/ssh_command_test.rb index 5ebac5d1..bedb1951 100644 --- a/test/ssh_command_test.rb +++ b/test/ssh_command_test.rb @@ -10,11 +10,6 @@ class DummySshCommand < Chef::Knife end class SshCommandTest < TestCase - - def setup - KnifeSolo::Tools.stubs(:cygwin_client?).returns(false) - end - def test_separates_user_and_host assert_equal "ubuntu", command("ubuntu@10.0.0.1").user assert_equal "10.0.0.1", command("ubuntu@10.0.0.1").host @@ -170,26 +165,6 @@ def test_builds_cli_ssh_args assert_equal "usertest@10.0.0.1 -o ControlMaster=auto -o ControlPath=#{cmd.ssh_control_path} -o ControlPersist=3600", cmd.ssh_args end - def test_no_control_master_by_default_in_cygwin - DummySshCommand.any_instance.stubs(:try_connection) - DummySshCommand.any_instance.stubs(:ssh_control_path).returns('/path') - KnifeSolo::Tools.stubs(:cygwin_client?).returns(false) - cmd = command_internal('usertest@10.0.0.1') - cmd.validate_ssh_options! - assert_equal 'usertest@10.0.0.1 -o ControlMaster=auto -o ControlPath=/path -o ControlPersist=3600', cmd.ssh_args - - # if knife-solo runs in cygwin, disable ssh ControlMaster by default - KnifeSolo::Tools.stubs(:cygwin_client?).returns(true) - cmd = command_internal('usertest@10.0.0.1') - cmd.validate_ssh_options! - assert_equal 'usertest@10.0.0.1', cmd.ssh_args - - KnifeSolo::Tools.stubs(:cygwin_client?).returns(true) - cmd = command_internal('usertest@10.0.0.1', '--ssh-control-master=auto') - cmd.validate_ssh_options! - assert_equal 'usertest@10.0.0.1 -o ControlMaster=auto -o ControlPath=/path -o ControlPersist=3600', cmd.ssh_args - end - def test_barks_without_atleast_a_hostname cmd = command cmd.ui.expects(:fatal).with(regexp_matches(/hostname.*argument/)) From c7e0045bdf11257813a612f9b5dbc7224ee6a044 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Fri, 22 Apr 2016 20:47:55 +0900 Subject: [PATCH 13/28] Switch up nc command Latest OS X nc doesn't support `-q`. Also I've been liking the echo-pipe pattern more lately. --- test/support/ec2_runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/ec2_runner.rb b/test/support/ec2_runner.rb index 12bc88fe..f232f58d 100644 --- a/test/support/ec2_runner.rb +++ b/test/support/ec2_runner.rb @@ -39,7 +39,7 @@ def get_server(test) server.wait_for { ready? } logger.info "#{test.class} server (#{server.dns_name}) reported ready, trying to connect to ssh..." server.wait_for do - `nc #{dns_name} 22 -w 1 -q 0 Date: Fri, 29 Apr 2016 04:58:58 +0900 Subject: [PATCH 14/28] Remove old debian & centos tests since apache2 no longer supports them --- test/integration/centos5_8_test.rb | 15 --------------- test/integration/debian6_bootstrap_test.rb | 20 -------------------- 2 files changed, 35 deletions(-) delete mode 100644 test/integration/centos5_8_test.rb delete mode 100644 test/integration/debian6_bootstrap_test.rb diff --git a/test/integration/centos5_8_test.rb b/test/integration/centos5_8_test.rb deleted file mode 100644 index 088f4b76..00000000 --- a/test/integration/centos5_8_test.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'integration_helper' - -class Centos5_8Test < IntegrationTest - def user - "root" - end - - def image_id - "ami-100e8a79" - end - - include EmptyCook - include Apache2Cook - include EncryptedDataBag -end diff --git a/test/integration/debian6_bootstrap_test.rb b/test/integration/debian6_bootstrap_test.rb deleted file mode 100644 index b580ee4f..00000000 --- a/test/integration/debian6_bootstrap_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'integration_helper' - - -class Debian6BootstrapTest < IntegrationTest - def user - "admin" - end - - def image_id - # PVM 64-bit - # From https://wiki.debian.org/Cloud/AmazonEC2Image/Squeeze - "ami-5e12dc36" - end - - def prepare_server - # Do nothing as `solo bootstrap` will do everything - end - - include Apache2Bootstrap -end From 59c2d8113fb4034205b67d30cbf6d63061c43fd8 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Fri, 29 Apr 2016 04:59:16 +0900 Subject: [PATCH 15/28] WIP CentOS 7 test --- test/integration/centos7_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/integration/centos7_test.rb diff --git a/test/integration/centos7_test.rb b/test/integration/centos7_test.rb new file mode 100644 index 00000000..62605da5 --- /dev/null +++ b/test/integration/centos7_test.rb @@ -0,0 +1,21 @@ +require 'integration_helper' + +class Centos7Test < IntegrationTest + # disable_firewall + + def flavor_id + "m3.medium" + end + + def user + "centos" + end + + def image_id + "ami-6d1c2007" + end + + include EmptyCook + include Apache2Cook + include EncryptedDataBag +end From 405537296f789adf674720c37768c48d71c294d8 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Wed, 18 May 2016 10:23:37 +0900 Subject: [PATCH 16/28] Removing gentoo test It's really old and takes forever to run so I really never do. --- test/integration/gentoo2011_test.rb | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 test/integration/gentoo2011_test.rb diff --git a/test/integration/gentoo2011_test.rb b/test/integration/gentoo2011_test.rb deleted file mode 100644 index ef16c33e..00000000 --- a/test/integration/gentoo2011_test.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'integration_helper' - -class Gentoo2011Test < IntegrationTest - def user - "root" - end - - def image_id - "ami-ae49b7c7" - end - - # `emerge chef` takes a very long time (~ 50 minutes) on an m1.small - # Uncomment this if you need to verify Gentoo operation - - # include EmptyCook - # include Apache2Cook - # include EncryptedDataBag -end From 5ff364ba6357432d0d044e826df7b39fd4e4314a Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Thu, 19 May 2016 21:26:45 +0900 Subject: [PATCH 17/28] Removing archlinux test This is another one that takes a long time so hasn't been providing much value since it's usually skipped. --- test/integration/archlinux_20131128_test.rb | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 test/integration/archlinux_20131128_test.rb diff --git a/test/integration/archlinux_20131128_test.rb b/test/integration/archlinux_20131128_test.rb deleted file mode 100644 index b6ed18b2..00000000 --- a/test/integration/archlinux_20131128_test.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'integration_helper' - -class ArchLinux20131128Test < IntegrationTest - def user - "root" - end - - def image_id - "ami-d1cbebb8" - end - - # this install method takes over 15m on an m1.small - # Uncomment this if you need to verify Arch operation - - # include EmptyCook - # include EncryptedDataBag -end From fd98197816c80ac50c303f373273a14ca564f132 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Thu, 19 May 2016 22:20:58 +0900 Subject: [PATCH 18/28] Set ENV['PWD'] when switching pwd into integration test kitchen --- test/support/integration_test.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/support/integration_test.rb b/test/support/integration_test.rb index 1a8d8274..eb24b6fd 100644 --- a/test/support/integration_test.rb +++ b/test/support/integration_test.rb @@ -41,7 +41,9 @@ def setup @kitchen.dirname.mkpath system "knife solo init #{@kitchen} --no-berkshelf --no-librarian >> #{log_file}" @start_dir = Dir.pwd + # NOTE (matschaffer): On ruby 2.3 this won't set ENV['PWD'] which chef-config-12.8.1 uses for `working_directory` Dir.chdir(@kitchen) + ENV['PWD'] = @kitchen.to_s prepare_server end From 9bfcb6b967837eff808d731668663578d6921f58 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Sun, 22 May 2016 23:09:31 +0900 Subject: [PATCH 19/28] Pass ssh_identity_file as well as identity_file through as ssh keys Newer knife bootstrap has identity_file deprecated --- lib/knife-solo/ssh_command.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/knife-solo/ssh_command.rb b/lib/knife-solo/ssh_command.rb index 0436ee6c..b7521693 100644 --- a/lib/knife-solo/ssh_command.rb +++ b/lib/knife-solo/ssh_command.rb @@ -164,7 +164,9 @@ def connection_options options = config_file_options options[:port] = config[:ssh_port] if config[:ssh_port] options[:password] = config[:ssh_password] if config[:ssh_password] - options[:keys] = [config[:identity_file]] if config[:identity_file] + options[:keys] = [] + options[:keys] << config[:identity_file] if config[:identity_file] + options[:keys] << config[:ssh_identity_file] if config[:ssh_identity_file] options[:gateway] = config[:ssh_gateway] if config[:ssh_gateway] options[:forward_agent] = true if config[:forward_agent] if !config[:host_key_verify] From 9e2c4a89e2038601b300c126c366f6a2fe6b9bf2 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Mon, 23 May 2016 09:51:54 +0900 Subject: [PATCH 20/28] Generalize handling of ssh key arguments for older or newer knifes --- CHANGELOG.md | 1 + lib/knife-solo/ssh_command.rb | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e1b6e2d..26bccca1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Changes and new features * Added support for Mac OS 10.10 ([456][]) +* **BREAKING** Updated ssh key argument to `--ssh-identity-file` to match new knife conventions ## Fixes diff --git a/lib/knife-solo/ssh_command.rb b/lib/knife-solo/ssh_command.rb index b7521693..7dc089e5 100644 --- a/lib/knife-solo/ssh_command.rb +++ b/lib/knife-solo/ssh_command.rb @@ -43,19 +43,19 @@ def self.included(other) :long => '--ssh-gateway GATEWAY', :description => 'The ssh gateway' - option :ssh_identity, - :long => '--ssh-identity FILE', - :description => 'Deprecated. Replaced with --identity-file.' - option :ssh_control_master, :long => '--ssh-control-master SETTING', :description => 'Control master setting to use when running rsync (use "auto" to enable)', :default => 'no' option :identity_file, - :short => '-i IDENTITY_FILE', - :long => '--identity-file FILE', - :description => 'The ssh identity file' + :long => "--identity-file IDENTITY_FILE", + :description => "The SSH identity file used for authentication. [DEPRECATED] Use --ssh-identity-file instead." + + option :ssh_identity_file, + :short => "-i IDENTITY_FILE", + :long => "--ssh-identity-file IDENTITY_FILE", + :description => "The SSH identity file used for authentication" option :forward_agent, :long => '--forward-agent', @@ -102,9 +102,8 @@ def first_cli_arg_is_a_hostname? end def validate_ssh_options! - if config[:ssh_identity] - ui.warn '`--ssh-identity` is deprecated, please use `--identity-file`.' - config[:identity_file] ||= config[:ssh_identity] + if config[:identity_file] + ui.warn '`--identity-file` is deprecated, please use `--ssh-identity-file`.' end unless first_cli_arg_is_a_hostname? show_usage @@ -160,13 +159,15 @@ def config_file_options Net::SSH::Config.for(host, config_files) end + def identity_file + config[:ssh_identity] || config[:identity_file] || config[:ssh_identity_file] + end + def connection_options options = config_file_options options[:port] = config[:ssh_port] if config[:ssh_port] options[:password] = config[:ssh_password] if config[:ssh_password] - options[:keys] = [] - options[:keys] << config[:identity_file] if config[:identity_file] - options[:keys] << config[:ssh_identity_file] if config[:ssh_identity_file] + options[:keys] = [identity_file] if identity_file options[:gateway] = config[:ssh_gateway] if config[:ssh_gateway] options[:forward_agent] = true if config[:forward_agent] if !config[:host_key_verify] @@ -206,7 +207,7 @@ def ssh_args args << [user, host].compact.join('@') args << "-F #{config[:ssh_config]}" if config[:ssh_config] - args << "-i #{config[:identity_file]}" if config[:identity_file] + args << "-i #{identity_file}" if identity_file args << "-o ForwardAgent=yes" if config[:forward_agent] args << "-p #{config[:ssh_port]}" if config[:ssh_port] args << "-o UserKnownHostsFile=#{connection_options[:user_known_hosts_file]}" if config[:host_key_verify] == false From f67216036524d5c8a4e044aef7d2cedf560fefea Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Mon, 23 May 2016 10:11:22 +0900 Subject: [PATCH 21/28] Update OmniOS to latest LTS --- .../{omnios_r151004_test.rb => omnios_r151014_test.rb} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename test/integration/{omnios_r151004_test.rb => omnios_r151014_test.rb} (68%) diff --git a/test/integration/omnios_r151004_test.rb b/test/integration/omnios_r151014_test.rb similarity index 68% rename from test/integration/omnios_r151004_test.rb rename to test/integration/omnios_r151014_test.rb index 0d27636c..2907d4d0 100644 --- a/test/integration/omnios_r151004_test.rb +++ b/test/integration/omnios_r151014_test.rb @@ -1,12 +1,12 @@ require 'integration_helper' -class OmniOSr151004Test < IntegrationTest +class OmniOSr151014Test < IntegrationTest def user "root" end def image_id - "ami-4e2c9727" + "ami-79ee1b14" end include EmptyCook From 61813486ed5742ee5bd2a276427dff9869faaed1 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Mon, 23 May 2016 13:31:17 +0900 Subject: [PATCH 22/28] Update test now that control master is off by default --- test/ssh_command_test.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/test/ssh_command_test.rb b/test/ssh_command_test.rb index bedb1951..c60c3c94 100644 --- a/test/ssh_command_test.rb +++ b/test/ssh_command_test.rb @@ -159,10 +159,6 @@ def test_builds_cli_ssh_args cmd = command("usertest@10.0.0.1", "--ssh-gateway=test@host.com") cmd.validate_ssh_options! assert_equal "usertest@10.0.0.1", cmd.ssh_args - - cmd = command_internal("usertest@10.0.0.1", "--ssh-gateway=test@host.com") - cmd.validate_ssh_options! - assert_equal "usertest@10.0.0.1 -o ControlMaster=auto -o ControlPath=#{cmd.ssh_control_path} -o ControlPersist=3600", cmd.ssh_args end def test_barks_without_atleast_a_hostname @@ -226,11 +222,6 @@ def result(code, stdout = "") end def command(*args) - args << '--ssh-control-master=no' - command_internal(*args) - end - - def command_internal(*args) Net::SSH::Config.stubs(:default_files) knife_command(DummySshCommand, *args) end From be0e021829504a26167379326e4025cf0e2b78e8 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Mon, 23 May 2016 13:31:24 +0900 Subject: [PATCH 23/28] Update manifest --- Manifest.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Manifest.txt b/Manifest.txt index b37c8301..1e441c65 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -39,8 +39,7 @@ test/gemfiles/Gemfile.chef-11 test/gemfiles/Gemfile.chef-12 test/gemfiles/Gemfile.chef-master test/gitignore_test.rb -test/integration/amazon_linux_2012_09_bootstrap_test.rb -test/integration/archlinux_20131128_test.rb +test/integration/amazon_linux_2016_03_bootstrap_test.rb test/integration/cases/apache2_bootstrap.rb test/integration/cases/apache2_cook.rb test/integration/cases/cache_path_usage.rb @@ -49,12 +48,10 @@ test/integration/cases/encrypted_data_bag.rb test/integration/cases/environment.rb test/integration/cases/knife_bootstrap.rb test/integration/cases/ohai_hints.rb -test/integration/centos5_8_test.rb test/integration/centos6_3_test.rb -test/integration/debian6_bootstrap_test.rb +test/integration/centos7_test.rb test/integration/debian7_knife_bootstrap_test.rb -test/integration/gentoo2011_test.rb -test/integration/omnios_r151004_test.rb +test/integration/omnios_r151014_test.rb test/integration/scientific_linux_63_test.rb test/integration/sles_11_test.rb test/integration/ubuntu12_04_bootstrap_test.rb From c10d3972d636e6d7f59e444d3a34da8dc119c049 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Mon, 23 May 2016 17:12:52 +0900 Subject: [PATCH 24/28] Changelog update --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26bccca1..993f0798 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * Ensure non-interactive mode on Debian x86 boostrap ([471][]) * Include user and port in control path ([468][]) * Default control master to "no" when running from cygwin ([453][]) +* Use hashed control path (requires recent openssh) ([470][]) * Pass node name down to solo.rb (forward port from 0.4.3) ([452][]) * Use `const_get` to help spot bootstrap detection errors more easily ([467][]) @@ -24,6 +25,7 @@ * [Tomohiko IIDA][iidatomohiko] * [Jeroen Jacobs][jeroenj] +[470]: https://github.com/matschaffer/knife-solo/issues/470 [456]: https://github.com/matschaffer/knife-solo/issues/456 [481]: https://github.com/matschaffer/knife-solo/issues/481 [471]: https://github.com/matschaffer/knife-solo/issues/471 From afe7a1a529fccd57d3721d7284aaf585dbfb5e4c Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Mon, 23 May 2016 17:15:37 +0900 Subject: [PATCH 25/28] Clarify comment about `ENV['PWD']` --- test/support/integration_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/integration_test.rb b/test/support/integration_test.rb index eb24b6fd..e6fd8e33 100644 --- a/test/support/integration_test.rb +++ b/test/support/integration_test.rb @@ -41,7 +41,7 @@ def setup @kitchen.dirname.mkpath system "knife solo init #{@kitchen} --no-berkshelf --no-librarian >> #{log_file}" @start_dir = Dir.pwd - # NOTE (matschaffer): On ruby 2.3 this won't set ENV['PWD'] which chef-config-12.8.1 uses for `working_directory` + # NOTE (matschaffer): On ruby 2.3 Dir.chdir won't set ENV['PWD'] which chef-config-12.8.1 uses for `working_directory` Dir.chdir(@kitchen) ENV['PWD'] = @kitchen.to_s prepare_server From a79cd144cffca602a4326d700d4694a2a2533b41 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Mon, 23 May 2016 17:16:03 +0900 Subject: [PATCH 26/28] Set release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 993f0798..cb704c5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 0.6.0 / Pending +# 0.6.0 / 2016-05-23 ## Changes and new features From 01b7efe7e75e1ce4dc6fa7135ba557fabf4194fe Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Mon, 23 May 2016 19:07:00 +0900 Subject: [PATCH 27/28] Bump version for next release --- lib/knife-solo/info.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/knife-solo/info.rb b/lib/knife-solo/info.rb index 877f0927..822ca41c 100644 --- a/lib/knife-solo/info.rb +++ b/lib/knife-solo/info.rb @@ -1,6 +1,6 @@ module KnifeSolo def self.version - '0.6.0' + '0.7.0' end def self.post_install_message From 845d0872b86b1e91a31cb8685fa4a0b0a23098d5 Mon Sep 17 00:00:00 2001 From: David Stapleton Date: Wed, 17 Aug 2016 15:48:36 +0100 Subject: [PATCH 28/28] Add support for OpenSUSE Leap --- lib/knife-solo/bootstraps/linux.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/knife-solo/bootstraps/linux.rb b/lib/knife-solo/bootstraps/linux.rb index a6fc0bab..4ef93cee 100644 --- a/lib/knife-solo/bootstraps/linux.rb +++ b/lib/knife-solo/bootstraps/linux.rb @@ -100,7 +100,7 @@ def distro {:type => "yum_omnibus"} when %r{SUSE Linux Enterprise Server 1[12]} {:type => "omnibus"} - when %r{openSUSE 1[23]} + when %r{openSUSE 1[23]}, %r{openSUSE Leap 42} {:type => "zypper_omnibus"} when %r{This is \\n\.\\O \(\\s \\m \\r\) \\t} {:type => "emerge_gem"}