vagrant-terraform 0.1.5 → 0.1.7

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: 3b0980af98e95f4a9587641a569daeb896410b4bb86990d46f1816967321ebfd
4
- data.tar.gz: 48c0115b522bb13890487a8854f6d771a7b4dda7196287105cbc740bbf4571cf
3
+ metadata.gz: ef605c4538283f13302d1ac6b1d23080fc8ea3da030f8e0040e6e3313dac8154
4
+ data.tar.gz: 45b5cd9ab259067338914c722a0f3d3ddc860e8104fa19e0d84dd7063f62cd0c
5
5
  SHA512:
6
- metadata.gz: 6099a9a5c0029347b8d4f9ced88266ebeb62a2e21d8b9d92803d79ffe1b02af46ac619d3308feb1dd9148dc5e84fc5b096c449403c2e44e27987d41d5dcdb1d0
7
- data.tar.gz: f8d825bdc67246c31e4cb0fb99f8b10eeb1f91563800ca195300bb74e7947f05e943fae52fdf6ce7325cdbed7d6d060db50a4debcfb399526a030c86c0f296ec
6
+ metadata.gz: 2de8aea439141e01a0632713cf97281d44c9febae5e8cd8b0b87072f5fa287743d69b0fc687b77b905e88824bad2c2c8edffbbeebcbcd09a698e16960091164c
7
+ data.tar.gz: 68e7d6d0bff3e035524bd8e87b37de6960a19f6ab56e738cda895deedc52f759672d4f6d14f65014346bcf01d03668ec750e1a2892432905d827aaea0f655ff6
@@ -80,6 +80,7 @@ resource "proxmox_vm_qemu" "#{vmname.gsub(/\./, '-')}" {
80
80
  }
81
81
  }
82
82
  }
83
+ %SERIAL%
83
84
  nameserver = "#{config.nameserver}"
84
85
  searchdomain = "#{config.searchdomain}"
85
86
  %NETWORKS%
@@ -116,6 +117,18 @@ terraform {
116
117
  ipconfig%IDX% = "%IP%"
117
118
  END
118
119
 
120
+ serial_template = <<-END
121
+ serial {
122
+ id = 0
123
+ type = "socket"
124
+ }
125
+ END
126
+ if config.serial_port
127
+ main_tf = main_tf.gsub(/%SERIAL%/, serial_template)
128
+ else
129
+ main_tf = main_tf.gsub(/%SERIAL%/, '')
130
+ end
131
+
119
132
  vagrantfile_networks = []
120
133
  env[:machine].id = vmname
121
134
  env[:machine].config.vm.networks.each_with_index do |network, idx|
@@ -150,8 +163,8 @@ END
150
163
  env[:ui].info(" -- Target node: #{config.target_node}")
151
164
  env[:ui].info(" -- Storage domain: #{config.storage_domain}")
152
165
  env[:ui].info(" -- CPU Cores: #{config.cpu_cores}")
153
- env[:ui].info(" -- Memory: #{Filesize.from("#{config.memory_size} B").to_f('MiB').to_i} MB")
154
- env[:ui].info(" -- Disk: #{Filesize.from("#{config.disk_size} B").to_f('GiB').to_i} GB") unless config.disk_size.nil?
166
+ env[:ui].info(" -- Memory: #{Filesize.from("#{config.memory_size} B").to_f('MB').to_i} MB")
167
+ env[:ui].info(" -- Disk: #{Filesize.from("#{config.disk_size} B").to_f('GB').to_i} GB") unless config.disk_size.nil?
155
168
 
156
169
  terraform_dir = env[:machine_tf_dir]
157
170
  terraform_main_file = "#{terraform_dir}/main.tf"
@@ -171,6 +184,24 @@ END
171
184
  raise e
172
185
  end
173
186
 
187
+ # Terraform error message was 'clone failed: cfs-lock 'storage-qnap-nfs' error: got lock request timeout'
188
+ if e.message.gsub(ansi_escape_regex, '').include?("clone failed: cfs-lock")
189
+ env[:ui].info("Proxmox unable to get storage lock, retrying")
190
+ raise e
191
+ end
192
+
193
+ # Terraform error message was 'clone failed: 'storage-qnap-nfs'-locked command timed out - aborting'
194
+ if e.message.gsub(ansi_escape_regex, '').include?("command timed out")
195
+ env[:ui].info("Proxmox clone failed, retrying")
196
+ raise e
197
+ end
198
+
199
+ # Terraform error message was '500 got no worker upid - start worker failed'
200
+ if e.message.gsub(ansi_escape_regex, '').include?("got no worker upid")
201
+ env[:ui].info("Proxmox error: 'got no worker upid', retrying")
202
+ raise e
203
+ end
204
+
174
205
  if e.message.gsub(ansi_escape_regex, '') =~ /.*Error: [0-9 ]*unable to create VM [0-9]*: config file already exists/
175
206
  env[:ui].info("Proxmox ID conflict, retrying")
176
207
  raise e
@@ -35,6 +35,12 @@ module VagrantPlugins
35
35
  return false
36
36
  rescue Net::SSH::AuthenticationFailed
37
37
  return true
38
+ rescue Errno::ECONNRESET
39
+ @logger.debug("Got connection reset")
40
+ return false
41
+ rescue StandardError => e
42
+ @logger.debug("Got error #{e.message}")
43
+ return false
38
44
  end
39
45
  return false
40
46
  end
@@ -46,7 +52,7 @@ module VagrantPlugins
46
52
  # Wait for VM to obtain an ip address.
47
53
  env[:metrics]["instance_ip_time"] = Util::Timer.time do
48
54
  env[:ui].info(I18n.t("vagrant_terraform.waiting_for_ip"))
49
- for attempt in 1..300
55
+ for attempt in 1..100
50
56
  # If we're interrupted don't worry about waiting
51
57
  next if env[:interrupted]
52
58
 
@@ -25,6 +25,7 @@ module VagrantPlugins
25
25
  attr_accessor :searchdomain
26
26
  attr_accessor :os_type
27
27
  attr_accessor :full_clone
28
+ attr_accessor :serial_port
28
29
 
29
30
  def initialize
30
31
  @api_url = UNSET_VALUE
@@ -46,6 +47,7 @@ module VagrantPlugins
46
47
  @searchdomain = UNSET_VALUE
47
48
  @os_type = UNSET_VALUE
48
49
  @full_clone = UNSET_VALUE
50
+ @serial_port = UNSET_VALUE
49
51
  end
50
52
 
51
53
  def finalize!
@@ -68,6 +70,7 @@ module VagrantPlugins
68
70
  @searchdomain = '' if @searchdomain == UNSET_VALUE
69
71
  @os_type = 'l26' if @os_type == UNSET_VALUE
70
72
  @full_clone = true if @full_clone == UNSET_VALUE
73
+ @serial_port = false if @serial_port == UNSET_VALUE
71
74
 
72
75
  unless disk_size.nil?
73
76
  begin
@@ -1,6 +1,6 @@
1
1
  module VagrantPlugins
2
2
  module TerraformProvider
3
- VERSION = '0.1.5'
3
+ VERSION = '0.1.7'
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mika Båtsman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-09 00:00:00.000000000 Z
11
+ date: 2025-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filesize
@@ -69,7 +69,7 @@ homepage: https://github.com/mika-b/vagrant-terraform
69
69
  licenses:
70
70
  - MIT
71
71
  metadata: {}
72
- post_install_message:
72
+ post_install_message:
73
73
  rdoc_options: []
74
74
  require_paths:
75
75
  - lib
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  version: '0'
86
86
  requirements: []
87
87
  rubygems_version: 3.5.22
88
- signing_key:
88
+ signing_key:
89
89
  specification_version: 4
90
90
  summary: This vagrant plugin provides the ability to create, control, and destroy
91
91
  virtual machines under proxmox