vagrant-auto_network 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +26 -9
- data/CHANGELOG +14 -0
- data/Gemfile +27 -12
- data/LICENSE +176 -0
- data/README.md +102 -0
- data/lib/auto_network/action.rb +1 -0
- data/lib/auto_network/action/version_check.rb +27 -0
- data/lib/auto_network/plugin.rb +5 -0
- data/lib/auto_network/pool_manager.rb +4 -1
- data/lib/auto_network/version.rb +1 -1
- data/spec/integration/shared/auto_network_integration_context.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/tasks/acceptance.rake +7 -6
- data/templates/locales/en.yml +6 -0
- data/vagrant-auto_network.gemspec +2 -3
- data/vagrant-spec.config.example.rb +10 -3
- metadata +15 -27
- data/README.markdown +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb810013dd223986a2b6de35edbe86a52b643ec4
|
4
|
+
data.tar.gz: 7156d003f1a6b53532ac06269ca325bd24e24e03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7df2f4b521a71b9b7ecdd3100d8b3dae9867b494d31b6a237a22904b271681da6287fc5965eeca9aa805743a034891a1c5f0500e34daf4ef9d1229e8abaf29a1
|
7
|
+
data.tar.gz: 1ff116c4ca864457c3c14ef65a0f292acfb5f95236d1a4ff810dab04f21abedad53bed955838c47e422e7742b756f24234fc64a107531da112f418970796c4b0
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,17 +1,34 @@
|
|
1
1
|
---
|
2
2
|
language: ruby
|
3
|
+
sudo: false
|
3
4
|
before_install:
|
4
|
-
|
5
|
-
|
6
|
-
|
5
|
+
# TODO: Remove along with all BUNDLER_VERSION hackery once support for
|
6
|
+
# Vagrant < 1.9 is dropped.
|
7
|
+
#
|
8
|
+
# Travis has taken to installing Bundler as a "default" gem which locks
|
9
|
+
# it down and makes it extremely frustrating to use a different version.
|
10
|
+
- "find /home/travis/.rvm/rubies -wholename '*default/bundler-*.gemspec' -delete"
|
11
|
+
- gem install bundler --version $BUNDLER_VERSION
|
12
|
+
install: bundle _${BUNDLER_VERSION}_ install --without development
|
13
|
+
script: bundle _${BUNDLER_VERSION}_ exec rspec --color --format documentation
|
7
14
|
notifications:
|
8
15
|
email: false
|
9
|
-
|
10
|
-
- 2.0.0
|
16
|
+
|
11
17
|
env:
|
12
18
|
global:
|
13
19
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
-
|
20
|
+
|
21
|
+
matrix:
|
22
|
+
include:
|
23
|
+
- rvm: 2.0.0
|
24
|
+
env: TEST_VAGRANT_VERSION=v1.7.4 BUNDLER_VERSION=1.10.5
|
25
|
+
- rvm: 2.2.5
|
26
|
+
env: TEST_VAGRANT_VERSION=v1.8.7 BUNDLER_VERSION=1.12.5
|
27
|
+
- rvm: 2.3.4
|
28
|
+
env: TEST_VAGRANT_VERSION=v1.9.8 BUNDLER_VERSION=1.16.1
|
29
|
+
- rvm: 2.4.4
|
30
|
+
env: TEST_VAGRANT_VERSION=v2.0.4 BUNDLER_VERSION=1.16.1
|
31
|
+
- rvm: 2.4.4
|
32
|
+
env: TEST_VAGRANT_VERSION=v2.1.1 BUNDLER_VERSION=1.16.1
|
33
|
+
- rvm: 2.4.4
|
34
|
+
env: TEST_VAGRANT_VERSION=HEAD BUNDLER_VERSION=1.16.1
|
data/CHANGELOG
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
vagrant-auto_network
|
2
2
|
====================
|
3
3
|
|
4
|
+
1.0.3
|
5
|
+
-----
|
6
|
+
|
7
|
+
2018-06-01
|
8
|
+
|
9
|
+
This is a backwards compatible bugfix release.
|
10
|
+
|
11
|
+
* Add test coverage for Vagrant 2.0 and 2.1.
|
12
|
+
|
13
|
+
* Add thread safety and atomic writes to pool storage.
|
14
|
+
|
15
|
+
* Deprecated support for Vagrant versions older than 1.8.
|
16
|
+
|
17
|
+
|
4
18
|
1.0.2
|
5
19
|
-----
|
6
20
|
|
data/Gemfile
CHANGED
@@ -1,25 +1,40 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
|
2
|
+
require 'rubygems/version'
|
3
3
|
|
4
|
-
ENV['TEST_VAGRANT_VERSION']
|
4
|
+
vagrant_branch = ENV['TEST_VAGRANT_VERSION'] || 'v2.1.1'
|
5
|
+
vagrant_version = nil
|
5
6
|
|
6
|
-
#
|
7
|
-
# during acceptance tests.
|
7
|
+
# Wrapping gemspec in the :plugins group causes Vagrant 1.5 and newer to
|
8
|
+
# automagically load this plugin during acceptance tests.
|
8
9
|
group :plugins do
|
9
10
|
gemspec
|
10
11
|
end
|
11
12
|
|
13
|
+
group :development do
|
14
|
+
gem 'yard', '~> 0.9.11'
|
15
|
+
gem 'redcarpet'
|
16
|
+
end
|
17
|
+
|
12
18
|
group :test do
|
13
|
-
|
14
|
-
|
19
|
+
case vagrant_branch
|
20
|
+
when /head/i
|
21
|
+
gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git',
|
22
|
+
:branch => 'master'
|
15
23
|
else
|
16
|
-
|
24
|
+
vagrant_version = Gem::Version.new(vagrant_branch.sub(/^v/, ''))
|
25
|
+
gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git',
|
26
|
+
:tag => vagrant_branch
|
17
27
|
end
|
18
28
|
|
19
|
-
|
20
|
-
|
29
|
+
if vagrant_branch.match(/head/i) || (vagrant_version >= Gem::Version.new('1.9'))
|
30
|
+
# Pinned on 5/11/2018. Compatible with Vagrant > 1.9. Brings in Rspec 3.
|
31
|
+
gem 'vagrant-spec', :git => 'https://github.com/hashicorp/vagrant-spec.git',
|
32
|
+
:ref => '9413ab2'
|
33
|
+
elsif vagrant_version
|
34
|
+
# Pinned on 12/10/2014. Compatible with Vagrant 1.6.x -- 1.8.7.
|
35
|
+
gem 'vagrant-spec', :git => 'https://github.com/hashicorp/vagrant-spec.git',
|
36
|
+
:ref => '1df5a3a'
|
37
|
+
end
|
21
38
|
end
|
22
39
|
|
23
|
-
if File.exists? "#{__FILE__}.local"
|
24
|
-
eval(File.read("#{__FILE__}.local"), binding)
|
25
|
-
end
|
40
|
+
eval_gemfile "#{__FILE__}.local" if File.exists? "#{__FILE__}.local"
|
data/LICENSE
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
data/README.md
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
Vagrant Auto-network
|
2
|
+
====================
|
3
|
+
|
4
|
+
Automatically configure Vagrant private network interfaces.
|
5
|
+
|
6
|
+
[![Build Status](https://travis-ci.org/oscar-stack/vagrant-auto_network.svg?branch=master)](https://travis-ci.org/oscar-stack/vagrant-auto_network)
|
7
|
+
|
8
|
+
Summary
|
9
|
+
-------
|
10
|
+
|
11
|
+
Adding a private network address for vagrant machines generally requires
|
12
|
+
manually entering network interfaces and IP addresses for each machine, and
|
13
|
+
adding or removing machines means updating private network interfaces to make
|
14
|
+
sure that new machines don't collide. Alternately one can run a full blown DHCP
|
15
|
+
server but this is not necessarily portable and requires significant preparation
|
16
|
+
on top of Vagrant.
|
17
|
+
|
18
|
+
This plugin registers an internal address range and assigns unique IP addresses
|
19
|
+
for each successive request so that network configuration is entirely hands off.
|
20
|
+
It's much lighter than running a DNS server and masks the underlying work of
|
21
|
+
manually assigning addresses.
|
22
|
+
|
23
|
+
|
24
|
+
Installation
|
25
|
+
------------
|
26
|
+
|
27
|
+
```bash
|
28
|
+
vagrant plugin install vagrant-auto_network
|
29
|
+
```
|
30
|
+
|
31
|
+
Usage
|
32
|
+
-----
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
Vagrant.configure('2') do |config|
|
36
|
+
config.vm.define 'first' do |node|
|
37
|
+
node.vm.box = 'centos/7'
|
38
|
+
|
39
|
+
node.vm.network :private_network, :auto_network => true
|
40
|
+
end
|
41
|
+
|
42
|
+
config.vm.define 'second' do |node|
|
43
|
+
node.vm.box = 'centos/7'
|
44
|
+
|
45
|
+
node.vm.network :private_network, :auto_network => true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
|
51
|
+
Troubleshooting
|
52
|
+
---------------
|
53
|
+
|
54
|
+
On occasion, the state file AutoNetwork uses to store allocated IP addresses
|
55
|
+
can become corrupted resulting in errors similar to:
|
56
|
+
|
57
|
+
```
|
58
|
+
/opt/vagrant/embedded/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 288 column 7 (Psych::SyntaxError)
|
59
|
+
from /opt/vagrant/embedded/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
|
60
|
+
from /opt/vagrant/embedded/lib/ruby/2.0.0/psych.rb:153:in `parse'
|
61
|
+
from /opt/vagrant/embedded/lib/ruby/2.0.0/psych.rb:129:in `load'
|
62
|
+
from /opt/vagrant/embedded/lib/ruby/2.0.0/yaml/store.rb:61:in `load'
|
63
|
+
from ~/.vagrant.d/gems/gems/vagrant-auto_network-1.0.2/lib/auto_network/pool_storage.rb:73:in `load'
|
64
|
+
```
|
65
|
+
|
66
|
+
This can be fixed by clearing the state file:
|
67
|
+
|
68
|
+
rm ~/.vagrant.d/auto_network/pool.yaml
|
69
|
+
|
70
|
+
The `vagrant reload` command should be run on any VMs using AutoNetwork IPs
|
71
|
+
in order to re-issue new IP addresses.
|
72
|
+
|
73
|
+
|
74
|
+
Caveats
|
75
|
+
-------
|
76
|
+
|
77
|
+
The default pool range has been hardcoded as '10.20.1.2/24' and is assigned
|
78
|
+
to the first VM provider, usually VirtualBox. New pools are created for other
|
79
|
+
providers by incrementing the second octet to create a new '/24'.
|
80
|
+
To change the starting range, add the following to a Vagrantfile _before_ the
|
81
|
+
Vagrant configuration block:
|
82
|
+
|
83
|
+
AutoNetwork.default_pool = '172.16.0.0/24'
|
84
|
+
|
85
|
+
A '/24' should always be used as the default pool in order for multiple
|
86
|
+
providers to be supported correctly. If VMs that use `auto_network` assigned IP
|
87
|
+
addresses have already been created, then the AutoNetwork pool file will have
|
88
|
+
to be cleared:
|
89
|
+
|
90
|
+
~/.vagrant.d/auto_network/pool.yaml
|
91
|
+
|
92
|
+
Running `vagrant reload` on existing VMs will assign new IP addresses from the
|
93
|
+
newly configured IP range.
|
94
|
+
|
95
|
+
The AutoNetwork pool is currently shared across all Vagrant environments which
|
96
|
+
means it is not possible to configure a separate range per-Vagrantfile.
|
97
|
+
|
98
|
+
|
99
|
+
Contributing
|
100
|
+
------------
|
101
|
+
|
102
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/oscar-stack/vagrant-auto_network.
|
data/lib/auto_network/action.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'vagrant/version'
|
2
|
+
require 'rubygems/version'
|
3
|
+
|
4
|
+
# Check for deprecated Vagrant versions
|
5
|
+
module AutoNetwork
|
6
|
+
module Action
|
7
|
+
class VersionCheck
|
8
|
+
MINIMUM_VERSION = '1.8.0'
|
9
|
+
|
10
|
+
def initialize(app, env)
|
11
|
+
@app = app
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
unless Gem::Version.new(Vagrant::VERSION) > Gem::Version.new(MINIMUM_VERSION)
|
16
|
+
env[:env].ui.warn I18n.t(
|
17
|
+
'vagrant_auto_network.action.version_check.deprecated_vagrant_version',
|
18
|
+
minimum_version: MINIMUM_VERSION,
|
19
|
+
vagrant_version: Vagrant::VERSION
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
@app.call(env)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/auto_network/plugin.rb
CHANGED
@@ -32,5 +32,10 @@ module AutoNetwork
|
|
32
32
|
|
33
33
|
hook.append(AutoNetwork::Action::Release)
|
34
34
|
end
|
35
|
+
|
36
|
+
# Internal action hooks
|
37
|
+
action_hook('Vagrant AutoNetwork: vagrant version check', :environment_load) do |hook|
|
38
|
+
hook.prepend(::AutoNetwork::Action::VersionCheck)
|
39
|
+
end
|
35
40
|
end
|
36
41
|
end
|
@@ -26,7 +26,10 @@ module AutoNetwork
|
|
26
26
|
def initialize(path)
|
27
27
|
# Ensure newly created files start with a skeleton data structure.
|
28
28
|
AutoNetwork::PoolStorage.init(path) unless File.file?(path)
|
29
|
-
|
29
|
+
# Enable thread safety an atomic file updates on the underlying
|
30
|
+
# YAML::Store instance.
|
31
|
+
@pool_storage = AutoNetwork::PoolStorage.new(path, true)
|
32
|
+
@pool_storage.ultra_safe = true
|
30
33
|
end
|
31
34
|
|
32
35
|
# Looks up the pool associated with the provider for a given machine and
|
data/lib/auto_network/version.rb
CHANGED
@@ -30,7 +30,7 @@ shared_context 'auto_network integration' do
|
|
30
30
|
allow(AutoNetwork).to receive(:pool_manager=) do |pool_manager|
|
31
31
|
settings.pool_manager = pool_manager
|
32
32
|
end
|
33
|
-
allow(AutoNetwork).to receive(:pool_manager)
|
33
|
+
allow(AutoNetwork).to receive(:pool_manager) { settings.pool_manager }
|
34
34
|
end
|
35
35
|
|
36
36
|
# Configure each testing environment to include an AutoNetwork pool file and
|
data/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,7 @@ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
|
3
3
|
# Disable Vagrant autoloading so that other plugins defined in the Gemfile for
|
4
4
|
# Acceptance tests are not loaded.
|
5
5
|
ENV['VAGRANT_NO_PLUGINS'] = '1'
|
6
|
+
ENV['VAGRANT_DISABLE_PLUGIN_INIT'] = '1'
|
6
7
|
|
7
8
|
require 'vagrant-spec/unit'
|
8
9
|
require 'auto_network'
|
data/tasks/acceptance.rake
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
namespace :acceptance do
|
2
2
|
ARTIFACT_DIR = File.join('acceptance', 'artifacts')
|
3
|
-
TEST_BOXES =
|
4
|
-
https://
|
5
|
-
|
3
|
+
TEST_BOXES = {
|
4
|
+
'centos-virtualbox.box' => 'https://s3.amazonaws.com/puppetlabs-vagrantcloud/centos-7.2-x86_64-virtualbox-nocm-1.0.1.box',
|
5
|
+
}
|
6
6
|
|
7
7
|
directory ARTIFACT_DIR
|
8
|
-
TEST_BOXES.each do |box_url|
|
9
|
-
file File.join(ARTIFACT_DIR,
|
8
|
+
TEST_BOXES.each do |box, box_url|
|
9
|
+
file File.join(ARTIFACT_DIR, box) => ARTIFACT_DIR do |path|
|
10
10
|
puts 'Downloading: ' + box_url
|
11
11
|
Kernel.system 'curl', '-L', '-o', path.to_s, box_url
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'downloads test boxes and other artifacts'
|
16
|
-
task :setup => TEST_BOXES.map {|
|
16
|
+
task :setup => TEST_BOXES.map {|box, _| File.join(ARTIFACT_DIR, box)}
|
17
|
+
|
17
18
|
|
18
19
|
desc 'runs acceptance tests'
|
19
20
|
task :run => :setup do
|
data/templates/locales/en.yml
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
---
|
2
2
|
en:
|
3
3
|
vagrant_auto_network:
|
4
|
+
action:
|
5
|
+
version_check:
|
6
|
+
deprecated_vagrant_version: |-
|
7
|
+
The vagrant-auto_network plugin has deprecated support for Vagrant
|
8
|
+
versions older than %{minimum_version}. Support for version %{vagrant_version}
|
9
|
+
will be removed in the next major release of the plugin.
|
4
10
|
pool_exhausted: |-
|
5
11
|
The machine '%{name}' tried to get an automatic network address, but all
|
6
12
|
ip addresses in the network range '%{network}' have been used. This is
|
@@ -9,15 +9,14 @@ Gem::Specification.new do |gem|
|
|
9
9
|
|
10
10
|
gem.authors = ['Adrien Thebo', 'Charlie Sharpsteen']
|
11
11
|
gem.email = ['adrien@somethingsinistral.net', 'source@sharpsteen.net']
|
12
|
-
gem.homepage = 'https://github.com/
|
12
|
+
gem.homepage = 'https://github.com/oscar-stack/vagrant-auto_network'
|
13
13
|
|
14
14
|
gem.summary = "Automatically create an internal network for all vagrant boxes"
|
15
15
|
|
16
16
|
gem.files = %x{git ls-files -z}.split("\0")
|
17
17
|
gem.require_path = 'lib'
|
18
18
|
|
19
|
-
gem.license = 'Apache
|
19
|
+
gem.license = 'Apache-2.0'
|
20
20
|
|
21
21
|
gem.add_development_dependency 'rake'
|
22
|
-
gem.add_development_dependency 'rspec', '~> 2.14.0'
|
23
22
|
end
|
@@ -1,21 +1,28 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
2
|
+
|
3
|
+
# Prevent tests from attempting to load plugins from a Vagrant install
|
4
|
+
# that may exist on the host system. We load required plugins below.
|
5
|
+
ENV['VAGRANT_DISABLE_PLUGIN_INIT'] = '1'
|
6
|
+
|
1
7
|
require 'pathname'
|
2
8
|
require 'vagrant-spec/acceptance'
|
9
|
+
require 'vagrant-auto_network'
|
3
10
|
|
4
11
|
Vagrant::Spec::Acceptance.configure do |c|
|
5
|
-
acceptance_dir = Pathname.new File.expand_path('
|
12
|
+
acceptance_dir = Pathname.new File.expand_path('acceptance', __dir__)
|
6
13
|
|
7
14
|
c.component_paths = [acceptance_dir.to_s]
|
8
15
|
c.skeleton_paths = [(acceptance_dir + 'skeletons').to_s]
|
9
16
|
|
10
17
|
c.provider 'virtualbox',
|
11
|
-
box: (acceptance_dir + 'artifacts' + 'virtualbox.box').to_s,
|
18
|
+
box: (acceptance_dir + 'artifacts' + 'centos-virtualbox.box').to_s,
|
12
19
|
env_vars: {
|
13
20
|
'VBOX_USER_HOME' => '{{homedir}}',
|
14
21
|
'AUTO_NETWORK_TEST_RANGE' => '10.42.1.0/24',
|
15
22
|
}
|
16
23
|
|
17
24
|
# VMware Fusion disabled by default. Instructions:
|
18
|
-
# https://github.com/
|
25
|
+
# https://github.com/oscar-stack/vagrant-auto_network/wiki#vmware-fusion
|
19
26
|
|
20
27
|
#c.provider 'vmware_fusion',
|
21
28
|
# box: (acceptance_dir + 'artifacts' + 'vmware_fusion.box').to_s,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-auto_network
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Thebo
|
@@ -9,36 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-06-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rspec
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 2.14.0
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 2.14.0
|
42
28
|
description:
|
43
29
|
email:
|
44
30
|
- adrien@somethingsinistral.net
|
@@ -47,12 +33,13 @@ executables: []
|
|
47
33
|
extensions: []
|
48
34
|
extra_rdoc_files: []
|
49
35
|
files:
|
50
|
-
- .gitignore
|
51
|
-
- .travis.yml
|
52
|
-
- .yardopts
|
36
|
+
- ".gitignore"
|
37
|
+
- ".travis.yml"
|
38
|
+
- ".yardopts"
|
53
39
|
- CHANGELOG
|
54
40
|
- Gemfile
|
55
|
-
-
|
41
|
+
- LICENSE
|
42
|
+
- README.md
|
56
43
|
- Rakefile
|
57
44
|
- acceptance/auto_network/auto_network_spec.rb
|
58
45
|
- acceptance/skeletons/auto_network/Vagrantfile
|
@@ -63,6 +50,7 @@ files:
|
|
63
50
|
- lib/auto_network/action/load_pool.rb
|
64
51
|
- lib/auto_network/action/release.rb
|
65
52
|
- lib/auto_network/action/request.rb
|
53
|
+
- lib/auto_network/action/version_check.rb
|
66
54
|
- lib/auto_network/plugin.rb
|
67
55
|
- lib/auto_network/pool.rb
|
68
56
|
- lib/auto_network/pool_manager.rb
|
@@ -82,9 +70,9 @@ files:
|
|
82
70
|
- templates/locales/en.yml
|
83
71
|
- vagrant-auto_network.gemspec
|
84
72
|
- vagrant-spec.config.example.rb
|
85
|
-
homepage: https://github.com/
|
73
|
+
homepage: https://github.com/oscar-stack/vagrant-auto_network
|
86
74
|
licenses:
|
87
|
-
- Apache
|
75
|
+
- Apache-2.0
|
88
76
|
metadata: {}
|
89
77
|
post_install_message:
|
90
78
|
rdoc_options: []
|
@@ -92,17 +80,17 @@ require_paths:
|
|
92
80
|
- lib
|
93
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
82
|
requirements:
|
95
|
-
- -
|
83
|
+
- - ">="
|
96
84
|
- !ruby/object:Gem::Version
|
97
85
|
version: '0'
|
98
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
87
|
requirements:
|
100
|
-
- -
|
88
|
+
- - ">="
|
101
89
|
- !ruby/object:Gem::Version
|
102
90
|
version: '0'
|
103
91
|
requirements: []
|
104
92
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.6.14.1
|
106
94
|
signing_key:
|
107
95
|
specification_version: 4
|
108
96
|
summary: Automatically create an internal network for all vagrant boxes
|
data/README.markdown
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
Vagrant Auto-network
|
2
|
-
====================
|
3
|
-
|
4
|
-
Automatically configure Vagrant private network interfaces.
|
5
|
-
|
6
|
-
[![Build Status](https://travis-ci.org/adrienthebo/vagrant-auto_network.svg?branch=travis-ci)](https://travis-ci.org/adrienthebo/vagrant-auto_network)
|
7
|
-
|
8
|
-
Summary
|
9
|
-
-------
|
10
|
-
|
11
|
-
Adding a private network address for vagrant machines generally requires
|
12
|
-
manually entering network interfaces and IP addresses for each machine, and
|
13
|
-
adding or removing machines means updating private network interfaces to make
|
14
|
-
sure that new machines don't collide. Alternately one can run a full blown DHCP
|
15
|
-
server but this is not necessarily portable and requires significant preparation
|
16
|
-
on top of Vagrant.
|
17
|
-
|
18
|
-
This plugin registers an internal address range and assigns unique IP addresses
|
19
|
-
for each successive request so that network configuration is entirely hands off.
|
20
|
-
It's much lighter than running a DNS server and masks the underlying work of
|
21
|
-
manually assigning addresses.
|
22
|
-
|
23
|
-
Usage
|
24
|
-
-----
|
25
|
-
|
26
|
-
Vagrant.configure('2') do |config|
|
27
|
-
config.vm.define 'first' do |node|
|
28
|
-
node.vm.box = "centos-5-i386"
|
29
|
-
|
30
|
-
node.vm.network :private_network, :auto_network => true
|
31
|
-
end
|
32
|
-
|
33
|
-
config.vm.define 'second' do |node|
|
34
|
-
node.vm.box = "centos-5-i386"
|
35
|
-
|
36
|
-
node.vm.network :private_network, :auto_network => true
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
Installation
|
41
|
-
------------
|
42
|
-
|
43
|
-
vagrant plugin install vagrant-auto_network
|
44
|
-
|
45
|
-
Caveats
|
46
|
-
-------
|
47
|
-
|
48
|
-
The default pool range has been hardcoded as '10.20.1.2/24', pending the
|
49
|
-
ability to query the host virtual network adapters for their configuration.
|
50
|
-
To change this, add the following _before_ the Vagrant configuration block:
|
51
|
-
|
52
|
-
AutoNetwork.default_pool = '172.16.0.0/24'
|
53
|
-
|
54
|
-
Contact
|
55
|
-
-------
|
56
|
-
|
57
|
-
* [Source code](https://github.com/adrienthebo/vagrant-auto_network)
|
58
|
-
* [Issue tracker](https://github.com/adrienthebo/vagrant-auto_network/issues)
|
59
|
-
|
60
|
-
If you have questions or concerns about this module, contact finch on Freenode,
|
61
|
-
or email adrien@puppetlabs.com.
|