vagrant-guests-clearlinux 1.0.11 → 1.0.12

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: 9a0bf27d01315661bbd39dc82ba6c5bbaea3d8e21264be124ba4227184e68dd6
4
- data.tar.gz: 3937c110ed621d7db7a1b74e618fac4f68ec62451d5a869e5386ac8bee7eb377
3
+ metadata.gz: 8a5ff37998160645d4d5cfba0a093ac79ea02c9518d07206b49ad3aaef182f82
4
+ data.tar.gz: 621632483ec800d37df645eab25e3dc0a0da94af923fee7310455aad52e696c3
5
5
  SHA512:
6
- metadata.gz: 6af48e6b54266051c699c98e76121050d1cf2530cd5f14af523444b4d127f2c497e983b4194923ab7595b04502f55d74168f42338474a5c3c936648c45f4b605
7
- data.tar.gz: 6070645fcefa9fed672be4bfb32c54ce9230a6491379b1a361d949bbc92b04980f8f341cc22c4af0975ea9a762fd55e43ce68993761851de6a5ab5ef434cdef1
6
+ metadata.gz: ce7079408022f2bbc44f9eea3815967ccf4db6705f0e857d4ae06610458f77520a929903d1a307a4cd9bc006ebaa5586ba8e4edcaf21f4770720e5a9dd67339d
7
+ data.tar.gz: a2888b7170aa36130242da33059585b529f584a7b499ec217dbed4d2f1dbdd0c6a8035e16294c746f716b6c729693e82bc0b1a2465da66d73614ee80a8763131
data/README.md CHANGED
@@ -17,7 +17,7 @@ To build and install the plugin directly from this repo:
17
17
  ```
18
18
  $ bundle install
19
19
  $ bundle exec rake build
20
- $ vagrant plugin install pkg/vagrant-guests-clearlinux-1.0.11.gem
20
+ $ vagrant plugin install pkg/vagrant-guests-clearlinux-1.0.12.gem
21
21
  ```
22
22
 
23
23
  You can run RSpec with:
@@ -20,6 +20,7 @@ Name=%s
20
20
 
21
21
  [Network]
22
22
  Address=%s
23
+ %s
23
24
  #VAGRANT-END
24
25
  EOF
25
26
 
@@ -38,35 +39,31 @@ module VagrantPlugins
38
39
  module GuestClearLinux
39
40
  module Cap
40
41
  class ConfigureNetworks
42
+ include Vagrant::Util
43
+ extend Vagrant::Util::GuestInspection::Linux
44
+ NETWORKD_DIRECTORY = "/etc/systemd/network".freeze
41
45
  @@logger = Log4r::Logger.new('vagrant::guest::clearlinux::configure_networks')
42
46
 
43
47
  def self.configure_networks(machine, networks)
44
48
  comm = machine.communicate
45
- # Read network interface names
46
- interfaces = []
47
- comm.sudo("ifconfig -a | grep -E '^en|^eth' | cut -f1 -d' '") do |_, result|
48
- interfaces = result.split("\n")
49
- end
50
-
51
- # Configure interfaces
49
+ interfaces = machine.guest.capability(:network_interfaces)
52
50
  networks.each do |network|
53
51
  interface = network[:interface].to_i
54
-
55
- iface = interfaces[interface]
56
- if iface.nil?
52
+ device = interfaces[interface]
53
+ if device.nil?
57
54
  @@logger.warn("Could not find match rule for network #{network.inspect}")
58
55
  next
59
56
  end
60
- comm.sudo("mkdir -p /etc/systemd/network/")
61
- unit_name = find_network_file comm, iface
62
- comm.sudo("rm -f /etc/systemd/network/#{unit_name}")
57
+ unit_name = format('50-vagrant-%s.network', device)
63
58
 
64
59
  if network[:type] == :static
65
60
  cidr = IPAddr.new(network[:netmask]).to_cidr
66
- address = format('%s/%s', network[:ip], cidr)
67
- unit_file = format(STATIC_NETWORK, iface, address)
61
+ address = "#{network[:ip]}/#{cidr}"
62
+ gateway = ""
63
+ gateway = "Gateway=#{network[:gateway]}" if network[:gateway]
64
+ unit_file = format(STATIC_NETWORK, device, address, gateway)
68
65
  elsif network[:type] == :dhcp
69
- unit_file = format(DHCP_NETWORK, iface)
66
+ unit_file = format(DHCP_NETWORK, device)
70
67
  end
71
68
 
72
69
  temp = Tempfile.new('vagrant')
@@ -75,16 +72,14 @@ module VagrantPlugins
75
72
  temp.close
76
73
 
77
74
  comm.upload(temp.path, "/tmp/#{unit_name}")
78
- comm.sudo(["mv /tmp/#{unit_name} /etc/systemd/network/",
79
- "chown root:root /etc/systemd/network/#{unit_name}",
80
- "chmod a+r /etc/systemd/network/#{unit_name}"].join("\n"))
75
+ comm.sudo([ "mkdir -p #{NETWORKD_DIRECTORY}",
76
+ "rm -f #{NETWORKD_DIRECTORY}/#{unit_name}",
77
+ "mv /tmp/#{unit_name} #{NETWORKD_DIRECTORY}",
78
+ "chown root:root #{NETWORKD_DIRECTORY}/#{unit_name}",
79
+ "chmod a+r #{NETWORKD_DIRECTORY}/#{unit_name}",
80
+ "systemctl restart systemd-networkd"].join("\n"))
81
+ comm.wait_for_ready(30)
81
82
  end
82
- comm.sudo("systemctl restart systemd-networkd")
83
- comm.wait_for_ready(30)
84
- end
85
-
86
- def self.find_network_file(comm, iface)
87
- format('50-vagrant-%s.network', iface)
88
83
  end
89
84
  end
90
85
  end
@@ -4,6 +4,6 @@
4
4
  module VagrantPlugins
5
5
  # Set version for vagrant-guests-clearlinux gem.
6
6
  module GuestClearLinux
7
- VERSION = '1.0.11'
7
+ VERSION = '1.0.12'
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-guests-clearlinux
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - António Meireles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-26 00:00:00.000000000 Z
11
+ date: 2018-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler