landrush 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +2 -0
  3. data/.rubocop_todo.yml +100 -12
  4. data/.travis.yml +1 -2
  5. data/CHANGELOG.md +11 -0
  6. data/Gemfile +11 -11
  7. data/README.adoc +8 -1
  8. data/Rakefile +3 -3
  9. data/appveyor.yml +3 -1
  10. data/doc/Development.adoc +24 -19
  11. data/doc/Usage.adoc +17 -6
  12. data/features/dns_resolution.feature +3 -0
  13. data/features/docker_provider.feature +32 -0
  14. data/features/support/env.rb +2 -2
  15. data/landrush.gemspec +3 -3
  16. data/lib/landrush.rb +1 -0
  17. data/lib/landrush/action/common.rb +7 -2
  18. data/lib/landrush/action/redirect_dns.rb +3 -0
  19. data/lib/landrush/action/setup.rb +16 -12
  20. data/lib/landrush/action/teardown.rb +2 -0
  21. data/lib/landrush/cap/guest/all/read_host_visible_ip_address.rb +2 -2
  22. data/lib/landrush/cap/guest/linux/add_iptables_rule.rb +2 -2
  23. data/lib/landrush/cap/guest/linux/configured_dns_servers.rb +1 -0
  24. data/lib/landrush/cap/guest/linux/redirect_dns.rb +1 -1
  25. data/lib/landrush/cap/guest/suse/add_iptables_rule.rb +2 -2
  26. data/lib/landrush/cap/host/arch/dnsmasq_installed.rb +11 -0
  27. data/lib/landrush/cap/host/arch/install_dnsmasq.rb +16 -0
  28. data/lib/landrush/cap/host/arch/restart_dnsmasq.rb +21 -0
  29. data/lib/landrush/cap/host/darwin/configure_visibility_on_host.rb +21 -18
  30. data/lib/landrush/cap/host/debian/host.rb +1 -0
  31. data/lib/landrush/cap/host/linux/configure_visibility_on_host.rb +5 -3
  32. data/lib/landrush/cap/host/linux/create_dnsmasq_config.rb +3 -0
  33. data/lib/landrush/cap/host/redhat/restart_dnsmasq.rb +8 -2
  34. data/lib/landrush/cap/host/ubuntu/host.rb +1 -0
  35. data/lib/landrush/cap/host/windows/configure_visibility_on_host.rb +14 -6
  36. data/lib/landrush/command.rb +18 -3
  37. data/lib/landrush/config.rb +6 -2
  38. data/lib/landrush/dns_server.rb +82 -0
  39. data/lib/landrush/plugin.rb +18 -0
  40. data/lib/landrush/server.rb +147 -205
  41. data/lib/landrush/start_server.rb +1 -1
  42. data/lib/landrush/store.rb +53 -24
  43. data/lib/landrush/util/dnsmasq.rb +10 -0
  44. data/lib/landrush/util/process_helper.rb +16 -16
  45. data/lib/landrush/util/retry.rb +1 -0
  46. data/lib/landrush/version.rb +1 -1
  47. data/test/landrush/action/setup_test.rb +8 -7
  48. data/test/landrush/action/teardown_test.rb +5 -5
  49. data/test/landrush/cap/guest/linux/redirect_dns_test.rb +1 -1
  50. data/test/landrush/cap/host/darwin/configure_visibility_on_host_test.rb +10 -6
  51. data/test/landrush/cap/host/linux/configure_visibility_on_host_test.rb +1 -1
  52. data/test/landrush/cap/host/windows/configure_visibility_on_host_test.rb +35 -4
  53. data/test/landrush/issues/255.rb +55 -55
  54. data/test/landrush/parallel_store_use_test.rb +50 -0
  55. data/test/landrush/server_test.rb +6 -17
  56. data/test/landrush/store_test.rb +8 -8
  57. data/test/landrush/util/dnsmasq_test.rb +42 -0
  58. data/test/support/create_fake_working_dir.rb +3 -2
  59. data/test/support/delete_fake_working_dir.rb +1 -1
  60. data/test/support/test_server_daemon.rb +1 -1
  61. data/test/test_helper.rb +6 -8
  62. metadata +42 -17
@@ -8,4 +8,4 @@ Dir.entries(gem_path).each { |gem_dir| $LOAD_PATH.unshift "#{File.join(ARGV[2],
8
8
 
9
9
  require_relative 'server'
10
10
 
11
- Landrush::Server.run(ARGV[0], ARGV[1]) if __FILE__ == $PROGRAM_NAME
11
+ Landrush::Server.run(ARGV[0], ARGV[1]) if $PROGRAM_NAME == __FILE__
@@ -1,7 +1,11 @@
1
1
  require 'pathname'
2
2
  require 'json'
3
+ require 'filelock'
3
4
 
4
5
  module Landrush
6
+ class ConfigLockError < StandardError
7
+ end
8
+
5
9
  class Store
6
10
  def self.hosts
7
11
  @hosts ||= new(Server.working_dir.join('hosts.json'))
@@ -23,52 +27,76 @@ module Landrush
23
27
  end
24
28
 
25
29
  def set(key, value)
26
- write(current_config.merge(key => value))
30
+ with_file_lock do |file|
31
+ config = current_config(file).merge(key => value)
32
+ write(config, file)
33
+ end
27
34
  end
28
35
 
29
36
  def each(*args, &block)
30
- current_config.each(*args, &block)
37
+ with_file_lock do |file|
38
+ current_config(file).each(*args, &block)
39
+ end
31
40
  end
32
41
 
33
42
  def delete(key)
34
- write(current_config.reject { |k, v| k == key || v == key })
43
+ with_file_lock do |file|
44
+ write(current_config(file).reject { |k, v| k == key || v == key }, file)
45
+ end
35
46
  end
36
47
 
37
48
  def has?(key, value = nil)
38
- if value.nil?
39
- current_config.key? key
40
- else
41
- current_config[key] == value
49
+ with_file_lock do |file|
50
+ if value.nil?
51
+ current_config(file).key? key
52
+ else
53
+ current_config(file)[key] == value
54
+ end
42
55
  end
43
56
  end
44
57
 
45
58
  def find(search)
46
- search = IPAddr.new(search).reverse if begin
47
- IPAddr.new(search)
48
- rescue
49
- nil
50
- end
51
- current_config.keys.detect do |key|
52
- key.casecmp(search) == 0 ||
53
- search =~ /#{key}$/i ||
54
- key =~ /^#{search}\./i
59
+ with_file_lock do |file|
60
+ search = IPAddr.new(search).reverse if begin
61
+ IPAddr.new(search)
62
+ rescue StandardError
63
+ nil
64
+ end
65
+ current_config(file).keys.detect do |key|
66
+ key.casecmp(search) == 0 ||
67
+ search =~ /#{key}$/i ||
68
+ key =~ /^#{search}\./i
69
+ end
55
70
  end
56
71
  end
57
72
 
58
73
  def get(key)
59
- current_config[key]
74
+ with_file_lock do |file|
75
+ current_config(file)[key]
76
+ end
60
77
  end
61
78
 
62
79
  def clear!
63
- write({})
80
+ with_file_lock do |file|
81
+ write({}, file)
82
+ end
64
83
  end
65
84
 
66
85
  protected
67
86
 
68
- def current_config
87
+ def with_file_lock
88
+ Filelock @backing_file.to_s, wait: 3 do |file|
89
+ yield file
90
+ end
91
+ rescue Filelock::WaitTimeout
92
+ raise ConfigLockError, 'Unable to lock Landrush config'
93
+ end
94
+
95
+ def current_config(file)
69
96
  if backing_file.exist?
70
97
  begin
71
- JSON.parse(File.read(backing_file))
98
+ file.rewind
99
+ JSON.parse(file.read)
72
100
  rescue JSON::ParserError
73
101
  {}
74
102
  end
@@ -77,10 +105,11 @@ module Landrush
77
105
  end
78
106
  end
79
107
 
80
- def write(config)
81
- File.open(backing_file, 'w') do |f|
82
- f.write(JSON.pretty_generate(config))
83
- end
108
+ def write(config, file)
109
+ file.rewind
110
+ file.truncate(0)
111
+ file.write(JSON.pretty_generate(config))
112
+ file.flush
84
113
  end
85
114
  end
86
115
  end
@@ -0,0 +1,10 @@
1
+ module Landrush
2
+ module Util
3
+ class Dnsmasq
4
+ def self.nm_managed?
5
+ nm_config = Pathname('/etc/NetworkManager/NetworkManager.conf')
6
+ File.exist?(nm_config) && File.readlines(nm_config).grep(/^dns=dnsmasq$/).any?
7
+ end
8
+ end
9
+ end
10
+ end
@@ -2,24 +2,22 @@ module Landrush
2
2
  module Util
3
3
  # A module containing helper classes for dealing with pid files
4
4
  module ProcessHelper
5
- def write_pid(pid, pid_file)
6
- ensure_path_exits(pid_file)
7
- File.open(pid_file, 'w') { |f| f << pid.to_s }
5
+ def write_pid(pid, file)
6
+ file.rewind
7
+ file.truncate(0)
8
+ file.write pid
9
+ file.flush
8
10
  end
9
11
 
10
- def read_pid(pid_file)
11
- IO.read(pid_file).to_i
12
- rescue
12
+ def read_pid(file)
13
+ file.rewind
14
+ file.read.to_i
15
+ rescue StandardError
13
16
  nil
14
17
  end
15
18
 
16
- def delete_pid_file(pid_file)
17
- FileUtils.rm(pid_file) if File.exist? pid_file
18
- end
19
-
20
- def process_status(pid_file)
21
- return running? ? :running : :unknown if File.exist? pid_file
22
- :stopped
19
+ def process_status(file)
20
+ running?(file) ? :running : :stopped
23
21
  end
24
22
 
25
23
  def ensure_path_exits(file_name)
@@ -27,12 +25,14 @@ module Landrush
27
25
  FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
28
26
  end
29
27
 
30
- def terminate_process(pid)
28
+ def terminate_process(file)
29
+ pid = read_pid(file)
30
+
31
31
  # Kill/Term loop - if the daemon didn't die easily, shoot
32
32
  # it a few more times.
33
33
  attempts = 5
34
- while running? && attempts > 0
35
- sig = (attempts >= 2) ? 'KILL' : 'TERM'
34
+ while running?(file) && attempts > 0
35
+ sig = attempts >= 2 ? 'KILL' : 'TERM'
36
36
 
37
37
  puts "Sending #{sig} to process #{pid}..."
38
38
  Process.kill(sig, pid)
@@ -6,6 +6,7 @@ module Landrush
6
6
  n = 0
7
7
  while n < opts[:tries]
8
8
  return true if yield
9
+
9
10
  sleep opts[:sleep].to_f if opts[:sleep]
10
11
  n += 1
11
12
  end
@@ -1,3 +1,3 @@
1
1
  module Landrush
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
@@ -13,7 +13,7 @@ module Landrush
13
13
  end
14
14
 
15
15
  it 'calls the next app in the chain' do
16
- app = -> (e) { e[:called] = true }
16
+ app = ->(e) { e[:called] = true }
17
17
  setup = Landrush::Action::Setup.new(app, env)
18
18
 
19
19
  setup.call(env)
@@ -26,7 +26,7 @@ module Landrush
26
26
 
27
27
  setup.call(env)
28
28
 
29
- DependentVMs.list.must_equal %w(somehost.vagrant.test)
29
+ DependentVMs.list.must_equal %w[somehost.vagrant.test]
30
30
  end
31
31
 
32
32
  it "starts the landrush server if it's not already started" do
@@ -34,7 +34,7 @@ module Landrush
34
34
 
35
35
  setup.call(env)
36
36
 
37
- Server.running?.must_equal true
37
+ Server.status.must_equal :running
38
38
  end
39
39
 
40
40
  it "does not attempt to start the server if it's already up" do
@@ -43,12 +43,13 @@ module Landrush
43
43
  Server.working_dir = File.join(env[:home_path], 'data', 'landrush')
44
44
  Server.gems_dir = env[:gems_path].to_s + '/gems'
45
45
  Server.start
46
- original_pid = Server.pid
46
+ original_pid = Server.read_pid(File.open(File.join(Server.working_dir, 'run', 'landrush.pid')))
47
47
 
48
48
  setup.call(env)
49
49
 
50
- Server.running?.must_equal true
51
- Server.pid.must_equal original_pid
50
+ Server.status.must_equal :running
51
+ new_pid = Server.read_pid(File.open(File.join(Server.working_dir, 'run', 'landrush.pid')))
52
+ new_pid.must_equal original_pid
52
53
  end
53
54
 
54
55
  it 'does nothing if it is not enabled via config' do
@@ -93,7 +94,7 @@ module Landrush
93
94
  setup = Landrush::Action::Setup.new(app, env)
94
95
  setup.call(env)
95
96
 
96
- Store.hosts.get('somehost.vagrant.test').must_equal nil
97
+ assert_nil Store.hosts.get('somehost.vagrant.test')
97
98
  end
98
99
  end
99
100
  end
@@ -7,7 +7,7 @@ module Landrush
7
7
  describe Teardown do
8
8
  it 'calls the next app in the chain' do
9
9
  env = fake_environment
10
- app = -> (e) { e[:called] = true }
10
+ app = ->(e) { e[:called] = true }
11
11
  teardown = Teardown.new(app, env)
12
12
 
13
13
  teardown.call(env)
@@ -23,7 +23,7 @@ module Landrush
23
23
  Store.hosts.set('somehost.vagrant.test', '1.2.3.4')
24
24
  teardown.call(env)
25
25
 
26
- Store.hosts.get('somehost.vagrant.test').must_equal nil
26
+ assert_nil Store.hosts.get('somehost.vagrant.test')
27
27
  end
28
28
 
29
29
  it 'removes the machine as a dependent VM' do
@@ -45,7 +45,7 @@ module Landrush
45
45
  Server.start
46
46
  teardown.call(env)
47
47
 
48
- Server.running?.must_equal false
48
+ Server.status.must_equal :stopped
49
49
  end
50
50
 
51
51
  it 'leaves the landrush server when other dependent vms exist' do
@@ -60,7 +60,7 @@ module Landrush
60
60
  Server.start
61
61
  teardown.call(env)
62
62
 
63
- Server.running?.must_equal true
63
+ Server.status.must_equal :running
64
64
  end
65
65
 
66
66
  it 'leaves static entries when other dependent vms exist' do
@@ -84,7 +84,7 @@ module Landrush
84
84
 
85
85
  teardown.call(env)
86
86
 
87
- Server.running?.must_equal false
87
+ Server.status.must_equal :stopped
88
88
  end
89
89
 
90
90
  it 'does nothing when landrush is disabled' do
@@ -5,7 +5,7 @@ describe Landrush::Cap::Linux::RedirectDns do
5
5
 
6
6
  describe 'redirect_dns' do
7
7
  it 'fetches the dns servers from the machine, and adds one iptables rule per server' do
8
- machine.guest.stubs(:capability).with(:configured_dns_servers).returns(%w(1.2.3.4 4.5.6.7))
8
+ machine.guest.stubs(:capability).with(:configured_dns_servers).returns(%w[1.2.3.4 4.5.6.7])
9
9
 
10
10
  machine.guest.expects(:capability).with(:add_iptables_rule, 'OUTPUT -t nat -p tcp -d 1.2.3.4 --dport 53 -j DNAT --to-destination 2.3.4.5:4321').once
11
11
  machine.guest.expects(:capability).with(:add_iptables_rule, 'OUTPUT -t nat -p udp -d 1.2.3.4 --dport 53 -j DNAT --to-destination 2.3.4.5:4321').once
@@ -23,7 +23,7 @@ module Landrush
23
23
  # also disable 'sudo'
24
24
  ConfigureVisibilityOnHost.stubs(:sudo).returns('')
25
25
 
26
- ConfigureVisibilityOnHost.configure_visibility_on_host(env, '42.42.42.42', 'vagrant.test')
26
+ ConfigureVisibilityOnHost.configure_visibility_on_host(env, '42.42.42.42', ['vagrant.test'])
27
27
 
28
28
  Dir["#{dir}/*"].empty?.must_equal false
29
29
  File.exist?(File.join(dir, 'vagrant.test')).must_equal true
@@ -31,7 +31,7 @@ module Landrush
31
31
  end
32
32
  end
33
33
 
34
- it 'the config file is named after the configured tld' do
34
+ it 'multiple tlds can be specified' do
35
35
  Dir.mktmpdir('landrush-test-dir-') do |dir|
36
36
  # puts "Using #{dir} for testing"
37
37
  Dir["#{dir}/*"].empty?.must_equal true
@@ -41,11 +41,15 @@ module Landrush
41
41
  # also disable 'sudo'
42
42
  ConfigureVisibilityOnHost.stubs(:sudo).returns('')
43
43
 
44
- ConfigureVisibilityOnHost.configure_visibility_on_host(env, '42.42.42.42', 'foo.bar')
44
+ tlds = %w[foo.bar acme.com example.com]
45
45
 
46
- Dir["#{dir}/*"].empty?.must_equal false
47
- File.exist?(File.join(dir, 'foo.bar')).must_equal true
48
- Pathname(File.join(dir, 'foo.bar')).read.must_equal CONFIG
46
+ ConfigureVisibilityOnHost.configure_visibility_on_host(env, '42.42.42.42', tlds)
47
+
48
+ tlds.each do |tld|
49
+ Dir["#{dir}/*"].empty?.must_equal false
50
+ File.exist?(File.join(dir, tld)).must_equal true
51
+ Pathname(File.join(dir, tld)).read.must_equal CONFIG
52
+ end
49
53
  end
50
54
  end
51
55
  end
@@ -22,7 +22,7 @@ module Landrush
22
22
  skip('Only supported on Linux') unless Vagrant::Util::Platform.linux?
23
23
  File.exist?(TEST_CONFIG).must_equal false
24
24
 
25
- Landrush::Cap::Linux::ConfigureVisibilityOnHost.configure_visibility_on_host(Vagrant::Environment.new, TEST_IP, TEST_TLD)
25
+ Landrush::Cap::Linux::ConfigureVisibilityOnHost.configure_visibility_on_host(Vagrant::Environment.new, TEST_IP, [TEST_TLD])
26
26
 
27
27
  File.exist?(TEST_CONFIG).must_equal true
28
28
  Pathname(TEST_CONFIG).read.must_equal CONFIG
@@ -6,6 +6,25 @@ module Landrush
6
6
  describe ConfigureVisibilityOnHost do
7
7
  TEST_IP = '10.42.42.42'.freeze
8
8
 
9
+ DOT_3_SVC_RUNNING = 'SERVICE_NAME: dot3svc
10
+ TYPE : 30 WIN32
11
+ STATE : 4 RUNNING
12
+ (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
13
+ WIN32_EXIT_CODE : 0 (0x0)
14
+ SERVICE_EXIT_CODE : 0 (0x0)
15
+ CHECKPOINT : 0x0
16
+ WAIT_HINT : 0x0
17
+ '.freeze
18
+
19
+ DOT_3_SVC_STOPPED = 'SERVICE_NAME: dot3svc
20
+ TYPE : 30 WIN32
21
+ STATE : 1 STOPPED
22
+ WIN32_EXIT_CODE : 0 (0x0)
23
+ SERVICE_EXIT_CODE : 0 (0x0)
24
+ CHECKPOINT : 0x0
25
+ WAIT_HINT : 0x0
26
+ '.freeze
27
+
9
28
  before do
10
29
  @vboxmanage_found = !Vagrant::Util::Which.which('VBoxManage').nil?
11
30
  @has_admin_privileges = Landrush::Cap::Windows::ConfigureVisibilityOnHost.admin_mode?
@@ -24,21 +43,33 @@ module Landrush
24
43
  network_name = get_network_name(old_network_state, new_network_state)
25
44
 
26
45
  get_dns_for_name(network_name).must_be_nil
27
- Landrush::Cap::Windows::ConfigureVisibilityOnHost.configure_visibility_on_host(fake_environment, TEST_IP, 'landrush.test')
46
+ Landrush::Cap::Windows::ConfigureVisibilityOnHost.configure_visibility_on_host(fake_environment, TEST_IP, ['landrush.test'])
28
47
  get_dns_for_name(network_name).must_equal '127.0.0.1'
29
- rescue
48
+ rescue StandardError
30
49
  delete_test_interface network_description
31
50
  end
32
51
  end
33
52
  end
34
53
 
54
+ describe '#wired_autoconfig_service_running?' do
55
+ it 'service running' do
56
+ Landrush::Cap::Windows::ConfigureVisibilityOnHost.expects(:wired_autoconfig_service_state).returns(DOT_3_SVC_RUNNING)
57
+ assert ConfigureVisibilityOnHost.send(:wired_autoconfig_service_running?)
58
+ end
59
+
60
+ it 'service stopped' do
61
+ Landrush::Cap::Windows::ConfigureVisibilityOnHost.expects(:wired_autoconfig_service_state).returns(DOT_3_SVC_STOPPED)
62
+ refute ConfigureVisibilityOnHost.send(:wired_autoconfig_service_running?)
63
+ end
64
+ end
65
+
35
66
  def network_state
36
67
  `netsh interface ip show config`.split(/\n/).reject(&:empty?)
37
68
  end
38
69
 
39
70
  def get_network_name(old_network_state, new_network_state)
40
71
  new_network_state.reject! { |line| old_network_state.include? line }
41
- new_network_state[0].match(/.*\"(.*)\"$/).captures[0]
72
+ new_network_state[0].match(/.*"(.*)"$/).captures[0]
42
73
  end
43
74
 
44
75
  # Creates a test interface using VBoxMange and sets a known test IP
@@ -60,7 +91,7 @@ module Landrush
60
91
  # TODO: better error handling
61
92
  begin
62
93
  dns[0].match(/.* (\d{1,3}\.\d{1,3}\.\d{1,3}.\d{1,3}).*/).captures[0]
63
- rescue
94
+ rescue StandardError
64
95
  return nil
65
96
  end
66
97
  end
@@ -6,65 +6,65 @@ module Landrush
6
6
  describe ReadHostVisibleIpAddress do
7
7
  let(:landrush_ip_output) do
8
8
  <<YAML
9
- - name: br-44ba74744d5d
10
- ipv4: 172.17.0.1
11
- ipv6: fe80::42:e1ff:fe01:ae98
12
- - name: br-7884014b4104
13
- ipv4: 172.19.0.1
14
- ipv6: fe80::42:c0ff:fe4b:900c
15
- - name: br-efce9da0c1fd
16
- ipv4: 172.18.0.1
17
- ipv6: fe80::42:2ff:fe46:f1d1
18
- - name: docker0
19
- ipv4: 172.16.0.1
20
- ipv6: fe80::42:dbff:fe1b:6e92
21
- - name: docker_gwbridge
22
- ipv4: 172.20.0.1
23
- ipv6: fe80::42:72ff:fe96:c6df
24
- - name: enp4s0
25
- ipv4: 192.168.88.97
26
- ipv6: fe80::323d:9fa0:ef2a:ddf5
27
- - name: wlp3s0
28
- ipv4: 192.168.88.118
29
- ipv6: fe80::6b80:15d4:e83c:a59d
30
- - name: lo
31
- ipv4: 127.0.0.1
32
- ipv6: ::1/128
33
- - name: veth050aa01
34
- ipv4: ""
35
- ipv6: fe80::c83a:8eff:fe7a:3244
36
- - name: veth1c191f7
37
- ipv4: ""
38
- ipv6: fe80::b498:f3ff:fea1:3243
39
- - name: veth38aa771
40
- ipv4: ""
41
- ipv6: fe80::8c97:e2ff:fe1a:b14f
42
- - name: veth5f49498
43
- ipv4: ""
44
- ipv6: fe80::6825:20ff:fef5:a00d
45
- - name: veth7803c65
46
- ipv4: ""
47
- ipv6: fe80::34d7:6cff:fe28:54ce
48
- - name: veth8a09803
49
- ipv4: ""
50
- ipv6: fe80::b436:30ff:fed1:598e
51
- - name: veth8bf1652
52
- ipv4: ""
53
- ipv6: fe80::60a8:67ff:fe85:cce4
54
- - name: veth95ef8de
55
- ipv4: ""
56
- ipv6: fe80::9c45:e8ff:fe69:e62f
57
- - name: vethc75f284
58
- ipv4: ""
59
- ipv6: fe80::78b2:7fff:fe55:59
60
- - name: vethe533ef0
61
- ipv4: ""
62
- ipv6: fe80::b83e:93ff:fe52:aac7
9
+ - name: br-44ba74744d5d
10
+ ipv4: 172.17.0.1
11
+ ipv6: fe80::42:e1ff:fe01:ae98
12
+ - name: br-7884014b4104
13
+ ipv4: 172.19.0.1
14
+ ipv6: fe80::42:c0ff:fe4b:900c
15
+ - name: br-efce9da0c1fd
16
+ ipv4: 172.18.0.1
17
+ ipv6: fe80::42:2ff:fe46:f1d1
18
+ - name: docker0
19
+ ipv4: 172.16.0.1
20
+ ipv6: fe80::42:dbff:fe1b:6e92
21
+ - name: docker_gwbridge
22
+ ipv4: 172.20.0.1
23
+ ipv6: fe80::42:72ff:fe96:c6df
24
+ - name: enp4s0
25
+ ipv4: 192.168.88.97
26
+ ipv6: fe80::323d:9fa0:ef2a:ddf5
27
+ - name: wlp3s0
28
+ ipv4: 192.168.88.118
29
+ ipv6: fe80::6b80:15d4:e83c:a59d
30
+ - name: lo
31
+ ipv4: 127.0.0.1
32
+ ipv6: ::1/128
33
+ - name: veth050aa01
34
+ ipv4: ""
35
+ ipv6: fe80::c83a:8eff:fe7a:3244
36
+ - name: veth1c191f7
37
+ ipv4: ""
38
+ ipv6: fe80::b498:f3ff:fea1:3243
39
+ - name: veth38aa771
40
+ ipv4: ""
41
+ ipv6: fe80::8c97:e2ff:fe1a:b14f
42
+ - name: veth5f49498
43
+ ipv4: ""
44
+ ipv6: fe80::6825:20ff:fef5:a00d
45
+ - name: veth7803c65
46
+ ipv4: ""
47
+ ipv6: fe80::34d7:6cff:fe28:54ce
48
+ - name: veth8a09803
49
+ ipv4: ""
50
+ ipv6: fe80::b436:30ff:fed1:598e
51
+ - name: veth8bf1652
52
+ ipv4: ""
53
+ ipv6: fe80::60a8:67ff:fe85:cce4
54
+ - name: veth95ef8de
55
+ ipv4: ""
56
+ ipv6: fe80::9c45:e8ff:fe69:e62f
57
+ - name: vethc75f284
58
+ ipv4: ""
59
+ ipv6: fe80::78b2:7fff:fe55:59
60
+ - name: vethe533ef0
61
+ ipv4: ""
62
+ ipv6: fe80::b83e:93ff:fe52:aac7
63
63
  YAML
64
64
  end
65
65
 
66
66
  let(:machine) { fake_machine }
67
- let(:addresses) { YAML.load(landrush_ip_output) }
67
+ let(:addresses) { YAML.safe_load(landrush_ip_output) }
68
68
 
69
69
  def call_cap(machine)
70
70
  Landrush::Cap::All::ReadHostVisibleIpAddress.read_host_visible_ip_address(machine)