sistero 0.7.4 → 0.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c966aa5e013e4a912ed85572ea3df024ba5b3552
4
- data.tar.gz: e3a8f4a357ad77c63cb781c13b3a6700377ea798
3
+ metadata.gz: 60c3c0cce22325698cd6ada1765e6e771f700a52
4
+ data.tar.gz: 772c3c63c9a2d22b0fb956f419611eba03465a5d
5
5
  SHA512:
6
- metadata.gz: 85c52cd18afca7958e0a30991238cc737381f22eb6b5f6eb81c198483410ac77647788fcd06d8cae6b924c81d5fe4b4f9491b0b0a269e436c4af6b3ab539e5c3
7
- data.tar.gz: cc127f77567046ba6ad2ffdd2aa904741c87b89fa96efad279401ff934d6efdbca52399f07d4d5c7b136c4a81702ae4abd64adc898891767996e62ad0b27e311
6
+ metadata.gz: 2604863ec2d2c06d905172ac59964f7b19ea9317e8dd9856a635d469a26474134684585797bc8f02880748fed640276970c10ed94a31e8ad99f1743d9209a73f
7
+ data.tar.gz: ddc8a02f965185ca02af3d0b5ad3a0d06c5da1d2a1a8f17ed722645fc2b817af24000c1e3c286b0ab989ef46991fb24f8f6a3dae409d787c30b7204ed82c0e00
@@ -28,7 +28,7 @@ module Sistero::Command
28
28
  subop.on '-o val', 'add ssh options', 'ssh_options'
29
29
  end
30
30
 
31
- op.subcommand 'rsync vm *cmd', 'rsync files to vm'
31
+ op.subcommand 'rsync vm *cmd', 'rsync files to/from vm'
32
32
 
33
33
  op.subcommand 'create [*vms]', 'create vm'
34
34
  op.subcommand 'create-all', 'create all vms in config'
@@ -10,12 +10,12 @@ module Sistero
10
10
  end
11
11
 
12
12
  def find_droplet(name)
13
- @client.droplets.all.find { |vm| vm.name == name }
13
+ @client.droplets.all.find { |droplet| droplet.name == name }
14
14
  end
15
15
 
16
16
  def list_vms()
17
- @client.droplets.all.each do |vm|
18
- puts "#{vm.name} - #{vm.networks[0][0].ip_address}"
17
+ @client.droplets.all.each do |droplet|
18
+ puts "#{droplet.name} - #{get_public_ip droplet}"
19
19
  end
20
20
  end
21
21
 
@@ -70,10 +70,10 @@ module Sistero
70
70
  ssh_options ||= vm.ssh_options
71
71
 
72
72
  droplet = find_droplet(name) || create_droplet_from_vm(name)
73
- public_network = get_public_network name, droplet
74
- ip = wait_for_ssh_port public_network
73
+ public_ip = get_public_ip droplet
74
+ wait_for_ssh_port public_ip
75
75
 
76
- cmd = "ssh -o 'StrictHostKeyChecking no' #{ssh_options} #{vm.ssh_user || 'root'}@#{ip}"
76
+ cmd = "ssh -o 'StrictHostKeyChecking no' #{ssh_options} #{vm.ssh_user || 'root'}@#{public_ip}"
77
77
  unless run.empty?
78
78
  cmd += ' ' + run.join(' ')
79
79
  end
@@ -85,10 +85,10 @@ module Sistero
85
85
  def rsync(name, cmd: nil)
86
86
  vm, name = get_vm name
87
87
  droplet = find_droplet(name) || create_droplet_from_vm(name)
88
- public_network = get_public_network name, droplet
89
- ip = wait_for_ssh_port public_network
88
+ public_ip = get_public_ip droplet
89
+ wait_for_ssh_port public_ip
90
90
 
91
- cmd_str = 'rsync ' + cmd.join(' ').gsub('vm:', "#{vm.ssh_user || 'root'}@#{ip}:")
91
+ cmd_str = 'rsync ' + cmd.join(' ').gsub('vm:', "#{vm.ssh_user || 'root'}@#{public_ip}:")
92
92
  exec cmd_str
93
93
  end
94
94
 
@@ -145,27 +145,25 @@ module Sistero
145
145
  end
146
146
 
147
147
  private
148
- def get_public_network name, droplet
148
+ def get_public_ip droplet
149
149
  public_network = droplet.networks.v4.find { |network| network.type == 'public' }
150
150
  until public_network
151
151
  puts "no public interfaces, trying again in a second"
152
152
  sleep 1
153
- droplet = find_droplet(name)
153
+ droplet = find_droplet(droplet.name)
154
154
  public_network = droplet.networks.v4.find { |network| network.type == 'public' }
155
155
  end
156
- public_network
156
+ public_network.ip_address
157
157
  end
158
158
 
159
- def wait_for_ssh_port public_network
160
- ip = public_network.ip_address
161
- unless is_port_open? ip, 22
159
+ def wait_for_ssh_port public_ip
160
+ unless is_port_open? public_ip, 22
162
161
  puts "waiting for ssh port to open"
163
162
  sleep 1
164
- until is_port_open? ip, 22 do
163
+ until is_port_open? public_ip, 22 do
165
164
  sleep 1
166
165
  end
167
166
  end
168
- ip
169
167
  end
170
168
  end
171
169
  end
@@ -1,3 +1,3 @@
1
1
  module Sistero
2
- VERSION = '0.7.4'
2
+ VERSION = '0.8.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sistero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pike
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-18 00:00:00.000000000 Z
11
+ date: 2016-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler