vagrant-ip-show 0.0.2 → 0.0.3
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/lib/vagrant-ip-show/command.rb +18 -6
- data/lib/vagrant-ip-show/version.rb +2 -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: 0f0438243713e1af20f1a49554cd59b0c3685dfc
|
4
|
+
data.tar.gz: c27b2088efa44d5154bd000d35d094ebf64a56d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab346f59ec61a08ae33c74a69ca0719e7c30365f7122d9cbdaaabde97d3bb313abb14f22a6d1b39b7657a7119bba798fa28bafb169cf31c58395f113c17c0ba3
|
7
|
+
data.tar.gz: a2de3270260bfb2e2ca02f27e1b6ba213acb9f4622dac9844e9f0d21ae4e2ea5df69498f15c412b6292ff7b435cf0f8088de982b7d6650ee589736bde541125c
|
@@ -2,20 +2,32 @@
|
|
2
2
|
module Vagrant
|
3
3
|
module IpShow
|
4
4
|
class Command < Vagrant.plugin('2', :command)
|
5
|
+
def self.synopsis
|
6
|
+
"show all VM ip addresses"
|
7
|
+
end
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
+
def execute
|
10
|
+
options = {}
|
11
|
+
opts = OptionParser.new do |o|
|
12
|
+
o.banner = "Usage: vagrant ip-show [vmname]"
|
13
|
+
o.separator ""
|
14
|
+
o.separator "Options:"
|
15
|
+
o.separator ""
|
16
|
+
end
|
17
|
+
|
18
|
+
# Parse the options and return if we don't have any target.
|
19
|
+
argv = parse_options(opts)
|
20
|
+
return if !argv
|
9
21
|
|
22
|
+
# Execute the actual SSH
|
23
|
+
with_target_vms(argv, single_target: true) do |vm|
|
10
24
|
@logger.info("Getting ips of vm networks")
|
11
25
|
ssh_opts = {extra_args: ['-q']} # make it quiet
|
12
26
|
env = vm.action(:ssh_run, ssh_run_command: "/sbin/ifconfig | grep 'inet addr:' | grep -v 127.0.0.1 | sed -e 's/Bcast//' | cut -d: -f2", ssh_opts: ssh_opts)
|
13
|
-
|
14
27
|
status = env[:ssh_run_exit_status] || 0
|
15
28
|
return status
|
16
29
|
end
|
17
30
|
end
|
18
31
|
end
|
19
|
-
end
|
20
|
-
|
32
|
+
end
|
21
33
|
end
|