libvirtinator 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/libvirtinator/config.rb +2 -2
- data/lib/libvirtinator/vm.rb +20 -0
- metadata +2 -2
data/lib/libvirtinator/config.rb
CHANGED
@@ -7,7 +7,8 @@ module Capistrano
|
|
7
7
|
"libvirtinator:install_vm",
|
8
8
|
"image:list_bases",
|
9
9
|
"image:build_base",
|
10
|
-
"users:setup_domain"
|
10
|
+
"users:setup_domain",
|
11
|
+
"all_do"
|
11
12
|
]
|
12
13
|
end
|
13
14
|
end
|
@@ -15,7 +16,6 @@ end
|
|
15
16
|
|
16
17
|
namespace :libvirtinator do
|
17
18
|
task :load_settings do
|
18
|
-
# load "./config/deploy.rb" # this seems unneeded and to cause tasks to run twice, previously i thought it was needed
|
19
19
|
SSHKit.config.output_verbosity = fetch(:log_level)
|
20
20
|
end
|
21
21
|
|
data/lib/libvirtinator/vm.rb
CHANGED
@@ -2,6 +2,25 @@ require 'socket'
|
|
2
2
|
require 'timeout'
|
3
3
|
require 'erb'
|
4
4
|
|
5
|
+
desc "Run any Capistrano task on all the machines in 'config/deploy/*' one at a time; Usage: `cap all_do task='uptime'`"
|
6
|
+
task :all_do do
|
7
|
+
run_locally do
|
8
|
+
tsk = ENV['task']
|
9
|
+
if tsk.nil? or tsk.empty?
|
10
|
+
fatal "task is unset, try `cap all_do task=\"uptime\"`"
|
11
|
+
next
|
12
|
+
end
|
13
|
+
exec("for machine in $(ls config/deploy/ | cut -c 1-7); do bundle exec cap $machine #{tsk}; if ! [ $? -eq 0 ]; then touch $machine.fail; fi; done")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run the uptime command on the VM"
|
18
|
+
task :uptime do
|
19
|
+
on "#{fetch(:user)}@#{fetch(:app_fqdn)}" do
|
20
|
+
info("#{capture("uptime")} - on #{fetch(:app_fqdn)}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
5
24
|
desc "Check the current status of a VM"
|
6
25
|
task :status => 'libvirtinator:load_settings' do
|
7
26
|
on roles(:app) do
|
@@ -58,6 +77,7 @@ task :start => 'libvirtinator:load_settings' do
|
|
58
77
|
Rake::Task['wait_for_ssh_alive'].invoke
|
59
78
|
# TODO make users:setup offer a yes/no try-again when a specified key doesn't work to connect.
|
60
79
|
# TODO make users:setup failure invoke notice "don't worry, you can resume setting up users with 'cap <stage> users:setup'"
|
80
|
+
sleep 2 # wait for SSH to finish booting
|
61
81
|
Rake::Task['users:setup'].invoke
|
62
82
|
info "Say, you don't say? Are we finished?"
|
63
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libvirtinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|