vagrant_utm 0.0.1 → 0.1.1

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -3
  3. data/README.md +1 -3
  4. data/docs/_config.yml +5 -6
  5. data/docs/assets/images/screens/debian-10.4-i3-arm64.png +0 -0
  6. data/docs/boxes/creating_utm_box.md +46 -19
  7. data/docs/boxes/utm_box_gallery.md +17 -93
  8. data/docs/commands.md +12 -8
  9. data/docs/configuration.md +13 -3
  10. data/docs/features/synced_folders.md +1 -1
  11. data/docs/index.md +28 -14
  12. data/docs/internals/utm_api.md +0 -1
  13. data/docs/known_issues.md +6 -6
  14. data/lib/vagrant_utm/action/export.rb +26 -5
  15. data/lib/vagrant_utm/action/import.rb +24 -14
  16. data/lib/vagrant_utm/action/ip_address.rb +33 -0
  17. data/lib/vagrant_utm/action/match_mac_address.rb +37 -0
  18. data/lib/vagrant_utm/action/package.rb +22 -0
  19. data/lib/vagrant_utm/action/package_setup_files.rb +22 -0
  20. data/lib/vagrant_utm/action/package_setup_folders.rb +24 -0
  21. data/lib/vagrant_utm/action/package_vagrantfile.rb +39 -0
  22. data/lib/vagrant_utm/action/set_id.rb +1 -1
  23. data/lib/vagrant_utm/action.rb +45 -19
  24. data/lib/vagrant_utm/commands/disposable.rb +29 -0
  25. data/lib/vagrant_utm/commands/ip_address.rb +28 -0
  26. data/lib/vagrant_utm/config.rb +1 -10
  27. data/lib/vagrant_utm/driver/base.rb +26 -6
  28. data/lib/vagrant_utm/driver/meta.rb +5 -3
  29. data/lib/vagrant_utm/driver/version_4_5.rb +16 -4
  30. data/lib/vagrant_utm/driver/version_4_6.rb +42 -0
  31. data/lib/vagrant_utm/model/forwarded_port.rb +3 -1
  32. data/lib/vagrant_utm/plugin.rb +11 -8
  33. data/lib/vagrant_utm/provider.rb +2 -1
  34. data/lib/vagrant_utm/scripts/export_vm.applescript +13 -0
  35. data/lib/vagrant_utm/scripts/import_vm.applescript +14 -0
  36. data/lib/vagrant_utm/scripts/read_forwarded_ports.applescript +1 -1
  37. data/lib/vagrant_utm/scripts/read_network_interfaces.applescript +2 -1
  38. data/lib/vagrant_utm/scripts/set_mac_address.applescript +25 -0
  39. data/lib/vagrant_utm/version.rb +1 -1
  40. data/lib/vagrant_utm.rb +1 -0
  41. data/locales/en.yml +9 -0
  42. data/notes/README.md +30 -0
  43. data/vagrantfile_examples/Vagrantfile +3 -2
  44. metadata +16 -5
  45. data/lib/vagrant_utm/action/download_confirm.rb +0 -19
  46. data/lib/vagrant_utm/disposable.rb +0 -16
  47. data/lib/vagrant_utm/scripts/read_guest_ip.applescript +0 -9
@@ -0,0 +1,13 @@
1
+ # Usage: osascript export_vm.applescript <vmUUID> <filePath>
2
+ # vmID is the uuid of the virtual machine
3
+ # filePath is the path where the exported file will be saved
4
+ on run argv
5
+ set vmID to item 1 of argv
6
+ set exportPath to item 2 of argv
7
+ set exportFile to POSIX file exportPath
8
+
9
+ tell application "UTM"
10
+ set vm to virtual machine id vmID
11
+ export vm to exportFile
12
+ end tell
13
+ end run
@@ -0,0 +1,14 @@
1
+ # Usage: osascript import_vm.applescript <filePath>
2
+ # filePath is the path of the file to import
3
+ # Returns the imported virtual machine
4
+ on run argv
5
+ set importFile to item 1 of argv
6
+ -- Convert the file path to a POSIX file
7
+ -- This should be done outside the tell block
8
+ set vmFile to POSIX file importFile
9
+
10
+ tell application "UTM"
11
+ set vm to import new virtual machine from vmFile
12
+ return vm
13
+ end tell
14
+ end run
@@ -1,4 +1,4 @@
1
- # Usage: osascript read_port_forwards.applescript <vmID>
1
+ # Usage: osascript read_forwarded_ports.applescript <vmID>
2
2
  # vmID is the id of the virtual machine
3
3
  # This script reads the port forwards of the 'emulated' network interface
4
4
  # 'Forwarding(nicIndex)(ruleIndex)="protocol,guestAddress,guestPort,hostAddress,hostPort"'
@@ -5,7 +5,8 @@ on run argv
5
5
  set config to configuration of vm
6
6
  set networkInterfaces to network interfaces of config
7
7
  repeat with anInterface in networkInterfaces
8
- # if you start log with variable you'll get "," at the end of the log if '&' is used to concatenate
8
+ # if you start log with variable you'll get "," at the end of the log so '&' is used to concatenate
9
+ # Example output: nic0,shared
9
10
  log "nic" & index of anInterface & "," & mode of anInterface
10
11
  end repeat
11
12
  end tell
@@ -0,0 +1,25 @@
1
+ # This script sets the MAC address of a network interface in a specified UTM virtual machine.
2
+ # Usage: osascript set_mac_address.applescript <VM_UUID> <NIC_INDEX> <MAC_ADDRESS>
3
+ # Example: osascript set_mac_address.applescript A123 1 XX:XX:XX:XX:XX:XX
4
+ on run argv
5
+ set vmID to item 1 of argv
6
+ set nicIndex to item 2 of argv
7
+ set macAddress to item 3 of argv
8
+
9
+ tell application "UTM"
10
+ set vm to virtual machine id vmID
11
+ set config to configuration of vm
12
+ set networkInterfaces to network interfaces of config
13
+
14
+ repeat with anInterface in networkInterfaces
15
+ if nicIndex as integer is index of anInterface then
16
+ -- Set the provided MAC address
17
+ set address of anInterface to macAddress
18
+ end if
19
+ end repeat
20
+
21
+ -- Update the VM configuration
22
+ update configuration of vm with config
23
+ end tell
24
+
25
+ end run
@@ -4,6 +4,6 @@ module VagrantPlugins
4
4
  # Top level module for the Utm provider plugin.
5
5
  module Utm
6
6
  # Current version of the Utm provider plugin.
7
- VERSION = "0.0.1"
7
+ VERSION = "0.1.1"
8
8
  end
9
9
  end
data/lib/vagrant_utm.rb CHANGED
@@ -16,6 +16,7 @@ module VagrantPlugins
16
16
  lib_path = Pathname.new(File.expand_path("vagrant_utm/driver", __dir__))
17
17
  autoload :Meta, lib_path.join("meta")
18
18
  autoload :Version_4_5, lib_path.join("version_4_5") # rubocop:disable Naming/VariableNumber
19
+ autoload :Version_4_6, lib_path.join("version_4_6") # rubocop:disable Naming/VariableNumber
19
20
  end
20
21
 
21
22
  # Drop some autoloads for the model classes
data/locales/en.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  en:
2
2
  vagrant_utm:
3
3
  config:
4
+ # Deprecated Configuration field
4
5
  utm_file_url_required: |-
5
6
  Configuration must specify utm.file_url.
6
7
  UTM file URL is required to import the UTM virtual machine.
@@ -148,7 +149,15 @@ en:
148
149
  WARNING: The UTM virtual machine is booting in disposable mode.
149
150
  Changes made to the VM will be lost when the VM is powered off.
150
151
  Learn more at https://docs.getutm.app/advanced/disposable/
152
+ ip_address:
153
+ reading: |-
154
+ Getting IP address of UTM virtual machine...
155
+ show: |-
156
+ Guest IP address(es):
157
+ not_found: |-
158
+ IP address not found. The VM may not have guest tools or may not have an IP address.
151
159
  snapshot:
152
160
  list: |-
153
161
  Listing snapshots for UTM virtual machine...
162
+
154
163
 
data/notes/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Notes
2
+
3
+ This directory will hold documentation about the project.
4
+
5
+
6
+ # Development
7
+
8
+ To invoke vagrant with the plugin in development
9
+ ```bash
10
+ bundle exec vagrant <command> --debug
11
+ ```
12
+
13
+ To locally launch docs site
14
+ ```bash
15
+ cd docs
16
+ bundle exec jekyll serve
17
+ ```
18
+
19
+ To release
20
+
21
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`
22
+ GitHub action upon tag push with "v*" will publish gem to GHR and rubygems
23
+
24
+ 1. Update the version number in `version.rb`
25
+ 2. Run `bundle exec rake release`
26
+ 3. Commit version and Gemlock file
27
+ 4. Run `bundle exec rake release` again
28
+ 5. Cancel push to rubygems.org
29
+
30
+ GHA will publish gems to GHR and rubygems
@@ -4,18 +4,19 @@
4
4
  # vi: set ft=ruby :
5
5
 
6
6
  Vagrant.configure("2") do |config|
7
+ config.vm.box = "utm/debian11"
8
+ config.vm.box_version = "0.0.1"
7
9
  # hostname inside the VM
8
10
  config.vm.hostname = "utm"
9
11
  config.vm.network "forwarded_port", guest: 80, host: 8989
10
12
  config.vm.provider :utm do |utm|
11
13
  # Name in UTM UI
12
14
  # utm.name = "debian"
13
- # UTM VM file
14
- utm.utm_file_url = "http://localhost:8000/debian_vagrant_utm.zip"
15
15
  utm.memory = 512
16
16
  utm.cpus = 1
17
17
  utm.notes = "Vagrant: For testing plugin development"
18
18
  # Wait time in secs for VM to be running after 'started'
19
+ # Currently, not used and we rely on the built-in wait for communicator(ssh) to be ready
19
20
  utm.wait_time = 22
20
21
  # QEMU Directoy Share mode for the VM
21
22
  utm.directory_share_mode = "webDAV"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant_utm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naveenraj M
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-09 00:00:00.000000000 Z
11
+ date: 2024-12-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Vagrant UTM provider that allows you to manage UTM virtual machines.
14
14
  email:
@@ -35,6 +35,7 @@ files:
35
35
  - docs/assets/images/favicon.ico
36
36
  - docs/assets/images/logo.png
37
37
  - docs/assets/images/screens/archlinux-logo.png
38
+ - docs/assets/images/screens/debian-10.4-i3-arm64.png
38
39
  - docs/assets/images/screens/debian-11-xfce-arm64.png
39
40
  - docs/boxes/creating_utm_box.md
40
41
  - docs/boxes/index.md
@@ -63,20 +64,25 @@ files:
63
64
  - lib/vagrant_utm/action/created.rb
64
65
  - lib/vagrant_utm/action/customize.rb
65
66
  - lib/vagrant_utm/action/destroy.rb
66
- - lib/vagrant_utm/action/download_confirm.rb
67
67
  - lib/vagrant_utm/action/export.rb
68
68
  - lib/vagrant_utm/action/forced_halt.rb
69
69
  - lib/vagrant_utm/action/forward_ports.rb
70
70
  - lib/vagrant_utm/action/import.rb
71
+ - lib/vagrant_utm/action/ip_address.rb
71
72
  - lib/vagrant_utm/action/is_paused.rb
72
73
  - lib/vagrant_utm/action/is_running.rb
73
74
  - lib/vagrant_utm/action/is_stopped.rb
75
+ - lib/vagrant_utm/action/match_mac_address.rb
74
76
  - lib/vagrant_utm/action/message_already_running.rb
75
77
  - lib/vagrant_utm/action/message_not_created.rb
76
78
  - lib/vagrant_utm/action/message_not_running.rb
77
79
  - lib/vagrant_utm/action/message_not_stopped.rb
78
80
  - lib/vagrant_utm/action/message_will_not_create.rb
79
81
  - lib/vagrant_utm/action/message_will_not_destroy.rb
82
+ - lib/vagrant_utm/action/package.rb
83
+ - lib/vagrant_utm/action/package_setup_files.rb
84
+ - lib/vagrant_utm/action/package_setup_folders.rb
85
+ - lib/vagrant_utm/action/package_vagrantfile.rb
80
86
  - lib/vagrant_utm/action/prepare_forwarded_port_collision_params.rb
81
87
  - lib/vagrant_utm/action/resume.rb
82
88
  - lib/vagrant_utm/action/set_id.rb
@@ -87,11 +93,13 @@ files:
87
93
  - lib/vagrant_utm/action/suspend.rb
88
94
  - lib/vagrant_utm/action/wait_for_running.rb
89
95
  - lib/vagrant_utm/cap.rb
96
+ - lib/vagrant_utm/commands/disposable.rb
97
+ - lib/vagrant_utm/commands/ip_address.rb
90
98
  - lib/vagrant_utm/config.rb
91
- - lib/vagrant_utm/disposable.rb
92
99
  - lib/vagrant_utm/driver/base.rb
93
100
  - lib/vagrant_utm/driver/meta.rb
94
101
  - lib/vagrant_utm/driver/version_4_5.rb
102
+ - lib/vagrant_utm/driver/version_4_6.rb
95
103
  - lib/vagrant_utm/errors.rb
96
104
  - lib/vagrant_utm/model/forwarded_port.rb
97
105
  - lib/vagrant_utm/model/list_result.rb
@@ -101,14 +109,17 @@ files:
101
109
  - lib/vagrant_utm/scripts/clear_port_forwards.applescript
102
110
  - lib/vagrant_utm/scripts/customize_vm.applescript
103
111
  - lib/vagrant_utm/scripts/downloadVM.sh
112
+ - lib/vagrant_utm/scripts/export_vm.applescript
113
+ - lib/vagrant_utm/scripts/import_vm.applescript
104
114
  - lib/vagrant_utm/scripts/list_vm.js
105
115
  - lib/vagrant_utm/scripts/open_with_utm.js
106
116
  - lib/vagrant_utm/scripts/read_forwarded_ports.applescript
107
- - lib/vagrant_utm/scripts/read_guest_ip.applescript
108
117
  - lib/vagrant_utm/scripts/read_network_interfaces.applescript
118
+ - lib/vagrant_utm/scripts/set_mac_address.applescript
109
119
  - lib/vagrant_utm/util/compile_forwarded_ports.rb
110
120
  - lib/vagrant_utm/version.rb
111
121
  - locales/en.yml
122
+ - notes/README.md
112
123
  - sig/vagrant_utm.rbs
113
124
  - vagrantfile_examples/Vagrantfile
114
125
  homepage: https://naveenrajm7.github.io/vagrant_utm/
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "vagrant/action/builtin/confirm"
4
-
5
- module VagrantPlugins
6
- module Utm
7
- module Action
8
- # Action to confirm download of UTM.
9
- class DownloadConfirm < Vagrant::Action::Builtin::Confirm
10
- def initialize(app, env)
11
- force_key = nil # No force key, user must confirm the download
12
- message = I18n.t("vagrant_utm.messages.download_confirmation",
13
- name: env[:machine].provider_config.utm_file_url)
14
- super(app, env, message, force_key, allowed: %w[y n Y N])
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module VagrantPlugins
4
- module Utm
5
- # Run VM as a snapshot and do not save changes to disk.
6
- class Disposable < Vagrant.plugin(2, :command)
7
- def execute
8
- with_target_vms do |machine|
9
- machine.action(:start_disposable)
10
- end
11
-
12
- 0
13
- end
14
- end
15
- end
16
- end
@@ -1,9 +0,0 @@
1
- on run argv
2
- set vmID to item 1 of argv
3
- tell application "UTM"
4
- set vm to virtual machine id vmID
5
- --- get IP address (QEMU Guest Agent must be installed) of first interface
6
- get item 1 of (query ip of vm) -- Result: "192.168.64.9"
7
- end tell
8
- end run
9
-