Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed the test regression and then some #74

Merged
merged 7 commits into from

3 participants

@kohsuke

A test regression was caused by the lack of "blimpy wait_for_ssh", which was necessary because there's no livery configured for Blimpfiles used in tests.

There are a couple of small changes needed to run tests on Ruby 1.8, and additional error diagnostics in case Blimpfile is incorrect.

kohsuke added some commits
@kohsuke kohsuke Adding multi-file scp 1ef4ad0
@kohsuke kohsuke only works with Ruby 1.9+ a02491d
@kohsuke kohsuke SSH returns 255 for connection refused errors.
So limiting the range down a bit.
de4830f
@kohsuke kohsuke Making it work again with fog 1.10
in 1.9, the original code was sufficient, but 1.10 has a massive
refactoring in the way of registering providers. Unless at least one
provider is registered, the providers hash is empty, and it causes
an exception like the following:

/var/lib/gems/1.8/gems/fog-1.10.0/lib/fog/compute.rb:39:in `new': undefined method `include?' for nil:NilClass (NoMethodError)
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/boxes/aws.rb:39:in `fog'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/boxes/aws.rb:32:in `validate!'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/fleet.rb:110:in `start'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/fleet.rb:109:in `each'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/fleet.rb:109:in `start'
    from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/cli.rb:73:in `start'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/command.rb:27:in `__send__'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/command.rb:27:in `run'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/invocation.rb:120:in `invoke_command'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor.rb:363:in `dispatch'
    from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/base.rb:427:in `start'
    from /home/kohsuke/ws/cloudbees/blimpy/bin/blimpy:24

By forcing the registration of a provider, it works against with fog
1.10. Looking at the source tree, this change should also work with fog
1.9.
cd1ebc2
@kohsuke kohsuke Fixed a system/local conflict problem
If blimpy gem is already installed, this ends up picking blimpy from the installed gem, as opposed to the local workspace.
2edd265
@kohsuke kohsuke Fixing the unit test failure
Since these tests do not use any livery, explicit wait_for_ssh command
is required
8827307
@kohsuke kohsuke If Blimpfile is invalid, report why a62c24a
@buildhive

R. Tyler Croy » blimpy #78 FAILURE
Looks like there's a problem with this pull request
(what's this?)

@rtyler rtyler merged commit cf15db8 into rtyler:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 29, 2013
  1. @kohsuke

    Adding multi-file scp

    kohsuke authored
  2. @kohsuke

    only works with Ruby 1.9+

    kohsuke authored
  3. @kohsuke

    SSH returns 255 for connection refused errors.

    kohsuke authored
    So limiting the range down a bit.
  4. @kohsuke

    Making it work again with fog 1.10

    kohsuke authored
    in 1.9, the original code was sufficient, but 1.10 has a massive
    refactoring in the way of registering providers. Unless at least one
    provider is registered, the providers hash is empty, and it causes
    an exception like the following:
    
    /var/lib/gems/1.8/gems/fog-1.10.0/lib/fog/compute.rb:39:in `new': undefined method `include?' for nil:NilClass (NoMethodError)
        from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/boxes/aws.rb:39:in `fog'
        from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/boxes/aws.rb:32:in `validate!'
        from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/fleet.rb:110:in `start'
        from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/fleet.rb:109:in `each'
        from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/fleet.rb:109:in `start'
        from /home/kohsuke/ws/cloudbees/blimpy/lib/blimpy/cli.rb:73:in `start'
        from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/command.rb:27:in `__send__'
        from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/command.rb:27:in `run'
        from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/invocation.rb:120:in `invoke_command'
        from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor.rb:363:in `dispatch'
        from /var/lib/gems/1.8/gems/thor-0.18.0/lib/thor/base.rb:427:in `start'
        from /home/kohsuke/ws/cloudbees/blimpy/bin/blimpy:24
    
    By forcing the registration of a provider, it works against with fog
    1.10. Looking at the source tree, this change should also work with fog
    1.9.
  5. @kohsuke

    Fixed a system/local conflict problem

    kohsuke authored
    If blimpy gem is already installed, this ends up picking blimpy from the installed gem, as opposed to the local workspace.
  6. @kohsuke

    Fixing the unit test failure

    kohsuke authored
    Since these tests do not use any livery, explicit wait_for_ssh command
    is required
  7. @kohsuke
This page is out of date. Refresh to see the latest.
View
8 bin/blimpy
@@ -10,12 +10,8 @@ rescue NameError
# I don't think we have YAML::ENGINE until Ruby 1.9
end
-begin
- require 'blimpy/cli'
-rescue LoadError
- $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/')
- require 'blimpy/cli'
-end
+$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib/')
+require 'blimpy/cli'
# allow monkey-patching of Blimpy by the project (mainly to add more commands)
blimprc = File.join(Dir.pwd,"Blimprc")
View
6 features/cli/scp.feature
@@ -13,7 +13,8 @@ Feature: SCP a file into a named VM
end
"""
And I have a file named "hello.txt"
- When I run `blimpy scp Gherkins hello.txt`
+ When I run `blimpy wait_for_ssh`
+ And I run `blimpy scp Gherkins hello.txt`
Then the exit status should be 1
And the output should contain:
"""
@@ -34,5 +35,6 @@ Feature: SCP a file into a named VM
"""
And I have a file named "hello.txt"
And I run `blimpy start`
- When I run `blimpy scp "Cucumber Host" hello.txt`
+ When I run `blimpy wait_for_ssh`
+ And I run `blimpy scp "Cucumber Host" hello.txt`
Then the exit status should be 0
View
3  features/cli/ssh.feature
@@ -12,7 +12,8 @@ Feature: SSH into a named VM
end
end
"""
- When I run `blimpy ssh Gherkins`
+ When I run `blimpy wait_for_ssh`
+ And I run `blimpy ssh Gherkins`
Then the exit status should be 1
And the output should contain:
"""
View
1  features/step_definitions/cli_steps.rb
@@ -34,6 +34,7 @@
When /^I ssh into the machine$/ do
step %{I run `blimpy start`}
+ step %{I run `blimpy wait_for_ssh`}
step %{I run `blimpy ssh "Cucumber Host" -o StrictHostKeyChecking=no` interactively}
end
View
2  features/support/env.rb
@@ -1,7 +1,7 @@
require 'rubygems'
require 'aruba/cucumber'
require 'fileutils'
-require 'ruby-debug'
+require 'ruby-debug' unless RUBY_VERSION =~ /1.8.+/
require 'temp_dir'
View
7 lib/blimpy/box.rb
@@ -210,6 +210,11 @@ def scp_file(filename, directory='', *args)
filename, "#{username}@#{dns}:#{directory}", *args)
end
+ def scp_files(directory, files)
+ filename = File.expand_path(filename)
+ run_command(*['scp', '-o', 'StrictHostKeyChecking=no']+files+["#{username}@#{dns}:#{directory}"])
+ end
+
def bootstrap_livery
if @livery.kind_of? Symbol
raise Blimpy::InvalidLiveryException, 'Symbol liveries are unsupported!'
@@ -236,7 +241,7 @@ def wait_for_sshd
# Run the `true` command and exit
@ssh_connected = ssh_into('-q', 'true')
# if SSH is killed (such as Ctrl+C), abort right away
- raise Exception, "ssh was killed: #{$?.exitstatus}" if $?.exitstatus>128
+ raise Exception, "ssh was killed: #{$?.exitstatus}" if $?.exitstatus>128 && $?.exitstatus<200
unless @ssh_connected
if (Time.now.to_i - start) < 60
View
1  lib/blimpy/boxes/aws.rb
@@ -1,5 +1,6 @@
require 'blimpy/box'
require 'blimpy/boxes'
+require 'fog/aws'
module Blimpy::Boxes
class AWS < Blimpy::Box
View
1  lib/blimpy/boxes/openstack.rb
@@ -1,5 +1,6 @@
require 'blimpy/box'
require 'blimpy/boxes'
+require 'fog/openstack'
module Blimpy::Boxes
class OpenStack < Blimpy::Box
View
1  lib/blimpy/cli.rb
@@ -62,6 +62,7 @@ def start
fleet = load_blimpfile
rescue Blimpy::InvalidBlimpFileError => e
puts "The Blimpfile is invalid!"
+ puts e.to_s
exit 1
end
Something went wrong with that request. Please try again.