Hello community,

here is the log from the commit of package rubygem-sshkit for openSUSE:Factory 
checked in at 2015-03-09 10:09:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-sshkit (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-sshkit.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-sshkit"

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-sshkit/rubygem-sshkit.changes    
2015-02-16 21:12:56.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-sshkit.new/rubygem-sshkit.changes       
2015-03-09 10:09:50.000000000 +0100
@@ -1,0 +2,22 @@
+Fri Mar  6 17:38:51 UTC 2015 - [email protected]
+
+- updated to version 1.7.1
+ 
+   * Fix a regression in 1.7.0 that caused command completion messages to be 
removed from log output. @mattbrictson
+ 
+ ## 1.7.0
+ 
+   * Update Vagrantfile to use multi-provider Hashicorp precise64 box - remove 
URLs. @townsen
+   * Merge host ssh_options and Netssh defaults @townsen
+     Previously if host-level ssh_options were defined the Netssh defaults
+     were ignored.
+   * Merge host ssh_options and Netssh defaults
+   * Fixed race condition where output of failed command would be empty. 
@townsen
+     Caused random failures of 
`test_execute_raises_on_non_zero_exit_status_and_captures_stdout_and_stderr`
+     Also fixes output handling in failed commands, and generally buggy output.
+   * Remove override of backtrace() and backtrace_locations() from 
ExecuteError. @townsen
+     This interferes with rake default behaviour and creates duplicate 
stacktraces.
+   * Allow running local commands using `on(:local)`
+   * Implement the upload! and download! methods for the local backend
+
+-------------------------------------------------------------------

Old:
----
  sshkit-1.6.1.gem

New:
----
  sshkit-1.7.1.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-sshkit.spec ++++++
--- /var/tmp/diff_new_pack.1usz1w/_old  2015-03-09 10:09:51.000000000 +0100
+++ /var/tmp/diff_new_pack.1usz1w/_new  2015-03-09 10:09:51.000000000 +0100
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-sshkit
-Version:        1.6.1
+Version:        1.7.1
 Release:        0
 %define mod_name sshkit
 %define mod_full_name %{mod_name}-%{version}

++++++ sshkit-1.6.1.gem -> sshkit-1.7.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore      2014-12-16 23:45:13.000000000 +0100
+++ new/.gitignore      2015-03-02 22:02:27.000000000 +0100
@@ -1,4 +1,7 @@
 *.gem
+*.swp
+bin/rake
+.bundle
 .yardoc
 .vagrant*
 test/tmp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2014-12-16 23:45:13.000000000 +0100
+++ new/CHANGELOG.md    2015-03-02 22:02:27.000000000 +0100
@@ -3,10 +3,29 @@
 This file is written in reverse chronological order, newer releases will
 appear at the top.
 
-## (Unreleased)
+## `master` (Unreleased)
 
-  * Add your entries here, remember to credit yourself however you want to be
-    credited!
+  * Add your entries below here, remember to credit yourself however you want
+    to be credited!
+
+## 1.7.1
+
+  * Fix a regression in 1.7.0 that caused command completion messages to be 
removed from log output. @mattbrictson
+
+## 1.7.0
+
+  * Update Vagrantfile to use multi-provider Hashicorp precise64 box - remove 
URLs. @townsen
+  * Merge host ssh_options and Netssh defaults @townsen
+    Previously if host-level ssh_options were defined the Netssh defaults
+    were ignored.
+  * Merge host ssh_options and Netssh defaults
+  * Fixed race condition where output of failed command would be empty. 
@townsen
+    Caused random failures of 
`test_execute_raises_on_non_zero_exit_status_and_captures_stdout_and_stderr`
+    Also fixes output handling in failed commands, and generally buggy output.
+  * Remove override of backtrace() and backtrace_locations() from 
ExecuteError. @townsen
+    This interferes with rake default behaviour and creates duplicate 
stacktraces.
+  * Allow running local commands using `on(:local)`
+  * Implement the upload! and download! methods for the local backend
 
 ## 1.6.0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/EXAMPLES.md new/EXAMPLES.md
--- old/EXAMPLES.md     2014-12-16 23:45:13.000000000 +0100
+++ new/EXAMPLES.md     2015-03-02 22:02:27.000000000 +0100
@@ -344,3 +344,10 @@
       end
     end
 
+You can achieve the same thing with `on(:local)`
+
+    on(:local) do
+      within '/tmp' do
+        execute :whoami
+      end
+    end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2014-12-16 23:45:13.000000000 +0100
+++ new/README.md       2015-03-02 22:02:27.000000000 +0100
@@ -1,4 +1,4 @@
-![SSHKit 
Logo](https://raw.github.com/leehambley/sshkit/master/assets/images/logo.png)
+![SSHKit 
Logo](https://raw.github.com/leehambley/sshkit/master/examples/images/logo.png)
 
 **SSHKit** is a toolkit for running commands in a structured way on one or
 more servers.
@@ -199,7 +199,7 @@
 
 ## Output Handling
 
-![Example 
Output](https://raw.github.com/leehambley/sshkit/master/assets/images/example_output.png)
+![Example 
Output](https://raw.github.com/leehambley/sshkit/master/examples/images/example_output.png)
 
 By default, the output format is set to `:pretty`:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Vagrantfile new/Vagrantfile
--- old/Vagrantfile     2014-12-16 23:45:13.000000000 +0100
+++ new/Vagrantfile     2015-03-02 22:02:27.000000000 +0100
@@ -1,13 +1,7 @@
 VAGRANTFILE_API_VERSION = "2"
 
 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
-  config.vm.box = 'precise64'
-  config.vm.provider "vmware_fusion" do |vmf|
-    vmf.box_url = "http://files.vagrantup.com/precise64_vmware.box";
-  end
-  config.vm.provider "virtualbox" do |vb|
-    config.vm.box_url = 
"http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box";
-  end
+  config.vm.box = 'hashicorp/precise64'
 
   json_config_path = File.join("test", "boxes.json")
   list = File.open(json_config_path).read
@@ -15,7 +9,6 @@
 
   list.each do |vm|
     config.vm.define vm["name"] do |web|
-      web.vm.box = "precise64"
       web.vm.network "forwarded_port", guest: 22, host: vm["port"]
     end
   end
Files old/assets/images/example_output.png and 
new/assets/images/example_output.png differ
Files old/assets/images/logo.png and new/assets/images/logo.png differ
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
Files old/examples/images/example_output.png and 
new/examples/images/example_output.png differ
Files old/examples/images/logo.png and new/examples/images/logo.png differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sshkit/backends/local.rb 
new/lib/sshkit/backends/local.rb
--- old/lib/sshkit/backends/local.rb    2014-12-16 23:45:13.000000000 +0100
+++ new/lib/sshkit/backends/local.rb    2015-03-02 22:02:27.000000000 +0100
@@ -1,17 +1,18 @@
 require 'open3'
+require 'fileutils'
 module SSHKit
 
   module Backend
 
     class Local < Printer
 
-      def initialize(&block)
-        @host = Host.new(hostname: 'localhost') # just for logging
+      def initialize(_ = nil, &block)
+        @host = Host.new(:local) # just for logging
         @block = block
       end
 
       def run
-        instance_exec(&@block)
+        instance_exec(@host, &@block)
       end
 
       def test(*args)
@@ -31,6 +32,26 @@
         _execute(*[*args, options]).full_stdout
       end
 
+      def upload!(local, remote, options = {})
+        if local.is_a?(String)
+          FileUtils.cp(local, remote)
+        else
+          File.open(remote, "wb") do |f|
+            IO.copy_stream(local, f)
+          end
+        end
+      end
+
+      def download!(remote, local=nil, options = {})
+        if local.nil?
+          FileUtils.cp(remote, File.basename(remote))
+        else
+          File.open(remote, "rb") do |f|
+            IO.copy_stream(f, local)
+          end
+        end
+      end
+
       private
 
       def _execute(*args)
@@ -39,23 +60,34 @@
 
           cmd.started = Time.now
 
-          stdout, stderr, exit_status =
-            if RUBY_ENGINE == 'jruby'
-              _, o, e, t = Open3.popen3('/usr/bin/env', 'sh', '-c', 
cmd.to_command)
-              [o.read, e.read, t.value]
-            else
-              Open3.capture3(cmd.to_command)
+          Open3.popen3(cmd.to_command) do |stdin, stdout, stderr, wait_thr|
+            stdout_thread = Thread.new do
+              while line = stdout.gets do
+                cmd.stdout = line
+                cmd.full_stdout += line
+
+                output << cmd
+              end
             end
 
-          cmd.stdout = stdout
-          cmd.full_stdout += stdout
+            stderr_thread = Thread.new do
+              while line = stderr.gets do
+                cmd.stderr = line
+                cmd.full_stderr += line
 
-          cmd.stderr = stderr
-          cmd.full_stderr += stderr
+                output << cmd
+              end
+            end
 
-          cmd.exit_status = exit_status.to_i
+            stdout_thread.join
+            stderr_thread.join
 
-          output << cmd
+            cmd.exit_status = wait_thr.value.to_i
+            cmd.stdout = ''
+            cmd.stderr = ''
+
+            output << cmd
+          end
         end
       end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sshkit/backends/netssh.rb 
new/lib/sshkit/backends/netssh.rb
--- old/lib/sshkit/backends/netssh.rb   2014-12-16 23:45:13.000000000 +0100
+++ new/lib/sshkit/backends/netssh.rb   2015-03-02 22:02:27.000000000 +0100
@@ -133,6 +133,7 @@
         command(*args).tap do |cmd|
           output << cmd
           cmd.started = true
+          exit_status = nil
           with_ssh do |ssh|
             ssh.open_channel do |chan|
               chan.request_pty if Netssh.config.pty
@@ -148,10 +149,7 @@
                   output << cmd
                 end
                 chan.on_request("exit-status") do |ch, data|
-                  cmd.stdout = ''
-                  cmd.stderr = ''
-                  cmd.exit_status = data.read_long
-                  output << cmd
+                  exit_status = data.read_long
                 end
                 #chan.on_request("exit-signal") do |ch, data|
                 #  # TODO: This gets called if the program is killed by a 
signal
@@ -176,11 +174,16 @@
             end
             ssh.loop
           end
+          # Set exit_status and log the result upon completion
+          if exit_status
+            cmd.exit_status = exit_status
+            output << cmd
+          end
         end
       end
 
       def with_ssh
-        host.ssh_options ||= Netssh.config.ssh_options
+        host.ssh_options = Netssh.config.ssh_options.merge(host.ssh_options || 
{})
         conn = self.class.pool.checkout(
           String(host.hostname),
           host.username,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sshkit/command.rb new/lib/sshkit/command.rb
--- old/lib/sshkit/command.rb   2014-12-16 23:45:13.000000000 +0100
+++ new/lib/sshkit/command.rb   2015-03-02 22:02:27.000000000 +0100
@@ -90,10 +90,8 @@
       if options[:raise_on_non_zero_exit] && exit_status > 0
         message = ""
         message += "#{command} exit status: " + exit_status.to_s + "\n"
-        message += "#{command} stdout: " + (stdout.strip.empty? ? "Nothing 
written" : stdout.strip) + "\n"
-
-        stderr_message = [stderr.strip, 
full_stderr.strip].delete_if(&:empty?).first
-        message += "#{command} stderr: " + (stderr_message || 'Nothing 
written') + "\n"
+        message += "#{command} stdout: " + (full_stdout.strip.empty? ? 
"Nothing written" : full_stdout.strip) + "\n"
+        message += "#{command} stderr: " + (full_stderr.strip.empty? ? 
'Nothing written' : full_stderr.strip) + "\n"
         raise Failed, message
       end
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sshkit/exception.rb new/lib/sshkit/exception.rb
--- old/lib/sshkit/exception.rb 2014-12-16 23:45:13.000000000 +0100
+++ new/lib/sshkit/exception.rb 2015-03-02 22:02:27.000000000 +0100
@@ -8,14 +8,6 @@
           def initialize cause
             @cause = cause
           end
-
-          def backtrace
-            @cause.backtrace
-          end
- 
-          def backtrace_locations
-            @cause.backtrace_locations
-          end
         end
     end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sshkit/formatters/pretty.rb 
new/lib/sshkit/formatters/pretty.rb
--- old/lib/sshkit/formatters/pretty.rb 2014-12-16 23:45:13.000000000 +0100
+++ new/lib/sshkit/formatters/pretty.rb 2015-03-02 22:02:27.000000000 +0100
@@ -34,6 +34,7 @@
                                              uuid(command) + c.green("\t" + 
line)]
               original_output << "\n" unless line[-1] == "\n"
             end
+            command.stdout = ''
           end
 
           unless command.stderr.empty?
@@ -42,6 +43,7 @@
                                              uuid(command) + c.red("\t" + 
line)]
               original_output << "\n" unless line[-1] == "\n"
             end
+            command.stderr = ''
           end
         end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sshkit/host.rb new/lib/sshkit/host.rb
--- old/lib/sshkit/host.rb      2014-12-16 23:45:13.000000000 +0100
+++ new/lib/sshkit/host.rb      2015-03-02 22:02:27.000000000 +0100
@@ -1,4 +1,5 @@
 require 'ostruct'
+require 'etc'
 
 module SSHKit
 
@@ -22,7 +23,11 @@
 
     def initialize(host_string_or_options_hash)
 
-      unless host_string_or_options_hash.is_a?(Hash)
+      if host_string_or_options_hash == :local
+        @local = true
+        @hostname = "localhost"
+        @user = Etc.getpwuid.name
+      elsif !host_string_or_options_hash.is_a?(Hash)
         suitable_parsers = [
           SimpleHostParser,
           HostWithPortParser,
@@ -51,6 +56,10 @@
       end
     end
 
+    def local?
+      @local
+    end
+
     def hash
       user.hash ^ hostname.hash ^ port.hash
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sshkit/runners/abstract.rb 
new/lib/sshkit/runners/abstract.rb
--- old/lib/sshkit/runners/abstract.rb  2014-12-16 23:45:13.000000000 +0100
+++ new/lib/sshkit/runners/abstract.rb  2015-03-02 22:02:27.000000000 +0100
@@ -15,7 +15,11 @@
       private
 
       def backend(host, &block)
-        SSHKit.config.backend.new(host, &block)
+        if host.local?
+          SSHKit::Backend::Local.new(&block)
+        else
+          SSHKit.config.backend.new(host, &block)
+        end
       end
 
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sshkit/version.rb new/lib/sshkit/version.rb
--- old/lib/sshkit/version.rb   2014-12-16 23:45:13.000000000 +0100
+++ new/lib/sshkit/version.rb   2015-03-02 22:02:27.000000000 +0100
@@ -1,3 +1,3 @@
 module SSHKit
-  VERSION = "1.6.1"
+  VERSION = "1.7.1"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2014-12-16 23:45:13.000000000 +0100
+++ new/metadata        2015-03-02 22:02:27.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: sshkit
 version: !ruby/object:Gem::Version
-  version: 1.6.1
+  version: 1.7.1
 platform: ruby
 authors:
 - Lee Hambley
@@ -9,7 +9,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2014-12-16 00:00:00.000000000 Z
+date: 2015-03-02 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: net-ssh
@@ -151,8 +151,8 @@
 - RELEASING.md
 - Rakefile
 - Vagrantfile
-- assets/images/example_output.png
-- assets/images/logo.png
+- examples/images/example_output.png
+- examples/images/logo.png
 - lib/core_ext/array.rb
 - lib/core_ext/hash.rb
 - lib/sshkit.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/functional/backends/test_netssh.rb 
new/test/functional/backends/test_netssh.rb
--- old/test/functional/backends/test_netssh.rb 2014-12-16 23:45:13.000000000 
+0100
+++ new/test/functional/backends/test_netssh.rb 2015-03-02 22:02:27.000000000 
+0100
@@ -65,6 +65,17 @@
         end
       end
 
+      def test_ssh_option_merge
+        a_host.ssh_options = { paranoid: true }
+        host_ssh_options = {}
+        SSHKit::Backend::Netssh.config.ssh_options = { forward_agent: false }
+        Netssh.new(a_host) do |host|
+          capture(:uname)
+          host_ssh_options = host.ssh_options
+        end.run
+        assert_equal({ forward_agent: false, paranoid: true }, 
host_ssh_options)
+      end
+
       def 
test_execute_raises_on_non_zero_exit_status_and_captures_stdout_and_stderr
         err = assert_raises SSHKit::Command::Failed do
           Netssh.new(a_host) do |host|
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/unit/test_host.rb new/test/unit/test_host.rb
--- old/test/unit/test_host.rb  2014-12-16 23:45:13.000000000 +0100
+++ new/test/unit/test_host.rb  2015-03-02 22:02:27.000000000 +0100
@@ -1,4 +1,5 @@
 require 'helper'
+require 'etc'
 
 module SSHKit
 
@@ -41,6 +42,14 @@
       assert_equal 'example.com', h.hostname
     end
 
+    def test_host_local
+      h = Host.new :local
+      assert       h.local?
+      assert_nil   h.port
+      assert_equal Etc.getpwuid.name, h.username
+      assert_equal 'localhost',       h.hostname
+    end
+
     def test_does_not_confuse_ipv6_hosts_with_port_specification
       h = Host.new '[1fff:0:a88:85a3::ac1f]:8001'
       assert_equal 8001,                    h.port

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to