vagrant_utm 0.1.3 → 0.1.5

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
  SHA256:
3
- metadata.gz: bc0499e6b39496b2bd9590d3683631bcc213f7b0f4f1a5fc259b9373e160da33
4
- data.tar.gz: 36b2a3029c3d8ddb9d4e84865f657a989732495f59adf90e4f2eb19731780ae0
3
+ metadata.gz: f800390a333ce7c68ebbc03360853356ddc52c6de36358e3aa305a32d9e58ff3
4
+ data.tar.gz: 7a0de84f4ae5190a8ca7eec906deeaf90b49ba683fecba3058b790e53434b2eb
5
5
  SHA512:
6
- metadata.gz: adf69f5cc2fbb3d73e5453b761d374dfd29aded42d1581927a1bbfea2405a93817c11e4a79de57d1c144b6acd120e4d21dceb9140c38083436605f2f2f4a2889
7
- data.tar.gz: c305e4949e66c6643646025c649dba12093e228dbbe298b0aada54be0974fa526bfdded85afbcf2b0c062d1982100f601bb77d290784b9d4b57e8fc4173644cf
6
+ metadata.gz: 7e0e5df946e3d422129aa57d3380b4e7035e0da0632121bc596171a7e1328b23bd6b4d030d19adaad7ac72d1afc5c193759f94414a839c781286f87d62ffbc76
7
+ data.tar.gz: 377c20d5889e75d59a0c00d410428056449c3cf2fe61805aecd0587f048e1f4e791d762cee9ff66c0b69c55e4e80dee5d39e495d4424a8da6096199bf1e02571
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.5] - 2025-11-16
4
+
5
+ - Support vm icon
6
+
7
+
8
+
9
+ ## [0.1.4] - 2025-10-11
10
+
11
+ - Driver: Add support for UTM 4.7.x
12
+
3
13
 
4
14
  ## [0.1.3] - 2025-04-20
5
15
 
data/docs/commands.md CHANGED
@@ -155,6 +155,6 @@ List all IP addresses associated with network interfaces on the guest.
155
155
 
156
156
  `utmctl start --disposable`
157
157
 
158
- Start virtual machine in disposable mdoe, which allows you to run a virtual machine without saving any persistent changes to the drive.
158
+ Start virtual machine in disposable mode, which allows you to run a virtual machine without saving any persistent changes to the drive.
159
159
 
160
- Read about Disposable mode in [UTM docs](https://docs.getutm.app/advanced/disposable/)
160
+ Read about Disposable mode in [UTM docs](https://docs.getutm.app/advanced/disposable/)
@@ -45,6 +45,8 @@ Vagrant.configure("2") do |config|
45
45
  u.cpus = 1
46
46
  # Memory in MB
47
47
  u.memory = 1024
48
+ # VM icon (Available icons https://github.com/utmapp/UTM/tree/main/Icons)
49
+ u.icon = "debian"
48
50
  # Notes for UTM VM (Appears in UTM UI)
49
51
  u.notes = "Vagrant: For testing plugin development"
50
52
  # QEMU Directoy Share mode for the VM.
data/docs/index.md CHANGED
@@ -24,6 +24,7 @@ allowing Vagrant to control and provision machines via UTM's API.
24
24
 
25
25
  [UTM] is a free, full-featured system emulator and virtual machine host for iOS and macOS.
26
26
  The UTM provider currently supports UTM versions
27
+ * 4.7.x
27
28
  * 4.6.x
28
29
  * 4.5.x (Obsolete, use plugin version 0.0.1)
29
30
 
@@ -9,10 +9,35 @@ module VagrantPlugins
9
9
  @app = app
10
10
  end
11
11
 
12
- def call(env)
12
+ def call(env) # rubocop:disable Metrics/AbcSize
13
13
  # Start up the VM and wait for it to boot.
14
14
  env[:ui].info I18n.t("vagrant.actions.vm.boot.booting")
15
- env[:machine].provider.driver.start
15
+
16
+ # Wait for AppleScript configuration changes to be fully saved
17
+ # before attempting to start the VM to avoid OSStatus error -609
18
+ # We retry the start command with exponential backoff if it fails
19
+ max_retries = 3
20
+ retry_count = 0
21
+ retry_delay = 1
22
+
23
+ max_retries.times do
24
+ env[:machine].provider.driver.start
25
+ break # Success, exit the loop
26
+ rescue VagrantPlugins::Utm::Errors::UtmctlError => e
27
+ # Only retry if it's an OSStatus error (configuration still being saved)
28
+ raise unless e.message.include?("OSStatus")
29
+
30
+ retry_count += 1
31
+
32
+ # If we've exhausted all retries, re-raise the error
33
+ raise if retry_count >= max_retries
34
+
35
+ message = "VM configuration may still be saving. Retrying in #{retry_delay} seconds... " \
36
+ "(#{retry_count}/#{max_retries})"
37
+ env[:ui].warn message
38
+ sleep retry_delay
39
+ retry_delay *= 2 # Exponential backoff: 1s, 2s, 4s
40
+ end
16
41
 
17
42
  @app.call(env)
18
43
  end
@@ -85,6 +85,20 @@ module VagrantPlugins
85
85
  customize("pre-boot", ["customize_vm.applescript", :id, "--notes", notes])
86
86
  end
87
87
 
88
+ # Shortcut for setting the icon of the virtual machine.
89
+ # Calls #customize internally.
90
+ #
91
+ # Available icons can be found at:
92
+ # https://github.com/utmapp/UTM/tree/main/Icons
93
+ #
94
+ # Common icons include: linux, ubuntu, debian, fedora, archlinux,
95
+ # openbsd, freebsd, windows, macos, android, etc.
96
+ #
97
+ # @param icon [String] the icon name for the VM (e.g., "ubuntu", "debian")
98
+ def icon=(icon)
99
+ customize("pre-boot", ["customize_vm.applescript", :id, "--icon", icon.to_s])
100
+ end
101
+
88
102
  # TODO: All warning if user sets directory_share_mode,
89
103
  # because default implementation is 'virtFS'
90
104
  # Shortcut for setting the directory share mode of the virtual machine.
@@ -55,7 +55,8 @@ module VagrantPlugins
55
55
  # Instantiate the proper version driver for UTM
56
56
  @logger.debug("Finding driver for UTM version: #{@version}")
57
57
  driver_map = {
58
- "4.6" => Version_4_6
58
+ "4.6" => Version_4_6,
59
+ "4.7" => Version_4_7
59
60
  }
60
61
 
61
62
  # UTM version < 4.6.5 doesn't have
@@ -64,7 +65,7 @@ module VagrantPlugins
64
65
  # Restrict to UTM versions >= 4.6.5
65
66
  unless Gem::Version.new(@version) >= Gem::Version.new("4.6.5")
66
67
  raise Errors::UtmInvalidVersion,
67
- supported_versions: "4.6.5 or earlier"
68
+ supported_versions: "4.6.5 or later"
68
69
  end
69
70
 
70
71
  driver_klass = nil
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("version_4_6", __dir__)
4
+
5
+ module VagrantPlugins
6
+ module Utm
7
+ module Driver
8
+ # Driver for UTM 4.7.x
9
+ class Version_4_7 < Version_4_6 # rubocop:disable Naming/ClassAndModuleCamelCase
10
+ def initialize(uuid)
11
+ super
12
+
13
+ @logger = Log4r::Logger.new("vagrant::provider::utm::version_4_7")
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -6,6 +6,7 @@ on run argv
6
6
  set memorySize to 0
7
7
  set vmNotes to ""
8
8
  set directoryShareMode to null
9
+ set vmIcon to ""
9
10
 
10
11
  -- Parse arguments
11
12
  repeat with i from 2 to (count argv)
@@ -20,6 +21,8 @@ on run argv
20
21
  set vmNotes to item (i + 1) of argv
21
22
  else if currentArg is "--directory-share-mode" then
22
23
  set directoryShareMode to item (i + 1) of argv
24
+ else if currentArg is "--icon" then
25
+ set vmIcon to item (i + 1) of argv
23
26
  end if
24
27
  end repeat
25
28
 
@@ -52,6 +55,11 @@ on run argv
52
55
  set directory share mode of config to directoryShareMode -- mode is assumed to be enum value
53
56
  end if
54
57
 
58
+ -- Set icon if provided
59
+ if vmIcon is not "" then
60
+ set icon of config to vmIcon
61
+ end if
62
+
55
63
  -- Save the configuration
56
64
  update configuration of vm with config
57
65
 
@@ -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.1.3"
7
+ VERSION = "0.1.5"
8
8
  end
9
9
  end
data/lib/vagrant_utm.rb CHANGED
@@ -17,6 +17,7 @@ module VagrantPlugins
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
19
  autoload :Version_4_6, lib_path.join("version_4_6") # rubocop:disable Naming/VariableNumber
20
+ autoload :Version_4_7, lib_path.join("version_4_7") # rubocop:disable Naming/VariableNumber
20
21
  end
21
22
 
22
23
  # Drop some autoloads for the model classes
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.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naveenraj M
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-21 00:00:00.000000000 Z
11
+ date: 2025-11-17 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:
@@ -103,6 +103,7 @@ files:
103
103
  - lib/vagrant_utm/driver/meta.rb
104
104
  - lib/vagrant_utm/driver/version_4_5.rb
105
105
  - lib/vagrant_utm/driver/version_4_6.rb
106
+ - lib/vagrant_utm/driver/version_4_7.rb
106
107
  - lib/vagrant_utm/errors.rb
107
108
  - lib/vagrant_utm/model/forwarded_port.rb
108
109
  - lib/vagrant_utm/model/list_result.rb