-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #252 from nsidc/suspend-resume
Suspend and Resume commands
- Loading branch information
Showing
17 changed files
with
241 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 1.12.1 | ||
current_version = 1.13.0 | ||
tag = true | ||
commit = true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.3.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
language: ruby | ||
cache: bundler | ||
rvm: | ||
- 2.2.3 | ||
- 2.3.5 | ||
|
||
before_install: | ||
- rvm @global do gem uninstall bundler --all --executables | ||
- gem uninstall bundler --all --executables | ||
- gem install bundler --version '1.12.5' | ||
- gem install bundler --version '1.15.4' | ||
|
||
sudo: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module VagrantPlugins | ||
module VSphere | ||
module Action | ||
class IsSuspended | ||
def initialize(app, _env) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
env[:result] = env[:machine].state.id == :suspended | ||
@app.call env | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'i18n' | ||
|
||
module VagrantPlugins | ||
module VSphere | ||
module Action | ||
class MessageNotSuspended | ||
def initialize(app, _env) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
env[:ui].info I18n.t('vsphere.vm_not_suspended') | ||
@app.call(env) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'rbvmomi' | ||
require 'i18n' | ||
require 'vSphere/util/vim_helpers' | ||
require 'vSphere/util/vm_helpers' | ||
|
||
module VagrantPlugins | ||
module VSphere | ||
module Action | ||
class Resume | ||
include Util::VimHelpers | ||
include Util::VmHelpers | ||
|
||
def initialize(app, _env) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
vm = get_vm_by_uuid env[:vSphere_connection], env[:machine] | ||
|
||
if suspended?(vm) | ||
env[:ui].info I18n.t('vsphere.resume_vm') | ||
resume_vm(vm) | ||
end | ||
|
||
@app.call env | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'rbvmomi' | ||
require 'i18n' | ||
require 'vSphere/util/vim_helpers' | ||
require 'vSphere/util/vm_helpers' | ||
|
||
module VagrantPlugins | ||
module VSphere | ||
module Action | ||
class Suspend | ||
include Util::VimHelpers | ||
include Util::VmHelpers | ||
|
||
def initialize(app, _env) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
vm = get_vm_by_uuid env[:vSphere_connection], env[:machine] | ||
|
||
# Suspending is a no-op if we can't find the VM or it is already off | ||
# or suspended | ||
unless vm.nil? || suspended?(vm) || powered_off?(vm) | ||
env[:ui].info I18n.t('vsphere.suspend_vm') | ||
suspend_vm(vm) | ||
end | ||
|
||
@app.call env | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module VagrantPlugins | ||
module VSphere | ||
VERSION = '1.12.1' | ||
VERSION = '1.13.0' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters