landrush 1.1.0.beta.1 → 1.1.0.beta.2
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 +4 -4
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +5 -14
- data/.travis.yml +1 -1
- data/README.md +29 -5
- data/lib/landrush.rb +0 -2
- data/lib/landrush/action/setup.rb +2 -12
- data/lib/landrush/cap/{all → guest/all}/read_host_visible_ip_address.rb +0 -0
- data/lib/landrush/cap/{debian → guest/debian}/install_iptables.rb +0 -0
- data/lib/landrush/cap/{debian → guest/debian}/iptables_installed.rb +0 -0
- data/lib/landrush/cap/{linux → guest/linux}/add_iptables_rule.rb +1 -1
- data/lib/landrush/cap/{linux → guest/linux}/configured_dns_servers.rb +0 -0
- data/lib/landrush/cap/{linux → guest/linux}/redirect_dns.rb +0 -0
- data/lib/landrush/cap/{redhat → guest/redhat}/install_iptables.rb +0 -0
- data/lib/landrush/cap/{redhat → guest/redhat}/iptables_installed.rb +0 -0
- data/lib/landrush/cap/host/darwin/configure_visibility_on_host.rb +62 -0
- data/lib/landrush/cap/host/debian/dnsmasq_installed.rb +11 -0
- data/lib/landrush/cap/host/debian/host.rb +11 -0
- data/lib/landrush/cap/host/debian/install_dnsmasq.rb +12 -0
- data/lib/landrush/cap/host/debian/restart_dnsmasq.rb +11 -0
- data/lib/landrush/cap/host/linux/configure_visibility_on_host.rb +18 -0
- data/lib/landrush/cap/host/linux/create_dnsmasq_config.rb +65 -0
- data/lib/landrush/cap/host/redhat/dnsmasq_installed.rb +11 -0
- data/lib/landrush/cap/host/redhat/install_dnsmasq.rb +14 -0
- data/lib/landrush/cap/host/redhat/restart_dnsmasq.rb +23 -0
- data/lib/landrush/cap/host/ubuntu/host.rb +12 -0
- data/lib/landrush/cap/host/windows/configure_visibility_on_host.rb +187 -0
- data/lib/landrush/config.rb +22 -15
- data/lib/landrush/plugin.rb +68 -8
- data/lib/landrush/version.rb +1 -1
- data/test/landrush/action/setup_test.rb +4 -34
- data/test/landrush/cap/{all → guest/all}/read_host_visible_ip_address_test.rb +1 -1
- data/test/landrush/cap/{linux → guest/linux}/configured_dns_servers_test.rb +1 -1
- data/test/landrush/cap/{linux → guest/linux}/redirect_dns_test.rb +2 -5
- data/test/landrush/cap/host/darwin/configure_visibility_on_host_test.rb +56 -0
- data/test/landrush/cap/host/linux/configure_visibility_on_host_test.rb +34 -0
- data/test/landrush/cap/host/windows/configure_visibility_on_host_test.rb +70 -0
- data/test/test_helper.rb +28 -17
- metadata +34 -26
- data/lib/landrush/resolver_config.rb +0 -68
- data/lib/landrush/win_network_config.rb +0 -185
- data/test/landrush/resolver_config_test.rb +0 -19
- data/test/landrush/win_network_config_test.rb +0 -70
- data/test/support/fake_resolver_config.rb +0 -25
- data/test/support/fake_ui.rb +0 -5
@@ -0,0 +1,23 @@
|
|
1
|
+
module Landrush
|
2
|
+
module Cap
|
3
|
+
module Redhat
|
4
|
+
module RestartDnsmasq
|
5
|
+
class << self
|
6
|
+
SED_COMMAND = <<-EOF.gsub(/^ +/, '')
|
7
|
+
sudo sed -i.orig '/nameserver/i\\
|
8
|
+
nameserver 127.0.0.1 # Added by landrush, a vagrant plugin
|
9
|
+
|
10
|
+
' /etc/resolv.conf
|
11
|
+
EOF
|
12
|
+
|
13
|
+
def restart_dnsmasq(_env)
|
14
|
+
# TODO: At some stage we might want to make create_dnsmasq_config host specific and add the resolv.conf
|
15
|
+
# changes there which seems more natural
|
16
|
+
system(SED_COMMAND) unless system("cat /etc/resolv.conf | grep 'nameserver 127.0.0.1' > /dev/null 2>&1")
|
17
|
+
system('sudo systemctl restart dnsmasq')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Landrush
|
2
|
+
module Cap
|
3
|
+
module Ubuntu
|
4
|
+
class UbuntuHost < Vagrant.plugin('2', 'host')
|
5
|
+
def detect?(_env)
|
6
|
+
return false unless Pathname('/usr/bin/lsb_release').exist?
|
7
|
+
system("/usr/bin/lsb_release -i | grep 'Ubuntu' >/dev/null 2>&1")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
# This file needs to be able to execute out of the Vagrant context. Do not require any non core or non relative files
|
2
|
+
require 'ipaddr'
|
3
|
+
require_relative '../../../util/retry'
|
4
|
+
|
5
|
+
module Landrush
|
6
|
+
module Cap
|
7
|
+
module Windows
|
8
|
+
class ConfigureVisibilityOnHost
|
9
|
+
# Windows registry path under which network interface configuration is stored
|
10
|
+
INTERFACES = 'SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces'.freeze
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def configure_visibility_on_host(env, ip, tld)
|
14
|
+
@env = env
|
15
|
+
update_network_adapter(ip, tld) if ensure_prerequisites
|
16
|
+
end
|
17
|
+
|
18
|
+
# If this registry query succeeds we assume we have Admin rights
|
19
|
+
# http://stackoverflow.com/questions/8268154/run-ruby-script-in-elevated-mode/27954953
|
20
|
+
def admin_mode?
|
21
|
+
(`reg query HKU\\S-1-5-19 2>&1` =~ /ERROR/).nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# Checks that all required tools are on the PATH and that the Wired AutoConfig service is started
|
27
|
+
def ensure_prerequisites
|
28
|
+
return false unless command_found('netsh')
|
29
|
+
return false unless command_found('net')
|
30
|
+
return false unless command_found('reg')
|
31
|
+
|
32
|
+
unless wired_autoconfig_service_running?
|
33
|
+
info('starting \'Wired AutoConfig\' service')
|
34
|
+
if self.class.admin_mode?
|
35
|
+
`net start dot3svc`
|
36
|
+
else
|
37
|
+
require 'win32ole'
|
38
|
+
shell = WIN32OLE.new('Shell.Application')
|
39
|
+
shell.ShellExecute('net', 'start dot3svc', nil, 'runas', 1)
|
40
|
+
end
|
41
|
+
service_has_started = self.retry(tries: 5, sleep: 1) do
|
42
|
+
wired_autoconfig_service_running?
|
43
|
+
end
|
44
|
+
unless service_has_started
|
45
|
+
info('Unable to start \'Wired AutoConfig\' service. Unable to configure DNS on host. Try manual configuration.')
|
46
|
+
return false
|
47
|
+
end
|
48
|
+
info('\'Wired AutoConfig\' service has started.')
|
49
|
+
end
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
53
|
+
# Does the actual update of the network configuration
|
54
|
+
def update_network_adapter(ip, tld)
|
55
|
+
# Need to defer loading to ensure cross OS compatibility
|
56
|
+
require 'win32/registry'
|
57
|
+
ensure_admin_privileges(__FILE__.to_s, ip, tld)
|
58
|
+
|
59
|
+
network_name = get_network_name(ip)
|
60
|
+
if network_name.nil?
|
61
|
+
info("unable to determine network interface for #{ip}. DNS on host cannot be configured. Try manual configuration.")
|
62
|
+
return
|
63
|
+
else
|
64
|
+
info("adding Landrush'es DNS server to network '#{network_name}' using DNS IP '#{ip}'' and search domain '#{tld}'")
|
65
|
+
end
|
66
|
+
network_guid = get_guid(network_name)
|
67
|
+
if network_guid.nil?
|
68
|
+
info("unable to determine network GUID for #{ip}. DNS on host cannot be configured. Try manual configuration.")
|
69
|
+
return
|
70
|
+
end
|
71
|
+
interface_path = INTERFACES + "\\{#{network_guid}}"
|
72
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.open(interface_path, Win32::Registry::KEY_ALL_ACCESS) do |reg|
|
73
|
+
reg['NameServer'] = '127.0.0.1'
|
74
|
+
reg['Domain'] = tld
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Given a network name (as displayed on 'Control Panel\Network and Internet\Network Connections'),
|
79
|
+
# determines the GUID of this network interface using 'netsh'.
|
80
|
+
#
|
81
|
+
# To make this work the "Wired Autoconfig" service must be started (go figure).
|
82
|
+
#
|
83
|
+
# Output of netsh command which is being processed:
|
84
|
+
#
|
85
|
+
# There are 4 interfaces on the system:
|
86
|
+
#
|
87
|
+
# Name : Ethernet
|
88
|
+
# Description : Intel(R) Ethernet Connection (3) I218-LM
|
89
|
+
# GUID : fd9270f6-aff6-4f24-bc4a-1f90c032d5c3
|
90
|
+
# Physical Address : 50-7B-9D-AB-25-1D
|
91
|
+
# \n\n
|
92
|
+
# ...
|
93
|
+
def get_guid(network_name)
|
94
|
+
cmd_out = `netsh lan show interfaces`
|
95
|
+
interface_details = cmd_out.split(/\n\n/).select { |settings| settings.match(/#{Regexp.quote(network_name)}/m) }
|
96
|
+
return nil if interface_details.empty?
|
97
|
+
interface_details[0].split(/\n/)[2].match(/.*:(.*)/).captures[0].strip
|
98
|
+
end
|
99
|
+
|
100
|
+
# Given an IP determines the network name, if any. Uses netsh which generates output like this:
|
101
|
+
#
|
102
|
+
# ...
|
103
|
+
# \n\n
|
104
|
+
# Configuration for interface "Ethernet 2"
|
105
|
+
# DHCP enabled: Yes
|
106
|
+
# IP Address: 10.10.10.1
|
107
|
+
# Subnet Prefix: 10.10.10.0/24 (mask 255.255.255.0)
|
108
|
+
# InterfaceMetric: 10
|
109
|
+
# DNS servers configured through DHCP: None
|
110
|
+
# Register with which suffix: Primary only
|
111
|
+
# WINS servers configured through DHCP: None
|
112
|
+
# \n\n
|
113
|
+
# ...
|
114
|
+
def get_network_name(ip)
|
115
|
+
cmd_out = `netsh interface ip show config`
|
116
|
+
network_details = cmd_out.split(/\n\n/).select do |settings|
|
117
|
+
begin
|
118
|
+
lines = settings.split(/\n/).reject(&:empty?)
|
119
|
+
subnet = lines[3]
|
120
|
+
next false unless subnet =~ /Subnet Prefix/
|
121
|
+
|
122
|
+
mask = IPAddr.new(subnet.match(%r{.* (\d{1,3}\.\d{1,3}\.\d{1,3}.\d{1,3}/\d{1,3}).*}).captures[0])
|
123
|
+
address = IPAddr.new(ip)
|
124
|
+
|
125
|
+
mask.include?(address)
|
126
|
+
rescue
|
127
|
+
false
|
128
|
+
end
|
129
|
+
end
|
130
|
+
return nil if network_details[0].nil?
|
131
|
+
network_details[0].split(/\n/)[0].match(/Configuration for interface "(.*)"/).captures[0].strip
|
132
|
+
end
|
133
|
+
|
134
|
+
# Makes sure that we have admin privileges and if nor starts a new shell with the required
|
135
|
+
# privileges
|
136
|
+
def ensure_admin_privileges(file, *args)
|
137
|
+
unless admin_mode?
|
138
|
+
require 'win32ole'
|
139
|
+
shell = WIN32OLE.new('Shell.Application')
|
140
|
+
shell.ShellExecute('ruby', "#{file} #{args.join(' ')}", nil, 'runas', 1)
|
141
|
+
# need to exit current execution, changes will occur in new environment
|
142
|
+
exit
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def info(msg)
|
147
|
+
@env[:ui].info("[landrush] #{msg}") unless @env.nil?
|
148
|
+
end
|
149
|
+
|
150
|
+
def wired_autoconfig_service_running?
|
151
|
+
cmd_out = `net start`
|
152
|
+
cmd_out =~ /Wired AutoConfig/m
|
153
|
+
end
|
154
|
+
|
155
|
+
def command_found(cmd)
|
156
|
+
if which(cmd).nil?
|
157
|
+
info("Cannot find '#{cmd}' on the PATH. Unable to configure DNS. Try manual configuration.")
|
158
|
+
false
|
159
|
+
else
|
160
|
+
true
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Cross-platform way of finding an executable in the $PATH.
|
165
|
+
#
|
166
|
+
# which('ruby') #=> /usr/bin/ruby
|
167
|
+
def which(cmd)
|
168
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
169
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
170
|
+
exts.each do |ext|
|
171
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
172
|
+
return exe if File.executable?(exe) && !File.directory?(exe)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
nil
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Only run the following code when this file is the main file being run
|
184
|
+
# instead of having been required or loaded by another file
|
185
|
+
if __FILE__ == $0
|
186
|
+
Landrush::Cap::Windows::ConfigureVisibilityOnHost.configure_visibility_on_host(nil, ARGV[0], ARGV[1])
|
187
|
+
end
|
data/lib/landrush/config.rb
CHANGED
@@ -8,26 +8,29 @@ module Landrush
|
|
8
8
|
attr_accessor :guest_redirect_dns
|
9
9
|
attr_accessor :host_interface
|
10
10
|
attr_accessor :host_interface_excludes
|
11
|
+
attr_accessor :host_redirect_dns
|
11
12
|
|
12
13
|
DEFAULTS = {
|
13
|
-
:enabled
|
14
|
-
:tld
|
15
|
-
:upstream_servers
|
16
|
-
:host_ip_address
|
17
|
-
:guest_redirect_dns
|
18
|
-
:host_interface
|
19
|
-
:host_interface_excludes
|
14
|
+
:enabled => false,
|
15
|
+
:tld => 'vagrant.test',
|
16
|
+
:upstream_servers => [[:udp, '8.8.8.8', 53], [:tcp, '8.8.8.8', 53]],
|
17
|
+
:host_ip_address => nil,
|
18
|
+
:guest_redirect_dns => true,
|
19
|
+
:host_interface => nil,
|
20
|
+
:host_interface_excludes => [/lo[0-9]*/, /docker[0-9]+/, /tun[0-9]+/],
|
21
|
+
:host_redirect_dns => true
|
20
22
|
}.freeze
|
21
23
|
|
22
24
|
def initialize
|
23
|
-
@hosts
|
24
|
-
@enabled
|
25
|
-
@tld
|
26
|
-
@upstream_servers
|
27
|
-
@host_ip_address
|
28
|
-
@guest_redirect_dns
|
29
|
-
@host_interface
|
30
|
-
@host_interface_excludes
|
25
|
+
@hosts = {}
|
26
|
+
@enabled = UNSET_VALUE
|
27
|
+
@tld = UNSET_VALUE
|
28
|
+
@upstream_servers = UNSET_VALUE
|
29
|
+
@host_ip_address = UNSET_VALUE
|
30
|
+
@guest_redirect_dns = UNSET_VALUE
|
31
|
+
@host_interface = UNSET_VALUE
|
32
|
+
@host_interface_excludes = UNSET_VALUE
|
33
|
+
@host_redirect_dns = UNSET_VALUE
|
31
34
|
end
|
32
35
|
|
33
36
|
def enable
|
@@ -46,6 +49,10 @@ module Landrush
|
|
46
49
|
@guest_redirect_dns
|
47
50
|
end
|
48
51
|
|
52
|
+
def host_redirect_dns?
|
53
|
+
@host_redirect_dns
|
54
|
+
end
|
55
|
+
|
49
56
|
def host(hostname, ip_address=nil)
|
50
57
|
@hosts[hostname] = ip_address
|
51
58
|
end
|
data/lib/landrush/plugin.rb
CHANGED
@@ -63,43 +63,103 @@ module Landrush
|
|
63
63
|
action_hook 'landrush_teardown', :machine_action_reload, &landrush_teardown
|
64
64
|
|
65
65
|
guest_capability('debian', 'iptables_installed') do
|
66
|
-
require_relative 'cap/debian/iptables_installed'
|
66
|
+
require_relative 'cap/guest/debian/iptables_installed'
|
67
67
|
Cap::Debian::IptablesInstalled
|
68
68
|
end
|
69
69
|
|
70
70
|
guest_capability('debian', 'install_iptables') do
|
71
|
-
require_relative 'cap/debian/install_iptables'
|
71
|
+
require_relative 'cap/guest/debian/install_iptables'
|
72
72
|
Cap::Debian::InstallIptables
|
73
73
|
end
|
74
74
|
|
75
75
|
guest_capability('redhat', 'iptables_installed') do
|
76
|
-
require_relative 'cap/redhat/iptables_installed'
|
76
|
+
require_relative 'cap/guest/redhat/iptables_installed'
|
77
77
|
Cap::Redhat::IptablesInstalled
|
78
78
|
end
|
79
79
|
|
80
80
|
guest_capability('redhat', 'install_iptables') do
|
81
|
-
require_relative 'cap/redhat/install_iptables'
|
81
|
+
require_relative 'cap/guest/redhat/install_iptables'
|
82
82
|
Cap::Redhat::InstallIptables
|
83
83
|
end
|
84
84
|
|
85
85
|
guest_capability('linux', 'configured_dns_servers') do
|
86
|
-
require_relative 'cap/linux/configured_dns_servers'
|
86
|
+
require_relative 'cap/guest/linux/configured_dns_servers'
|
87
87
|
Cap::Linux::ConfiguredDnsServers
|
88
88
|
end
|
89
89
|
|
90
90
|
guest_capability('linux', 'redirect_dns') do
|
91
|
-
require_relative 'cap/linux/redirect_dns'
|
91
|
+
require_relative 'cap/guest/linux/redirect_dns'
|
92
92
|
Cap::Linux::RedirectDns
|
93
93
|
end
|
94
94
|
|
95
95
|
guest_capability('linux', 'add_iptables_rule') do
|
96
|
-
require_relative 'cap/linux/add_iptables_rule'
|
96
|
+
require_relative 'cap/guest/linux/add_iptables_rule'
|
97
97
|
Cap::Linux::AddIptablesRule
|
98
98
|
end
|
99
99
|
|
100
100
|
guest_capability('linux', 'read_host_visible_ip_address') do
|
101
|
-
require_relative 'cap/all/read_host_visible_ip_address'
|
101
|
+
require_relative 'cap/guest/all/read_host_visible_ip_address'
|
102
102
|
Cap::All::ReadHostVisibleIpAddress
|
103
103
|
end
|
104
|
+
|
105
|
+
host_capability('darwin', 'configure_visibility_on_host') do
|
106
|
+
require_relative 'cap/host/darwin/configure_visibility_on_host'
|
107
|
+
Cap::Darwin::ConfigureVisibilityOnHost
|
108
|
+
end
|
109
|
+
|
110
|
+
host_capability('windows', 'configure_visibility_on_host') do
|
111
|
+
require_relative 'cap/host/windows/configure_visibility_on_host'
|
112
|
+
Cap::Windows::ConfigureVisibilityOnHost
|
113
|
+
end
|
114
|
+
|
115
|
+
host_capability('linux', 'configure_visibility_on_host') do
|
116
|
+
require_relative 'cap/host/linux/configure_visibility_on_host'
|
117
|
+
Cap::Linux::ConfigureVisibilityOnHost
|
118
|
+
end
|
119
|
+
|
120
|
+
host_capability('linux', 'create_dnsmasq_config') do
|
121
|
+
require_relative 'cap/host/linux/create_dnsmasq_config'
|
122
|
+
Cap::Linux::CreateDnsmasqConfig
|
123
|
+
end
|
124
|
+
|
125
|
+
host 'debian', 'linux' do
|
126
|
+
require_relative 'cap/host/debian/host'
|
127
|
+
Cap::Debian::DebianHost
|
128
|
+
end
|
129
|
+
|
130
|
+
host 'ubuntu', 'debian' do
|
131
|
+
require_relative 'cap/host/ubuntu/host'
|
132
|
+
Cap::Ubuntu::UbuntuHost
|
133
|
+
end
|
134
|
+
|
135
|
+
host_capability('debian', 'dnsmasq_installed') do
|
136
|
+
require_relative 'cap/host/debian/dnsmasq_installed'
|
137
|
+
Landrush::Cap::Debian::DnsmasqInstalled
|
138
|
+
end
|
139
|
+
|
140
|
+
host_capability('debian', 'install_dnsmasq') do
|
141
|
+
require_relative 'cap/host/debian/install_dnsmasq'
|
142
|
+
Cap::Debian::InstallDnsmasq
|
143
|
+
end
|
144
|
+
|
145
|
+
host_capability('debian', 'restart_dnsmasq') do
|
146
|
+
require_relative 'cap/host/debian/restart_dnsmasq'
|
147
|
+
Cap::Debian::RestartDnsmasq
|
148
|
+
end
|
149
|
+
|
150
|
+
host_capability('redhat', 'dnsmasq_installed') do
|
151
|
+
require_relative 'cap/host/redhat/dnsmasq_installed'
|
152
|
+
Cap::Redhat::DnsmasqInstalled
|
153
|
+
end
|
154
|
+
|
155
|
+
host_capability('redhat', 'install_dnsmasq') do
|
156
|
+
require_relative 'cap/host/redhat/install_dnsmasq'
|
157
|
+
Cap::Redhat::InstallDnsmasq
|
158
|
+
end
|
159
|
+
|
160
|
+
host_capability('redhat', 'restart_dnsmasq') do
|
161
|
+
require_relative 'cap/host/redhat/restart_dnsmasq'
|
162
|
+
Cap::Redhat::RestartDnsmasq
|
163
|
+
end
|
104
164
|
end
|
105
165
|
end
|
data/lib/landrush/version.rb
CHANGED
@@ -5,17 +5,13 @@ require 'landrush/action/setup'
|
|
5
5
|
module Landrush
|
6
6
|
module Action
|
7
7
|
describe Setup do
|
8
|
+
let(:env) { fake_environment }
|
9
|
+
let(:app) { proc {} }
|
8
10
|
before do
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
after do
|
13
|
-
ResolverConfig.sudo = 'sudo'
|
11
|
+
env[:machine].config.landrush.host_redirect_dns = false
|
14
12
|
end
|
15
13
|
|
16
14
|
it "calls the next app in the chain" do
|
17
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
18
|
-
env = fake_environment
|
19
15
|
app = -> (e) { e[:called] = true }
|
20
16
|
setup = Setup.new(app, nil)
|
21
17
|
|
@@ -25,10 +21,7 @@ module Landrush
|
|
25
21
|
end
|
26
22
|
|
27
23
|
it "records the booting host as a dependent VM" do
|
28
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
29
|
-
app = proc {}
|
30
24
|
setup = Setup.new(app, nil)
|
31
|
-
env = fake_environment
|
32
25
|
|
33
26
|
setup.call(env)
|
34
27
|
|
@@ -36,10 +29,7 @@ module Landrush
|
|
36
29
|
end
|
37
30
|
|
38
31
|
it "starts the landrush server if it's not already started" do
|
39
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
40
|
-
app = proc {}
|
41
32
|
setup = Setup.new(app, nil)
|
42
|
-
env = fake_environment
|
43
33
|
|
44
34
|
setup.call(env)
|
45
35
|
|
@@ -47,10 +37,7 @@ module Landrush
|
|
47
37
|
end
|
48
38
|
|
49
39
|
it "does not attempt to start the server if it's already up" do
|
50
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
51
|
-
app = proc {}
|
52
40
|
setup = Setup.new(app, nil)
|
53
|
-
env = fake_environment
|
54
41
|
|
55
42
|
Server.start
|
56
43
|
original_pid = Server.pid
|
@@ -62,10 +49,7 @@ module Landrush
|
|
62
49
|
end
|
63
50
|
|
64
51
|
it "does nothing if it is not enabled via config" do
|
65
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
66
|
-
app = proc {}
|
67
52
|
setup = Setup.new(app, nil)
|
68
|
-
env = fake_environment
|
69
53
|
|
70
54
|
env[:machine].config.landrush.disable
|
71
55
|
setup.call(env)
|
@@ -74,10 +58,7 @@ module Landrush
|
|
74
58
|
end
|
75
59
|
|
76
60
|
it "for single private network IP host visible IP can be retrieved w/o starting the VM" do
|
77
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
78
|
-
app = proc {}
|
79
61
|
setup = Setup.new(app, nil)
|
80
|
-
env = fake_environment
|
81
62
|
env[:machine].config.vm.network :private_network, ip: '42.42.42.42'
|
82
63
|
|
83
64
|
setup.call(env)
|
@@ -85,10 +66,7 @@ module Landrush
|
|
85
66
|
end
|
86
67
|
|
87
68
|
it "for multiple private network IPs host visible IP cant be retrieved if host_ip_address is set" do
|
88
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
89
|
-
app = proc {}
|
90
69
|
setup = Setup.new(app, nil)
|
91
|
-
env = fake_environment
|
92
70
|
|
93
71
|
env[:machine].config.vm.network :private_network, ip: '42.42.42.41'
|
94
72
|
env[:machine].config.vm.network :private_network, ip: '42.42.42.42'
|
@@ -98,10 +76,7 @@ module Landrush
|
|
98
76
|
end
|
99
77
|
|
100
78
|
it "is possible to add cnames via the config.landrush.host configuration option" do
|
101
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
102
|
-
app = proc {}
|
103
79
|
setup = Setup.new(app, nil)
|
104
|
-
env = fake_environment
|
105
80
|
|
106
81
|
env[:machine].config.landrush.host 'foo', 'bar'
|
107
82
|
setup.call(env)
|
@@ -111,10 +86,7 @@ module Landrush
|
|
111
86
|
|
112
87
|
describe 'after boot' do
|
113
88
|
it "stores the machine's hostname => ip address" do
|
114
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
115
|
-
app = proc {}
|
116
89
|
setup = Setup.new(app, nil)
|
117
|
-
env = fake_environment
|
118
90
|
|
119
91
|
setup.call(env)
|
120
92
|
|
@@ -122,11 +94,9 @@ module Landrush
|
|
122
94
|
end
|
123
95
|
|
124
96
|
it "does nothing if it is not enabled via config" do
|
125
|
-
skip('Not working on Windows, since it will also do the network config') if Vagrant::Util::Platform.windows?
|
126
|
-
app = proc {}
|
127
97
|
setup = Setup.new(app, nil)
|
128
|
-
env = fake_environment(enabled: false)
|
129
98
|
|
99
|
+
env = fake_environment(enabled: false)
|
130
100
|
setup.call(env)
|
131
101
|
|
132
102
|
Store.hosts.get('somehost.vagrant.test').must_equal nil
|