vagrant-auto_network 1.0.0.rc1 → 1.0.0
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/CHANGELOG +1 -1
- data/lib/auto_network/action/base.rb +2 -0
- data/lib/auto_network/pool.rb +2 -0
- data/lib/auto_network/pool_manager.rb +11 -6
- data/lib/auto_network/pool_storage.rb +39 -7
- data/lib/auto_network/settings.rb +2 -0
- data/lib/auto_network/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72d0e15630b3b3850d0409ca564ea4c47734696e
|
4
|
+
data.tar.gz: d34b1e0afaf9fc015585eb9249ff8f9f66c2c288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec5a9d7f8ba9dfb6e2fbb7516295e0fee80d603e7c18506d17d26241c4a5ac41876d446a71b92a108344226b93a4527eb6f1d89a0cdc1e7ea6b7aaf542d6cc39
|
7
|
+
data.tar.gz: e1d119a3a2e652e4c11821a88b24fca41958e3b733bf4126bd6360912339abe05eeef19c2c7ae55a0c589d4d61ad0e94d466aa2464232b801a1a59259b393339
|
data/CHANGELOG
CHANGED
data/lib/auto_network/pool.rb
CHANGED
@@ -83,6 +83,8 @@ module AutoNetwork
|
|
83
83
|
# @return [Hash{String=>String}] A hash containing the path to the
|
84
84
|
# directory containing the Vagrantfile that defined the machine and the
|
85
85
|
# machine name.
|
86
|
+
#
|
87
|
+
# @since 1.0.0
|
86
88
|
def id_for(machine)
|
87
89
|
{
|
88
90
|
'path' => machine.env.root_path.to_s,
|
@@ -16,6 +16,8 @@ module AutoNetwork
|
|
16
16
|
# @see AutoNetwork::PoolStorage The object used to implement file-based
|
17
17
|
# persistance for this class.
|
18
18
|
# @see AutoNetwork::Pool The objects managed by this class.
|
19
|
+
#
|
20
|
+
# @since 1.0.0
|
19
21
|
class PoolManager
|
20
22
|
# Create a new `PoolManager` instance with persistent storage.
|
21
23
|
#
|
@@ -44,27 +46,30 @@ module AutoNetwork
|
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
|
-
#
|
49
|
+
# (see AutoNetwork::Pool#request)
|
48
50
|
#
|
49
|
-
# @see AutoNetwork::Pool#request
|
51
|
+
# @see AutoNetwork::Pool#request This method is a proxy for
|
52
|
+
# AutoNetwork::Pool#request
|
50
53
|
def request(machine)
|
51
54
|
with_pool_for(machine) do |pool|
|
52
55
|
pool.request(machine)
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
56
|
-
#
|
59
|
+
# (see AutoNetwork::Pool#release)
|
57
60
|
#
|
58
|
-
# @see AutoNetwork::Pool#release
|
61
|
+
# @see AutoNetwork::Pool#release This method is a proxy for
|
62
|
+
# AutoNetwork::Pool#release
|
59
63
|
def release(machine)
|
60
64
|
with_pool_for(machine) do |pool|
|
61
65
|
pool.release(machine)
|
62
66
|
end
|
63
67
|
end
|
64
68
|
|
65
|
-
#
|
69
|
+
# (see AutoNetwork::Pool#address_for)
|
66
70
|
#
|
67
|
-
# @see AutoNetwork::Pool#address_for
|
71
|
+
# @see AutoNetwork::Pool#address_for This method is a proxy for
|
72
|
+
# AutoNetwork::Pool#address_for
|
68
73
|
def address_for(machine)
|
69
74
|
with_pool_for(machine, read_only=true) do |pool|
|
70
75
|
pool.address_for(machine)
|
@@ -3,12 +3,41 @@ require 'yaml/store'
|
|
3
3
|
require 'auto_network/pool'
|
4
4
|
|
5
5
|
module AutoNetwork
|
6
|
-
# This is a specialized subclass of `YAML::Store` that
|
7
|
-
#
|
6
|
+
# This is a specialized subclass of `YAML::Store` that manages data
|
7
|
+
# persistence for {AutoNetwork::PoolManager} instances.
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# In addition to managing serialization, the `YAML::Store` parent class also
|
10
|
+
# provides facilities for synchronizing state across multiple Vagrant
|
11
|
+
# processes. This subclass adds functionality for handling upgrades when the
|
12
|
+
# AutoNetwork serialization format changes.
|
13
|
+
#
|
14
|
+
# Format history:
|
15
|
+
#
|
16
|
+
# - **Version 1:** A single instance of {AutoNetwork::Pool} instance
|
17
|
+
# serialized to YAML. Never formalized with a version number.
|
18
|
+
#
|
19
|
+
# - **Version 2:** A hash containing a `poolfile_version` set to `2` and a
|
20
|
+
# `pools` sub-hash with keys created from Vagrant provider names and
|
21
|
+
# values of a single {AutoNetwork::Pool} instance serialized to YAML.
|
22
|
+
#
|
23
|
+
# @example Version 1
|
24
|
+
# --- !ruby/object:AutoNetwork::Pool
|
25
|
+
# # Single serialized AutoNetwork::Pool
|
26
|
+
#
|
27
|
+
# @example Version 2
|
28
|
+
# ---
|
29
|
+
# poolfile_version: 2
|
30
|
+
# pools:
|
31
|
+
# some_vagrant_provider_name: !ruby/object:AutoNetwork::Pool
|
32
|
+
# # Single serialized AutoNetwork::Pool
|
33
|
+
#
|
34
|
+
# @since 1.0.0
|
10
35
|
class PoolStorage < YAML::Store
|
36
|
+
# An integer indicating the current AutoNetwork serialization format.
|
11
37
|
POOLFILE_VERSION = 2
|
38
|
+
|
39
|
+
# The data structure that {AutoNetwork::PoolManager} instances
|
40
|
+
# expect to be available in all pool files.
|
12
41
|
POOLFILE_SKELETON = {
|
13
42
|
'poolfile_version' => POOLFILE_VERSION,
|
14
43
|
'pools' => {},
|
@@ -17,6 +46,8 @@ module AutoNetwork
|
|
17
46
|
# Creates a new pool file at a target location and fills it with default
|
18
47
|
# data.
|
19
48
|
#
|
49
|
+
# @see POOLFILE_SKELETON
|
50
|
+
#
|
20
51
|
# @param path [String, Pathname] the location of the new pool file.
|
21
52
|
# @return [void]
|
22
53
|
def self.init(path)
|
@@ -29,8 +60,8 @@ module AutoNetwork
|
|
29
60
|
|
30
61
|
private
|
31
62
|
|
32
|
-
# Override the method inherited from `YAML::Store`. All `PStore`
|
33
|
-
# expect load to strictly return a `Hash`. This override allows us to
|
63
|
+
# Override the method inherited from `YAML::Store`. All `PStore` instances
|
64
|
+
# expect `load` to strictly return a `Hash`. This override allows us to
|
34
65
|
# perform on-the-fly upgrading of data loaded from old pool files and
|
35
66
|
# ensure the right structure is returned.
|
36
67
|
#
|
@@ -51,12 +82,13 @@ module AutoNetwork
|
|
51
82
|
# The loosely defined "version 1" of the pool file just serialized a single
|
52
83
|
# {AutoNetwork::Pool} object. All AutoNetwork releases that used Version 1
|
53
84
|
# files only supported the Vagrant VirtualBox provider, so we return a new
|
54
|
-
# Hash-based data structure that
|
85
|
+
# Hash-based data structure that assigns the old Pool to the `virtualbox`
|
86
|
+
# provider.
|
55
87
|
#
|
56
88
|
# @api private
|
57
89
|
#
|
58
90
|
# @param data [AutoNetwork::Pool] the old pool object.
|
59
|
-
# @return [Hash] a hash
|
91
|
+
# @return [Hash] a hash conforming to the current {POOLFILE_VERSION}.
|
60
92
|
def upgrade_from_version_1!(data)
|
61
93
|
{
|
62
94
|
'poolfile_version' => POOLFILE_VERSION,
|
@@ -5,6 +5,8 @@ require 'vagrant/errors'
|
|
5
5
|
module AutoNetwork
|
6
6
|
# This module is used by AutoNetwork to store global state when running under
|
7
7
|
# Vagrant. This module is mixed into the top-level AutoNetwork namespace.
|
8
|
+
#
|
9
|
+
# @since 1.0.0
|
8
10
|
module Settings
|
9
11
|
|
10
12
|
# An error class raised when an invalid value is assigned to a setting.
|
data/lib/auto_network/version.rb
CHANGED
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.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Thebo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -97,9 +97,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - '
|
100
|
+
- - '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
105
|
rubygems_version: 2.0.14
|