vagrant-tart 0.0.3 → 0.0.4

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: 7304968aeaf2c309ef4e77a350054f83fb24d6119518e2372639ac27f51b3c73
4
- data.tar.gz: 7baed83d857caeb259d10798500493e69bbf6267234dca7789e8654576a6ad8f
3
+ metadata.gz: 3e9661a2803897b09b1601b13b608e24ea19a5f95db89c760f3c04e6a1b18c41
4
+ data.tar.gz: fd5723f36984a597846413d9fe14438dd8386116357faff32d212ba6ca265c8e
5
5
  SHA512:
6
- metadata.gz: 6a9a0510aa5cf86519e744de29182bfd3feccd0545314b170ec955c505414bd16d77046dbbbb085d75d004be4db60cb3377effa3ffb66ddc309f6dffb6b78f97
7
- data.tar.gz: cf738b29374eda9c4884c6c03dd58ae6fd96383ba44b9f31d19695397f71497a9fab1a4e94a7d01098f3611a3c2940cdd737326827bad115349f76c917ba74db
6
+ metadata.gz: 942cb301b228455fac8369be172bd5c9be38cf4b4ed91fe7eac0b0af46a15ff9235ecb3e9601de039aafb0836ec493b4e417c46748da4b79058fb8957f762d53
7
+ data.tar.gz: 53d7dba4e76a42d9ea51f76cfacb5306db38397e13102ab18123c2b1bc129d65775f09cafa030981d21f2fb16b21c42ef445e5eb8f07feddb433a81605938f75
@@ -11,9 +11,9 @@ module VagrantPlugins
11
11
  class Config < Vagrant.plugin("2", :config)
12
12
  # @return [String] The image registry
13
13
  attr_accessor :registry
14
- # @return [String] The image registry username
14
+ # @return [String] The image registry username (optional)
15
15
  attr_accessor :username
16
- # @return [String] The image registry password
16
+ # @return [String] The image registry password (optional)
17
17
  attr_accessor :password
18
18
 
19
19
  # @return [String] The image source
@@ -21,14 +21,14 @@ module VagrantPlugins
21
21
  # @return [String] The name
22
22
  attr_accessor :name
23
23
 
24
+ # @return [Boolean] Show a GUI window on boot, or run headless
25
+ attr_accessor :gui
24
26
  # @return [Integer] Number of CPUs
25
27
  attr_accessor :cpus
26
28
  # @return [Integer] Memory size in MB
27
29
  attr_accessor :memory
28
30
  # @return [Integer] Disk storage size in GB
29
31
  attr_accessor :disk
30
- # @return [Boolean] Show a GUI window on boot, or run headless
31
- attr_accessor :gui
32
32
  # @return [String] Display screen resolution
33
33
  attr_accessor :display
34
34
  # @return [Boolean] Whether the machine is suspendable
@@ -48,10 +48,10 @@ module VagrantPlugins
48
48
  @image = UNSET_VALUE
49
49
  @name = UNSET_VALUE
50
50
 
51
+ @gui = UNSET_VALUE
51
52
  @cpus = UNSET_VALUE
52
53
  @memory = UNSET_VALUE
53
54
  @disk = UNSET_VALUE
54
- @gui = UNSET_VALUE
55
55
  @display = UNSET_VALUE
56
56
  @suspendable = UNSET_VALUE
57
57
 
@@ -67,10 +67,10 @@ module VagrantPlugins
67
67
  @image = nil if @image == UNSET_VALUE
68
68
  @name = nil if @name == UNSET_VALUE
69
69
 
70
+ @gui = false if @gui == UNSET_VALUE
70
71
  @cpus = 1 if @cpus == UNSET_VALUE
71
72
  @memory = 1024 if @memory == UNSET_VALUE
72
73
  @disk = 10 if @disk == UNSET_VALUE
73
- @gui = false if @gui == UNSET_VALUE
74
74
  @display = "1024x768" if @display == UNSET_VALUE
75
75
  @suspendable = false if @suspendable == UNSET_VALUE
76
76
  end
@@ -79,12 +79,6 @@ module VagrantPlugins
79
79
  def validate(_machine)
80
80
  errors = _detected_errors
81
81
 
82
- # Sanity checks for the registry
83
- unless @registry.nil?
84
- errors << I18n.t("vagrant_tart.config.username_required") if @username.nil? || @username.empty?
85
- errors << I18n.t("vagrant_tart.config.password_required") if @password.nil? || @password.empty?
86
- end
87
-
88
82
  # Sanity checks for the image and the name
89
83
  errors << I18n.t("vagrant_tart.config.image_required") if @image.nil? || @image.empty?
90
84
  errors << I18n.t("vagrant_tart.config.name_required") if @name.nil? || @name.empty?
@@ -110,6 +104,9 @@ module VagrantPlugins
110
104
  # Check that the display resolution is a valid string conforming to the format "WIDTHxHEIGHT"
111
105
  errors << I18n.t("vagrant_tart.config.display_invalid") unless @display.match?(/^\d+x\d+$/)
112
106
 
107
+ # Check that the suspendable flag is a valid boolean
108
+ errors << I18n.t("vagrant_tart.config.suspendable_invalid") unless @suspendable == true || @suspendable == false
109
+
113
110
  { "Tart Provider" => errors }
114
111
  end
115
112
 
@@ -117,8 +114,10 @@ module VagrantPlugins
117
114
  @suspendable
118
115
  end
119
116
 
117
+ # Check if the configuration uses a registry.
118
+ # @return [Boolean] True if the configuration uses a registry, false otherwise
120
119
  def use_registry?
121
- !@registry.nil? && !@username.nil? && !@password.nil?
120
+ !@registry.nil?
122
121
  end
123
122
  end
124
123
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
@@ -5,5 +5,10 @@ HOST="$1"
5
5
  USERNAME="$2"
6
6
  PASSWORD="$3"
7
7
 
8
- # Login to the registry with the provided credentials
9
- echo "$PASSWORD" | tart login "$HOST" --username "$USERNAME" --password-stdin
8
+ if [[ -z "$USERNAME" ]] || [[ -z "$PASSWORD" ]]; then
9
+ # Assumes that the credentials are provided in another way (e.g. environment variables)
10
+ tart login "$HOST"
11
+ else
12
+ # Login to the registry with the provided credentials
13
+ echo "$PASSWORD" | tart login "$HOST" --username "$USERNAME" --password-stdin
14
+ fi
@@ -4,6 +4,6 @@ module VagrantPlugins
4
4
  # Top level module for the Tart provider plugin.
5
5
  module Tart
6
6
  # Current version of the Tart provider plugin.
7
- VERSION = "0.0.3"
7
+ VERSION = "0.0.4"
8
8
  end
9
9
  end
data/locales/en.yml CHANGED
@@ -1,21 +1,22 @@
1
1
  en:
2
2
  vagrant_tart:
3
3
  config:
4
- image_required: |-
5
- Configuration must specify an image
6
- name_required: |-
7
- Configuration must specify a virtual machine name
8
-
9
- gui_invalid: |-
10
- Configuration must specify a valid GUI setting (true or false)
11
4
  cpus_invalid: |-
12
5
  Configuration must specify a valid CPUs count (between 1 and %{max_cpus})
13
- memory_invalid: |-
14
- Configuration must specify a valid memory size (between 1 and %{max_memory} MB)
15
6
  disk_invalid: |-
16
7
  Configuration must specify a valid disk size (greater than 1 GB)
17
8
  display_invalid: |-
18
9
  Configuration must specify a valid display size (WIDTHxHEIGHT pixels)
10
+ gui_invalid: |-
11
+ Configuration must specify a valid GUI setting (true or false)
12
+ image_required: |-
13
+ Configuration must specify an image
14
+ memory_invalid: |-
15
+ Configuration must specify a valid memory size (between 1 and %{max_memory} MB)
16
+ name_required: |-
17
+ Configuration must specify a virtual machine name
18
+ suspendable_invalid: |-
19
+ Configuration must specify a valid suspendable setting (true or false)
19
20
 
20
21
  errors:
21
22
  command_error: |-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-tart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Etiemble
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-08 00:00:00.000000000 Z
11
+ date: 2024-06-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Allows Vagrant to manage Tart virtual machines.
14
14
  email: