vagrant-zones 0.1.71 → 0.1.72

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a8502a47d1fddbed3fcd5df3876a39563bdbbb1b9ccdd6e3670f7966a686034
4
- data.tar.gz: c90a6246364fcfc76b2069eedac12fd0e8e0a32804a458de64ebf53a8ff1b937
3
+ metadata.gz: c3391538892bf880e5476438343dfe9558e2d2afee2251c7dc7221c5cea723ac
4
+ data.tar.gz: f2bed0db576707651f752b39c108d89578e26a9c78699b1f1c307753eaf8893f
5
5
  SHA512:
6
- metadata.gz: 5bf9727ed10ed184e4469377f94799ee700efa91f1336b8a02a285cc8999f5a6468862e9a8c59620b2ec552a474507a362aa6c0f877aee374abfc0b2a18bba13
7
- data.tar.gz: ce34f071b7afa2685430560149b64957f2e81779a64182919411d893462fc839c34f1dc80b86f5334fa383f95640d9c026a2002cd1b9c2d56e53bac919bc62af
6
+ metadata.gz: 74d0fdb3193c2a59c086b77522644ba6f945623158eef7a56556a7b7ff92e05a8be286681d133bbc784de161c45cc6a5023b840c901bb2e8302f759b236a6d01
7
+ data.tar.gz: c8a2981bc239b412029ec27f0a6650ae9e78d809f9cd3a4bad3fc1c7bcd9f74e7993fcb9bf3ae9ec6a6fceb6af5769ec41766a3ad8bae98729623a837fafe189
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.72](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.71...v0.1.72) (2023-02-06)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * confirmation push ([8518bd1](https://github.com/STARTcloud/vagrant-zones/commit/8518bd11139ce3ff7433135a59cfedad07702b0a))
9
+ * dhcp, gatherip, root home ([a6458be](https://github.com/STARTcloud/vagrant-zones/commit/a6458befefb2d4092cf1080904da48bb863d3d92))
10
+ * lint a little ([a46728b](https://github.com/STARTcloud/vagrant-zones/commit/a46728b549b2a078c1d61a65ce3fcfe47c1f609f))
11
+ * lint a little more ([1106aa4](https://github.com/STARTcloud/vagrant-zones/commit/1106aa44cbf43aafc483427c4850b216438cf327))
12
+ * lint a little more ([0a66c99](https://github.com/STARTcloud/vagrant-zones/commit/0a66c99f6846a4527467f9e2d7273e8554acc259))
13
+ * unassisted dhcp ([917e713](https://github.com/STARTcloud/vagrant-zones/commit/917e713cd82db591c28f46453912dd6aef45edae))
14
+ * unassisted dhcp ([9e55438](https://github.com/STARTcloud/vagrant-zones/commit/9e55438020f6c0d203298a2066cedae6013a15a2))
15
+ * unassisted dhcp ([1501a9a](https://github.com/STARTcloud/vagrant-zones/commit/1501a9a04136c204e47ef283d016fec3179e067b))
16
+ * unassisted dhcp ([b24b784](https://github.com/STARTcloud/vagrant-zones/commit/b24b784e2fad31566467358b30c98338257ceab5))
17
+ * unassisted dhcp ([866660c](https://github.com/STARTcloud/vagrant-zones/commit/866660ce249d2fee6a87c61318012dc8befe48a2))
18
+ * unassisted dhcp ([130e4d3](https://github.com/STARTcloud/vagrant-zones/commit/130e4d369503f0130e56d3947bae5d2ef2754b19))
19
+ * unassisted dhcp ([f3faed4](https://github.com/STARTcloud/vagrant-zones/commit/f3faed405f6a75432bab84d2fb3eec1d4f62c23f))
20
+
3
21
  ## [0.1.71](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.70...v0.1.71) (2023-02-04)
4
22
 
5
23
 
@@ -82,7 +82,7 @@ module VagrantPlugins
82
82
  config = @machine.provider_config
83
83
  uii.info(I18n.t('vagrant_zones.control')) if config.debug
84
84
  case control
85
- when 'restart'
85
+ when 'rmatch(/estart'
86
86
  command = 'sudo shutdown -r'
87
87
  command = config.safe_restart unless config.safe_restart.nil?
88
88
  ssh_run_command(uii, command)
@@ -98,7 +98,7 @@ module VagrantPlugins
98
98
  ## Run commands over SSH instead of ZLogin
99
99
  def ssh_run_command(uii, command)
100
100
  config = @machine.provider_config
101
- ip = get_ip_address('runsshcommmand')
101
+ ip = get_ip_address(uii)
102
102
  user = user(@machine)
103
103
  key = userprivatekeypath(@machine).to_s
104
104
  port = sshport(@machine).to_s
@@ -258,33 +258,52 @@ module VagrantPlugins
258
258
  end
259
259
 
260
260
  ## If DHCP and Zlogin, get the IP address
261
- def get_ip_address(_function)
261
+ def get_ip_address(_uii)
262
262
  config = @machine.provider_config
263
263
  name = @machine.name
264
+ lcheck = config.lcheck
265
+ lcheck = ':~' if config.lcheck.nil?
266
+ alcheck = config.alcheck
267
+ alcheck = 'login:' if config.alcheck.nil?
268
+ pcheck = 'Password:'
269
+
264
270
  @machine.config.vm.networks.each do |_adaptertype, opts|
265
- responses = []
266
- nic_type = nictype(opts)
271
+ ip = nil
267
272
  if opts[:dhcp4] && opts[:managed]
268
- vnic_name = "vnic#{nic_type}#{vtype(config)}_#{config.partition_id}_#{opts[:nic_number]}"
273
+ vnic_name = "vnic#{nictype(opts)}#{vtype(config)}_#{config.partition_id}_#{opts[:nic_number]}"
269
274
  PTY.spawn("pfexec zlogin -C #{name}") do |zlogin_read, zlogin_write, pid|
270
- command = "ip -4 addr show dev #{vnic_name} | head -n -1 | tail -1 | awk '{ print $2 }' | cut -f1 -d\"/\" \n"
271
- zlogin_read.expect(/\n/) { zlogin_write.printf(command) }
272
- Timeout.timeout(config.clean_shutdown_time) do
275
+ Timeout.timeout(config.setup_wait) do
276
+ rsp = []
277
+ command = "ip -4 addr show dev #{vnic_name} | grep -Po 'inet \\K[\\d.]+' \r\n"
278
+ i = 0
279
+ logged_in = false
273
280
  loop do
274
- zlogin_read.expect(/\r\n/) { |line| responses.push line }
275
- if responses[-1].to_s.match(/(?:[0-9]{1,3}\.){3}[0-9]{1,3}/)
276
- ip = responses[-1][0].rstrip.gsub(/\e\[\?2004l/, '').lstrip
277
- return nil if ip.empty?
278
- return ip.gsub(/\t/, '') unless ip.empty?
281
+ zlogin_read.expect(/\r\n/) { |line| rsp.push line }
282
+ logged_in = true if rsp[-1].to_s.match(/(#{Regexp.quote(lcheck)})/) || rsp[-1].to_s.match(/(:~)/)
283
+ zlogin_write.printf("\r\n") if i < 1
284
+ i += 1
279
285
 
280
- break
281
- end
282
- errormessage = "==> #{name} ==> Command ==> #{command} \nFailed with ==> #{responses[-1]}"
283
- raise errormessage if responses[-1].to_s.match(/Error Code: \b(?!0\b)\d{1,4}\b/)
286
+ break if logged_in || rsp[-1].to_s.match(/(#{Regexp.quote(alcheck)})/)
284
287
  end
288
+
289
+ unless logged_in
290
+ zlogin_write.printf("#{user(@machine)}\n") if zlogin_read.expect(/#{Regexp.quote(alcheck)}/)
291
+ zlogin_write.printf("#{vagrantuserpass(@machine)}\n") if zlogin_read.expect(/#{Regexp.quote(pcheck)}/)
292
+ logged_in = true if zlogin_read.expect(/#{Regexp.quote(lcheck)}/)
293
+ end
294
+
295
+ puts 'Gathering IP' if config.debug_boot
296
+ zlogin_write.printf(command) if logged_in
297
+ loop do
298
+ zlogin_read.expect(/\r\n/) { |line| rsp.push line }
299
+ ip = rsp[-1].to_s.match(/((?:[0-9]{1,3}\.){3}[0-9]{1,3})/)
300
+
301
+ break if rsp[-1].to_s.match(/((?:[0-9]{1,3}\.){3}[0-9]{1,3})/)
302
+ end
303
+ Process.kill('HUP', pid)
285
304
  end
286
- Process.kill('HUP', pid)
287
305
  end
306
+ return ip[0] unless ip[0].empty? || ip[0].nil?
288
307
  elsif (opts[:dhcp4] == false || opts[:dhcp4].nil?) && opts[:managed]
289
308
  ip = opts[:ip].to_s
290
309
  return nil if ip.empty?
@@ -1187,7 +1206,7 @@ module VagrantPlugins
1187
1206
  zlogin_write.printf("\n")
1188
1207
  if zlogin_read.expect(/#{lcheck}/)
1189
1208
  uii.info(I18n.t('vagrant_zones.automated-zlogin-root'))
1190
- zlogin_write.printf("sudo su\n")
1209
+ zlogin_write.printf("sudo su -\n")
1191
1210
  sleep(config.login_wait)
1192
1211
  Process.kill('HUP', pid)
1193
1212
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module VagrantPlugins
4
4
  module ProviderZone
5
- VERSION = '0.1.71'
5
+ VERSION = '0.1.72'
6
6
  NAME = 'vagrant-zones'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-zones
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.71
4
+ version: 0.1.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Gilbert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-04 00:00:00.000000000 Z
11
+ date: 2023-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n