sistero 0.5.1 → 0.5.2
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.
- checksums.yaml +4 -4
- data/bin/sistero +3 -0
- data/lib/sistero/config.rb +2 -1
- data/lib/sistero/version.rb +1 -1
- data/lib/sistero.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38f5511f4f294392cf8f402b743843753b9cb6f4
|
4
|
+
data.tar.gz: e482a41c9897c7d73d01983b9fef837d32f29e38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef5128eff74b37fd80d6606eba1df456c51a2edbd7012d884ad1d321456308c5e67b7509373f4746535eac515dddc74e06de54e9e1e61ea5859c0c64bc226852
|
7
|
+
data.tar.gz: e5583c776874bcd325987971ea3f0823e046532fa73201fd659e44dfbff242a4f3706553416ed716a6b523189b34c3e60d7b53b0eb0281e91c8509e9f609aa61
|
data/bin/sistero
CHANGED
@@ -26,6 +26,7 @@ module Sistero::Command
|
|
26
26
|
end
|
27
27
|
|
28
28
|
op.subcommand 'create [*vms]', 'create vm'
|
29
|
+
op.subcommand 'create-all', 'create all vms in profile'
|
29
30
|
op.subcommand 'destroy [*vms]', 'destroy vm'
|
30
31
|
op.subcommand 'list', 'list vms'
|
31
32
|
op.subcommand 'show-config', 'show configuration'
|
@@ -55,6 +56,8 @@ module Sistero::Command
|
|
55
56
|
vms = command_cfg.vms
|
56
57
|
vms.push nil if vms.empty?
|
57
58
|
vms.each &sistero.method(:create_vm)
|
59
|
+
when 'create-all'
|
60
|
+
sistero.create_all()
|
58
61
|
when 'destroy'
|
59
62
|
vms = command_cfg.vms
|
60
63
|
vms.push nil if vms.empty?
|
data/lib/sistero/config.rb
CHANGED
@@ -2,7 +2,8 @@ require "yaml"
|
|
2
2
|
APP_NAME = "sistero"
|
3
3
|
|
4
4
|
module Sistero
|
5
|
-
PROFILE_KEYS = [:vm_name, :vm_size, :vm_region, :vm_image, :access_token, :
|
5
|
+
PROFILE_KEYS = [:vm_name, :vm_size, :vm_region, :vm_image, :access_token, :ssh_user,
|
6
|
+
:ssh_keys, :ssh_options, :user_data, :private_networking]
|
6
7
|
|
7
8
|
Profile = Struct.new(*PROFILE_KEYS) do
|
8
9
|
def to_s
|
data/lib/sistero/version.rb
CHANGED
data/lib/sistero.rb
CHANGED
@@ -34,13 +34,21 @@ module Sistero
|
|
34
34
|
region: profile.vm_region,
|
35
35
|
size: profile.vm_size,
|
36
36
|
image: profile.vm_image,
|
37
|
-
ssh_keys: profile.ssh_keys
|
37
|
+
ssh_keys: profile.ssh_keys,
|
38
|
+
user_data: profile.user_data,
|
39
|
+
private_networking: profile.private_networking
|
38
40
|
)
|
39
41
|
vm = @client.droplets.create(vm)
|
40
42
|
puts "created: #{profile.to_s}"
|
41
43
|
vm
|
42
44
|
end
|
43
45
|
|
46
|
+
def create_all
|
47
|
+
@config.profiles.each do |profile|
|
48
|
+
create_vm profile.vm_name
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
44
52
|
def is_port_open?(ip, port)
|
45
53
|
begin
|
46
54
|
Timeout::timeout(1) do
|
@@ -79,7 +87,7 @@ module Sistero
|
|
79
87
|
end
|
80
88
|
end
|
81
89
|
|
82
|
-
cmd = "ssh -o 'StrictHostKeyChecking no' #{ssh_options} root@#{ip}"
|
90
|
+
cmd = "ssh -o 'StrictHostKeyChecking no' #{ssh_options} #{profile.ssh_user || 'root'}@#{ip}"
|
83
91
|
puts cmd
|
84
92
|
exec cmd
|
85
93
|
end
|