Sha256: 62d779043a3a300f65a35334640bb11f4aec896bea5c64fabc6e3443d536864d
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
# lib/vagrant-ip-show/command.rb module Vagrant module IpShow class Command < Vagrant.plugin('2', :command) def self.synopsis "show all VM ip addresses" end def execute options = {} opts = OptionParser.new do |o| o.banner = "Usage: vagrant ip-show [vmname]" o.separator "" o.separator "Options:" o.separator "" end # Parse the options and return if we don't have any target. argv = parse_options(opts) return if !argv # Execute the actual SSH with_target_vms(argv, single_target: true) do |vm| @logger.info("Getting ips of vm networks") ssh_opts = {extra_args: ['-q']} # make it quiet env = vm.action(:ssh_run, ssh_run_command: "ip a | grep 'inet ' | awk '{ print $2}' | grep -v 127.0.0.1 | cut -d/ -f1", ssh_opts: ssh_opts) status = env[:ssh_run_exit_status] || 0 return status end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-ip-show-0.0.4 | lib/vagrant-ip-show/command.rb |