landrush 1.0.0 → 1.1.0.beta.1

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -8
  3. data/.rubocop.yml +1 -0
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG.md +4 -4
  6. data/CONTRIBUTING.md +54 -17
  7. data/Gemfile +4 -8
  8. data/README.md +152 -40
  9. data/features/dns_resolution.feature +9 -0
  10. data/features/landrush-ip.feature +57 -0
  11. data/features/step_definitions/ip.rb +13 -0
  12. data/landrush.gemspec +3 -1
  13. data/lib/landrush/action/setup.rb +49 -10
  14. data/lib/landrush/cap/all/read_host_visible_ip_address.rb +49 -0
  15. data/lib/landrush/config.rb +17 -11
  16. data/lib/landrush/plugin.rb +2 -2
  17. data/lib/landrush/resolver_config.rb +3 -7
  18. data/lib/landrush/server.rb +48 -22
  19. data/lib/landrush/util/retry.rb +16 -0
  20. data/lib/landrush/version.rb +1 -1
  21. data/lib/landrush/win_network_config.rb +185 -0
  22. data/lib/landrush.rb +6 -1
  23. data/test/landrush/action/setup_test.rb +44 -1
  24. data/test/landrush/action/teardown_test.rb +1 -1
  25. data/test/landrush/cap/all/read_host_visible_ip_address_test.rb +87 -0
  26. data/test/landrush/cap/linux/configured_dns_servers_test.rb +1 -1
  27. data/test/landrush/cap/linux/redirect_dns_test.rb +1 -1
  28. data/test/landrush/config_test.rb +1 -1
  29. data/test/landrush/dependent_vms_test.rb +1 -1
  30. data/test/landrush/resolver_config_test.rb +1 -3
  31. data/test/landrush/server_test.rb +1 -1
  32. data/test/landrush/store_test.rb +1 -1
  33. data/test/landrush/util/rety_test.rb +50 -0
  34. data/test/landrush/win_network_config_test.rb +70 -0
  35. data/test/support/fake_ui.rb +1 -0
  36. data/test/test_helper.rb +26 -11
  37. metadata +46 -12
  38. data/Gemfile.lock +0 -178
  39. data/examples/Vagrantfile +0 -20
  40. data/issues/vbox/Vagrantfile +0 -122
  41. data/lib/landrush/cap/linux/read_host_visible_ip_address.rb +0 -47
  42. data/lib/landrush/os.rb +0 -19
  43. data/test/landrush/cap/linux/read_host_visible_ip_address_test.rb +0 -37
data/Gemfile.lock DELETED
@@ -1,178 +0,0 @@
1
- GIT
2
- remote: git://github.com/mitchellh/vagrant.git
3
- revision: c1c00e2f3cf69c579a5aa6922d67bb838a2de9cd
4
- ref: v1.8.1
5
- specs:
6
- vagrant (1.8.1)
7
- bundler (>= 1.5.2, <= 1.10.6)
8
- childprocess (~> 0.5.0)
9
- erubis (~> 2.7.0)
10
- hashicorp-checkpoint (~> 0.1.1)
11
- i18n (>= 0.6.0, <= 0.8.0)
12
- listen (~> 3.0.2)
13
- log4r (~> 1.1.9, < 1.1.11)
14
- net-scp (~> 1.1.0)
15
- net-sftp (~> 2.1)
16
- net-ssh (~> 3.0.1)
17
- nokogiri (= 1.6.3.1)
18
- rb-kqueue (~> 0.2.0)
19
- rest-client (>= 1.6.0, < 2.0)
20
- wdm (~> 0.1.0)
21
- winrm (~> 1.3)
22
- winrm-fs (~> 0.2.2)
23
-
24
- PATH
25
- remote: .
26
- specs:
27
- landrush (1.0.0)
28
- rubydns (= 0.8.5)
29
-
30
- GEM
31
- remote: https://rubygems.org/
32
- specs:
33
- aruba (0.14.1)
34
- childprocess (~> 0.5.6)
35
- contracts (~> 0.9)
36
- cucumber (>= 1.3.19)
37
- ffi (~> 1.9.10)
38
- rspec-expectations (>= 2.99)
39
- thor (~> 0.19)
40
- ast (2.2.0)
41
- builder (3.2.2)
42
- byebug (8.2.1)
43
- childprocess (0.5.9)
44
- ffi (~> 1.0, >= 1.0.11)
45
- contracts (0.13.0)
46
- cucumber (2.3.3)
47
- builder (>= 2.1.2)
48
- cucumber-core (~> 1.4.0)
49
- cucumber-wire (~> 0.0.1)
50
- diff-lcs (>= 1.1.3)
51
- gherkin (~> 3.2.0)
52
- multi_json (>= 1.7.5, < 2.0)
53
- multi_test (>= 0.1.2)
54
- cucumber-core (1.4.0)
55
- gherkin (~> 3.2.0)
56
- cucumber-wire (0.0.1)
57
- diff-lcs (1.2.5)
58
- domain_name (0.5.25)
59
- unf (>= 0.0.5, < 1.0.0)
60
- erubis (2.7.0)
61
- eventmachine (1.0.8)
62
- events (0.9.8)
63
- ffi (1.9.10)
64
- ffi (1.9.10-x64-mingw32)
65
- gherkin (3.2.0)
66
- gssapi (1.2.0)
67
- ffi (>= 1.0.1)
68
- gyoku (1.3.1)
69
- builder (>= 2.1.2)
70
- hashicorp-checkpoint (0.1.4)
71
- http-cookie (1.0.2)
72
- domain_name (~> 0.5)
73
- httpclient (2.7.1)
74
- i18n (0.7.0)
75
- json (1.8.3)
76
- komenda (0.1.6)
77
- events (~> 0.9.8)
78
- listen (3.0.5)
79
- rb-fsevent (>= 0.9.3)
80
- rb-inotify (>= 0.9)
81
- little-plugger (1.1.4)
82
- log4r (1.1.10)
83
- logging (1.8.2)
84
- little-plugger (>= 1.1.3)
85
- multi_json (>= 1.8.4)
86
- metaclass (0.0.4)
87
- mime-types (2.99)
88
- mini_portile (0.6.0)
89
- minitest (5.8.4)
90
- mocha (1.1.0)
91
- metaclass (~> 0.0.1)
92
- multi_json (1.11.2)
93
- multi_test (0.1.2)
94
- net-scp (1.1.2)
95
- net-ssh (>= 2.6.5)
96
- net-sftp (2.1.2)
97
- net-ssh (>= 2.6.5)
98
- net-ssh (3.0.2)
99
- netrc (0.11.0)
100
- nokogiri (1.6.3.1)
101
- mini_portile (= 0.6.0)
102
- nokogiri (1.6.3.1-x64-mingw32)
103
- mini_portile (= 0.6.0)
104
- nori (2.6.0)
105
- parser (2.3.0.7)
106
- ast (~> 2.2)
107
- powerpack (0.1.1)
108
- rainbow (2.1.0)
109
- rake (10.4.2)
110
- rb-fsevent (0.9.7)
111
- rb-inotify (0.9.5)
112
- ffi (>= 0.5.0)
113
- rb-kqueue (0.2.4)
114
- ffi (>= 0.5.0)
115
- rest-client (1.8.0)
116
- http-cookie (>= 1.0.2, < 2.0)
117
- mime-types (>= 1.16, < 3.0)
118
- netrc (~> 0.7)
119
- rest-client (1.8.0-x64-mingw32)
120
- ffi (~> 1.9)
121
- http-cookie (>= 1.0.2, < 2.0)
122
- mime-types (>= 1.16, < 3.0)
123
- netrc (~> 0.7)
124
- rspec-expectations (3.4.0)
125
- diff-lcs (>= 1.2.0, < 2.0)
126
- rspec-support (~> 3.4.0)
127
- rspec-support (3.4.1)
128
- rubocop (0.38.0)
129
- parser (>= 2.3.0.6, < 3.0)
130
- powerpack (~> 0.1)
131
- rainbow (>= 1.99.1, < 3.0)
132
- ruby-progressbar (~> 1.7)
133
- unicode-display_width (~> 1.0, >= 1.0.1)
134
- ruby-progressbar (1.7.5)
135
- rubydns (0.8.5)
136
- eventmachine (~> 1.0.0)
137
- rubyntlm (0.4.0)
138
- rubyzip (1.1.7)
139
- thor (0.19.1)
140
- unf (0.1.4)
141
- unf_ext
142
- unf_ext (0.0.7.1)
143
- unf_ext (0.0.7.1-x64-mingw32)
144
- unicode-display_width (1.0.3)
145
- uuidtools (2.1.5)
146
- wdm (0.1.1)
147
- winrm (1.3.6)
148
- builder (>= 2.1.2)
149
- gssapi (~> 1.2)
150
- gyoku (~> 1.0)
151
- httpclient (~> 2.2, >= 2.2.0.2)
152
- logging (>= 1.6.1, < 3.0)
153
- nori (~> 2.0)
154
- rubyntlm (~> 0.4.0)
155
- uuidtools (~> 2.1.2)
156
- winrm-fs (0.2.3)
157
- erubis (~> 2.7)
158
- logging (~> 1.6, >= 1.6.1)
159
- rubyzip (~> 1.1)
160
- winrm (~> 1.3.0)
161
-
162
- PLATFORMS
163
- ruby
164
- x64-mingw32
165
-
166
- DEPENDENCIES
167
- aruba (~> 0.13)
168
- byebug
169
- cucumber (~> 2.1)
170
- json
171
- komenda (~> 0.1.6)
172
- landrush!
173
- minitest
174
- mocha
175
- rake
176
- rubocop (~> 0.38.0)
177
- rubydns (= 0.8.5)
178
- vagrant!
data/examples/Vagrantfile DELETED
@@ -1,20 +0,0 @@
1
- #
2
- # This serves as a simple example, and it's what I'm using for testing locally.
3
- #
4
- # If you're doing development and want to run this locally you can simply
5
- # `bundle install`, then prefix all your vagrant commands with `bundle exec`, like so:
6
- #
7
- # VAGRANT_CWD=examples bundle exec vagrant up
8
- # VAGRANT_CWD=examples bundle exce vagrant halt
9
- #
10
-
11
- Vagrant.configure("2") do |config|
12
- config.vm.box = "hashicorp/precise64"
13
-
14
- config.landrush.enabled = true
15
-
16
- config.vm.hostname = "myhost.vagrant.test"
17
-
18
- config.landrush.host 'static1.example.com', '1.2.3.4'
19
- config.landrush.host 'static2.example.com', '2.3.4.5'
20
- end
@@ -1,122 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
- VAGRANTFILE_API_VERSION = "2"
6
- ENV.delete 'VAGRANT_DEFAULT_PROVIDER'
7
-
8
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
9
- # All Vagrant configuration is done here. The most common configuration
10
- # options are documented and commented below. For a complete reference,
11
- # please see the online documentation at vagrantup.com.
12
-
13
- # Every Vagrant virtual environment requires a box to build off of.
14
- config.vm.box = 'precise64'
15
- config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
16
- config.vm.hostname = 'vbox.vagrant.test'
17
- config.landrush.enable
18
-
19
- # The url from where the 'config.vm.box' box will be fetched if it
20
- # doesn't already exist on the user's system.
21
- # config.vm.box_url = "http://domain.com/path/to/above.box"
22
-
23
- # Create a forwarded port mapping which allows access to a specific port
24
- # within the machine from a port on the host machine. In the example below,
25
- # accessing "localhost:8080" will access port 80 on the guest machine.
26
- # config.vm.network :forwarded_port, guest: 80, host: 8080
27
-
28
- # Create a private network, which allows host-only access to the machine
29
- # using a specific IP.
30
- # config.vm.network :private_network, ip: "192.168.33.10"
31
-
32
- # Create a public network, which generally matched to bridged network.
33
- # Bridged networks make the machine appear as another physical device on
34
- # your network.
35
- # config.vm.network :public_network
36
-
37
- # If true, then any SSH connections made will enable agent forwarding.
38
- # Default value: false
39
- # config.ssh.forward_agent = true
40
-
41
- # Share an additional folder to the guest VM. The first argument is
42
- # the path on the host to the actual folder. The second argument is
43
- # the path on the guest to mount the folder. And the optional third
44
- # argument is a set of non-required options.
45
- # config.vm.synced_folder "../data", "/vagrant_data"
46
-
47
- # Provider-specific configuration so you can fine-tune various
48
- # backing providers for Vagrant. These expose provider-specific options.
49
- # Example for VirtualBox:
50
- #
51
- # config.vm.provider :virtualbox do |vb|
52
- # # Don't boot with headless mode
53
- # vb.gui = true
54
- #
55
- # # Use VBoxManage to customize the VM. For example to change memory:
56
- # vb.customize ["modifyvm", :id, "--memory", "1024"]
57
- # end
58
- #
59
- # View the documentation for the provider you're using for more
60
- # information on available options.
61
-
62
- # Enable provisioning with Puppet stand alone. Puppet manifests
63
- # are contained in a directory path relative to this Vagrantfile.
64
- # You will need to create the manifests directory and a manifest in
65
- # the file base.pp in the manifests_path directory.
66
- #
67
- # An example Puppet manifest to provision the message of the day:
68
- #
69
- # # group { "puppet":
70
- # # ensure => "present",
71
- # # }
72
- # #
73
- # # File { owner => 0, group => 0, mode => 0644 }
74
- # #
75
- # # file { '/etc/motd':
76
- # # content => "Welcome to your Vagrant-built virtual machine!
77
- # # Managed by Puppet.\n"
78
- # # }
79
- #
80
- # config.vm.provision :puppet do |puppet|
81
- # puppet.manifests_path = "manifests"
82
- # puppet.manifest_file = "site.pp"
83
- # end
84
-
85
- # Enable provisioning with chef solo, specifying a cookbooks path, roles
86
- # path, and data_bags path (all relative to this Vagrantfile), and adding
87
- # some recipes and/or roles.
88
- #
89
- # config.vm.provision :chef_solo do |chef|
90
- # chef.cookbooks_path = "../my-recipes/cookbooks"
91
- # chef.roles_path = "../my-recipes/roles"
92
- # chef.data_bags_path = "../my-recipes/data_bags"
93
- # chef.add_recipe "mysql"
94
- # chef.add_role "web"
95
- #
96
- # # You may also specify custom JSON attributes:
97
- # chef.json = { :mysql_password => "foo" }
98
- # end
99
-
100
- # Enable provisioning with chef server, specifying the chef server URL,
101
- # and the path to the validation key (relative to this Vagrantfile).
102
- #
103
- # The Opscode Platform uses HTTPS. Substitute your organization for
104
- # ORGNAME in the URL and validation key.
105
- #
106
- # If you have your own Chef Server, use the appropriate URL, which may be
107
- # HTTP instead of HTTPS depending on your configuration. Also change the
108
- # validation key to validation.pem.
109
- #
110
- # config.vm.provision :chef_client do |chef|
111
- # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
112
- # chef.validation_key_path = "ORGNAME-validator.pem"
113
- # end
114
- #
115
- # If you're using the Opscode platform, your validator client is
116
- # ORGNAME-validator, replacing ORGNAME with your organization name.
117
- #
118
- # If you have your own Chef Server, the default validation client name is
119
- # chef-validator, unless you changed the configuration.
120
- #
121
- # chef.validation_client_name = "ORGNAME-validator"
122
- end
@@ -1,47 +0,0 @@
1
- module Landrush
2
- module Cap
3
- module Linux
4
- module ReadHostVisibleIpAddress
5
- #
6
- # !!!!!!!!!!!!
7
- # !! NOTE !!
8
- # !!!!!!!!!!!!
9
- #
10
- # This is a fragile heuristic: we are simply assuming the IP address of
11
- # the last interface non-localhost IP address is the host-visible one.
12
- #
13
- # For VMWare, the interface that Vagrant uses is host accessible, so we
14
- # expect this to be the same as `read_ip_address`.
15
- #
16
- # For VirtualBox, the Vagrant interface is not host visible, so we add
17
- # our own private_network, which we expect this to return for us.
18
- #
19
- # If the Vagrantfile sets up any sort of fancy networking, this has the
20
- # potential to fail, which will break things.
21
- #
22
- # TODO: Find a better heuristic for this implementation.
23
- #
24
- def self.read_host_visible_ip_address(machine)
25
- result = ""
26
- machine.communicate.execute(command) do |type, data|
27
- result << data if type == :stdout
28
- end
29
-
30
- last_line = result.chomp.split("\n").last || ''
31
- addresses = last_line.split(/\s+/).map { |address| IPAddr.new(address) }
32
- addresses = addresses.reject { |address| address.ipv6? }
33
-
34
- if addresses.empty?
35
- raise "Cannot detect IP address, command `#{command}` returned `#{result}`"
36
- end
37
-
38
- addresses.last.to_s
39
- end
40
-
41
- def self.command
42
- %Q(hostname -I)
43
- end
44
- end
45
- end
46
- end
47
- end
data/lib/landrush/os.rb DELETED
@@ -1,19 +0,0 @@
1
- module Landrush
2
- module OS
3
- def self.windows?
4
- (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
5
- end
6
-
7
- def self.mac?
8
- (/darwin/ =~ RUBY_PLATFORM) != nil
9
- end
10
-
11
- def self.unix?
12
- !windows?
13
- end
14
-
15
- def self.linux?
16
- unix? && !mac?
17
- end
18
- end
19
- end
@@ -1,37 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Landrush
4
- module Cap
5
- module Linux
6
- describe ReadHostVisibleIpAddress do
7
- describe 'read_host_visible_ip_address' do
8
- let(:machine) { fake_machine }
9
-
10
- it 'should read the last address' do
11
- machine.communicate.stub_command(Landrush::Cap::Linux::ReadHostVisibleIpAddress.command, "1.2.3.4 5.6.7.8\n")
12
- machine.guest.capability(:read_host_visible_ip_address).must_equal '5.6.7.8'
13
- end
14
-
15
- it 'should ignore IPv6 addresses' do
16
- machine.communicate.stub_command(Landrush::Cap::Linux::ReadHostVisibleIpAddress.command, "1.2.3.4 5.6.7.8 fdb2:2c26:f4e4:0:21c:42ff:febc:ea4f\n")
17
- machine.guest.capability(:read_host_visible_ip_address).must_equal '5.6.7.8'
18
- end
19
-
20
- it 'should fail on invalid address' do
21
- machine.communicate.stub_command(Landrush::Cap::Linux::ReadHostVisibleIpAddress.command, "hello world\n")
22
- lambda do
23
- machine.guest.capability(:read_host_visible_ip_address)
24
- end.must_raise(IPAddr::InvalidAddressError)
25
- end
26
-
27
- it 'should fail without address' do
28
- machine.communicate.stub_command(Landrush::Cap::Linux::ReadHostVisibleIpAddress.command, "\n")
29
- lambda do
30
- machine.guest.capability(:read_host_visible_ip_address)
31
- end.must_raise(RuntimeError, 'Cannot detect IP address, command `hostname -I` returned ``')
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end