Module: VagrantPlugins::Utm::Cap
- Defined in:
- lib/vagrant_utm/cap.rb,
lib/vagrant_utm/cap/mount_options.rb
Overview
Contains all the supported capabilities of the UTM provider.
Defined Under Namespace
Modules: MountOptions
Class Method Summary collapse
-
.forwarded_ports(machine) ⇒ Hash<Integer, Integer>
Reads the forwarded ports that currently exist on the machine itself.
-
.snapshot_list(machine) ⇒ Array<String>
Returns a list of the snapshots that are taken on this machine.
Class Method Details
.forwarded_ports(machine) ⇒ Hash<Integer, Integer>
Reads the forwarded ports that currently exist on the machine itself. This raises an exception if the machine isn’t running (UTM ‘started’).
This also may not match up with configured forwarded ports, because Vagrant auto port collision fixing may have taken place.
14 15 16 17 18 19 20 21 22 |
# File 'lib/vagrant_utm/cap.rb', line 14 def self.forwarded_ports(machine) return nil if machine.state.id != :started {}.tap do |result| machine.provider.driver.read_forwarded_ports.each do |_, _, h, g| result[h] = g end end end |
.snapshot_list(machine) ⇒ Array<String>
Returns a list of the snapshots that are taken on this machine.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vagrant_utm/cap.rb', line 27 def self.snapshot_list(machine) return [] if machine.id.nil? begin machine.provider.driver.list_snapshots(machine.id) rescue VagrantPlugins::Utm::Errors::CommandError => e raise Errors::SnapShotCommandFailed, { stderr: e.inspect } end end |