Expose the resume functionality through a specific CLI command
Fixes #57
This commit is contained in:
parent
302e0ea555
commit
4f4bc39850
|
@ -0,0 +1,17 @@
|
|||
Feature: Resume a VM or VMs that were previously stopped
|
||||
|
||||
Scenario: Resume without stopped Blimps
|
||||
Given I have the Blimpfile:
|
||||
"""
|
||||
Blimpy.fleet do |f|
|
||||
f.add(:aws) do |host|
|
||||
host.name = 'Cucumber Host'
|
||||
end
|
||||
end
|
||||
"""
|
||||
When I run `blimpy resume`
|
||||
Then the exit status should be 1
|
||||
And the output should contain:
|
||||
"""
|
||||
No fleet running right now, perhaps you should `start` one.
|
||||
"""
|
|
@ -52,17 +52,25 @@ module Blimpy
|
|||
end
|
||||
data
|
||||
end
|
||||
|
||||
def load_fleet
|
||||
ensure_blimpfile
|
||||
begin
|
||||
return load_blimpfile
|
||||
rescue Blimpy::InvalidBlimpFileError => e
|
||||
puts "The Blimpfile is invalid!"
|
||||
puts e.to_s
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc 'start', 'Start up a fleet of blimps'
|
||||
method_options :"dry-run" => :boolean
|
||||
def start
|
||||
ensure_blimpfile
|
||||
begin
|
||||
fleet = load_blimpfile
|
||||
rescue Blimpy::InvalidBlimpFileError => e
|
||||
puts "The Blimpfile is invalid!"
|
||||
puts e.to_s
|
||||
fleet = load_fleet
|
||||
|
||||
if fleet.nil?
|
||||
exit 1
|
||||
end
|
||||
|
||||
|
@ -74,6 +82,22 @@ module Blimpy
|
|||
fleet.start
|
||||
end
|
||||
|
||||
desc 'resume', 'Resume an existing fleet of instances'
|
||||
def resume
|
||||
fleet = load_fleet
|
||||
|
||||
if fleet.nil?
|
||||
exit 1
|
||||
end
|
||||
|
||||
if fleet.members.empty?
|
||||
puts "No fleet running right now, perhaps you should `start` one."
|
||||
exit 1
|
||||
else
|
||||
fleet.resume(fleet.members)
|
||||
end
|
||||
end
|
||||
|
||||
desc 'show', 'Show blimp details for running blimps'
|
||||
method_options :tags => :boolean
|
||||
def show
|
||||
|
|
Loading…
Reference in New Issue