vagrant-persistent-storage 0.0.2 → 0.0.3
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 +7 -0
- data/README.md +20 -51
- data/Rakefile +4 -0
- data/lib/vagrant-persistent-storage/action/attach_storage.rb +36 -0
- data/lib/vagrant-persistent-storage/action/create_adapter.rb +39 -0
- data/lib/vagrant-persistent-storage/action/create_storage.rb +50 -0
- data/lib/vagrant-persistent-storage/action/detach_storage.rb +34 -0
- data/lib/vagrant-persistent-storage/action/manage_storage.rb +44 -0
- data/lib/vagrant-persistent-storage/action.rb +53 -0
- data/lib/vagrant-persistent-storage/config.rb +144 -5
- data/lib/vagrant-persistent-storage/manage_storage.rb +98 -0
- data/lib/vagrant-persistent-storage/plugin.rb +62 -0
- data/lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb +38 -0
- data/lib/vagrant-persistent-storage/providers/virtualbox/driver/meta.rb +16 -0
- data/lib/vagrant-persistent-storage/version.rb +4 -2
- data/lib/vagrant-persistent-storage.rb +10 -9
- data/locales/en.yml +12 -0
- data/vagrant-persistent-storage.gemspec +1 -3
- metadata +25 -56
- data/lib/vagrant-persistent-storage/middleware/attachpersistentstorage.rb +0 -26
- data/lib/vagrant-persistent-storage/middleware/detachpersistentstorage.rb +0 -29
- data/lib/vagrant-persistent-storage/middleware.rb +0 -3
- data/lib/vagrant_init.rb +0 -4
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
data.tar.gz: 5610de0834a33052cd9cfaaab79837b01261e7f2
|
4
|
+
metadata.gz: ce4f88ee39f8753b7d3e06bbcffb961d9a8e630b
|
5
|
+
SHA512:
|
6
|
+
data.tar.gz: 465b23d43aebeb08ea1db75b56ad48dfd0c53a7f9b33f19e1442a51fbf94e44163ee6999c5375863f24209369862e3f34685c3b5623df83b0a0a5283a770fab0
|
7
|
+
metadata.gz: 277497dfe4b13ffdab71adade10e74872e66557d204a8e874d6df26d164c270121be216abb3bbfecfa113f3906d1d1215c30db54f1ec7d72c7feaefe03e6577e
|
data/README.md
CHANGED
@@ -5,68 +5,37 @@ A Vagrant plugin that creates a persistent storage and attaches it to guest mach
|
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
And then execute:
|
11
|
-
|
12
|
-
$ bundle
|
13
|
-
|
14
|
-
Or install it yourself as:
|
15
|
-
|
16
|
-
$ gem install vagrant-persistent-storage
|
8
|
+
$ vagrant plugin install vagrant-persistent-storage
|
17
9
|
|
18
10
|
## Usage
|
19
11
|
|
20
12
|
After installing you can set the location and size of the persistent storage.
|
21
13
|
|
22
|
-
The following options will create a persistent storage with 5000 MB
|
14
|
+
The following options will create a persistent storage with 5000 MB, named mysql,
|
15
|
+
mounted on /var/lib/mysql, in a volume group called 'vagrant'
|
23
16
|
```ruby
|
17
|
+
config.persistent_storage.enabled = true
|
24
18
|
config.persistent_storage.location = "~/development/sourcehdd.vdi"
|
25
19
|
config.persistent_storage.size = 5000
|
20
|
+
config.persistent_storage.mountname = 'mysql'
|
21
|
+
config.persistent_storage.filesystem = 'ext4'
|
22
|
+
config.persistent_storage.mountpoint = '/var/lib/mysql'
|
23
|
+
config.persistent_storage.volgroupname = 'myvolgroup'
|
26
24
|
```
|
27
25
|
|
26
|
+
Device defaults to /dev/sdb
|
27
|
+
|
28
28
|
Every `vagrant up` will attach this file as hard disk to the guest machine.
|
29
|
-
An `vagrant
|
30
|
-
A `vagrant
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
command => "/sbin/fdisk /dev/sdb << EOF
|
40
|
-
o
|
41
|
-
n
|
42
|
-
p
|
43
|
-
1
|
44
|
-
|
45
|
-
|
46
|
-
w
|
47
|
-
EOF",
|
48
|
-
unless => "/bin/grep sdb1 /proc/partitions",
|
49
|
-
}
|
50
|
-
|
51
|
-
exec { "mkfs-sourcehd":
|
52
|
-
command => "/sbin/mkfs.ext3 -L sources -b 4096 /dev/sdb1",
|
53
|
-
unless => "/sbin/dumpe2fs /dev/sdb1"
|
54
|
-
}
|
55
|
-
|
56
|
-
exec { 'fstab-sourcehd':
|
57
|
-
command => '/bin/echo "/dev/disk/by-label/sources /mnt/sources ext3 defaults 0 2" >> /etc/fstab',
|
58
|
-
unless => '/bin/grep ^/dev/disk/by-label/sources /etc/fstab',
|
59
|
-
}
|
60
|
-
|
61
|
-
exec { 'mount-sourcehd':
|
62
|
-
command => '/bin/mkdir -p /mnt/sources; /bin/mount /mnt/sources',
|
63
|
-
subscribe => Exec['fstab-sourcehd'],
|
64
|
-
refreshonly => true,
|
65
|
-
}
|
66
|
-
|
67
|
-
Exec['fdisk-sourcehd'] -> Exec['mkfs-sourcehd'] -> Exec['fstab-sourcehd'] -> Exec['mount-sourcehd']
|
68
|
-
}
|
69
|
-
```
|
29
|
+
An `vagrant destroy` will detach the storage to avoid deletion of the storage by vagrant.
|
30
|
+
A `vagrant destroy` generally destroys all attached drives. See [VBoxMange unregistervm --delete option][vboxmanage_delete].
|
31
|
+
|
32
|
+
The disk is initialized and added to it's own volume group as specfied in the config;
|
33
|
+
this defaults to 'vagrant'. An ext4 filesystem is created and the disk mounted appropriately,
|
34
|
+
with entries added to fstab ... subsequent runs will mount this disk with the options specified
|
35
|
+
|
36
|
+
## Contributors
|
37
|
+
|
38
|
+
* [madAndroid](https://github.com/madAndroid)
|
70
39
|
|
71
40
|
## TODO
|
72
41
|
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module PersistentStorage
|
5
|
+
module Action
|
6
|
+
class AttachStorage
|
7
|
+
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
@machine = env[:machine]
|
11
|
+
@global_env = @machine.env
|
12
|
+
@provider = env[:provider]
|
13
|
+
@logger = Log4r::Logger.new('vagrant::persistentstorage::action::attachstorage')
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(env)
|
17
|
+
# skip if machine is not running and the action is destroy, halt or suspend
|
18
|
+
return @app.call(env) if @machine.state.id != :running && [:destroy, :halt, :suspend].include?(env[:machine_action])
|
19
|
+
# skip if machine is saved
|
20
|
+
return @app.call(env) if @machine.state.id == :saved
|
21
|
+
|
22
|
+
return @app.call(env) unless env[:machine].config.persistent_storage.enabled?
|
23
|
+
@logger.info '** Attaching Persistent Storage **'
|
24
|
+
|
25
|
+
env[:ui].info I18n.t("vagrant_persistent_storage.action.attach_storage")
|
26
|
+
location = env[:machine].config.persistent_storage.location
|
27
|
+
env[:machine].provider.driver.attach_storage(location)
|
28
|
+
|
29
|
+
@app.call(env)
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module PersistentStorage
|
5
|
+
module Action
|
6
|
+
class CreateAdapter
|
7
|
+
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
@machine = env[:machine]
|
11
|
+
@global_env = @machine.env
|
12
|
+
@provider = env[:provider]
|
13
|
+
@logger = Log4r::Logger.new('vagrant::persistent_storage::action::create_adapter')
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(env)
|
17
|
+
# skip if machine is not running and the action is destroy, halt or suspend
|
18
|
+
return @app.call(env) if @machine.state.id != :running && [:destroy, :halt, :suspend].include?(env[:machine_action])
|
19
|
+
# skip if machine is not saved and the action is resume
|
20
|
+
return @app.call(env) if @machine.state.id != :saved && env[:machine_action] == :resume
|
21
|
+
# skip if machine is powered off and the action is resume
|
22
|
+
return @app.call(env) if @machine.state.id == :poweroff && env[:machine_action] == :resume
|
23
|
+
# skip if machine is saved
|
24
|
+
return @app.call(env) if @machine.state.id == :saved
|
25
|
+
|
26
|
+
return @app.call(env) unless env[:machine].config.persistent_storage.enabled?
|
27
|
+
@logger.info '** Creating Persistent Storage Adapter **'
|
28
|
+
|
29
|
+
env[:ui].info I18n.t("vagrant_persistent_storage.action.create_adapter")
|
30
|
+
env[:machine].provider.driver.create_adapter
|
31
|
+
|
32
|
+
@app.call(env)
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module PersistentStorage
|
5
|
+
module Action
|
6
|
+
class CreateStorage
|
7
|
+
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
@machine = env[:machine]
|
11
|
+
@global_env = @machine.env
|
12
|
+
@provider = env[:provider]
|
13
|
+
@logger = Log4r::Logger.new('vagrant::persistent_storage::action::create_storage')
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(env)
|
17
|
+
# skip if machine is not running and the action is destroy, halt or suspend
|
18
|
+
return @app.call(env) if @machine.state.id != :running && [:destroy, :halt, :suspend].include?(env[:machine_action])
|
19
|
+
# skip if machine is not saved and the action is resume
|
20
|
+
return @app.call(env) if @machine.state.id != :saved && env[:machine_action] == :resume
|
21
|
+
# skip if machine is powered off and the action is resume
|
22
|
+
return @app.call(env) if @machine.state.id == :poweroff && env[:machine_action] == :resume
|
23
|
+
# skip if machine is saved
|
24
|
+
return @app.call(env) if @machine.state.id == :saved
|
25
|
+
|
26
|
+
return @app.call(env) unless env[:machine].config.persistent_storage.enabled?
|
27
|
+
|
28
|
+
# check config to see if the disk should be created
|
29
|
+
return @app.call(env) unless env[:machine].config.persistent_storage.create?
|
30
|
+
|
31
|
+
if File.exists?(env[:machine].config.persistent_storage.location)
|
32
|
+
@logger.info '** Persistent Storage Volume exists, not creating **'
|
33
|
+
env[:ui].info I18n.t("vagrant_persistent_storage.action.not_creating")
|
34
|
+
@app.call(env)
|
35
|
+
|
36
|
+
else
|
37
|
+
@logger.info '** Creating Persistent Storage **'
|
38
|
+
env[:ui].info I18n.t("vagrant_persistent_storage.action.create_storage")
|
39
|
+
location = env[:machine].config.persistent_storage.location
|
40
|
+
size = env[:machine].config.persistent_storage.size
|
41
|
+
env[:machine].provider.driver.create_storage(location, size)
|
42
|
+
@app.call(env)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module PersistentStorage
|
5
|
+
module Action
|
6
|
+
class DetachStorage
|
7
|
+
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
@machine = env[:machine]
|
11
|
+
@global_env = @machine.env
|
12
|
+
@provider = env[:provider]
|
13
|
+
@logger = Log4r::Logger.new('vagrant::persistent_storage::action::detach_adapter')
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(env)
|
17
|
+
# skip if machine is not saved and the action is resume
|
18
|
+
return @app.call(env) if @machine.state.id != :saved && env[:machine_action] == :resume
|
19
|
+
|
20
|
+
return @app.call(env) unless env[:machine].config.persistent_storage.enabled?
|
21
|
+
@logger.info '** Detaching Persistent Storage **'
|
22
|
+
|
23
|
+
env[:ui].info I18n.t("vagrant_persistent_storage.action.detach_storage")
|
24
|
+
location = env[:machine].config.persistent_storage.location
|
25
|
+
env[:machine].provider.driver.detach_storage(location)
|
26
|
+
|
27
|
+
@app.call(env)
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require 'vagrant-persistent-storage/manage_storage'
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module PersistentStorage
|
6
|
+
module Action
|
7
|
+
class ManageAll
|
8
|
+
|
9
|
+
include ManageStorage
|
10
|
+
|
11
|
+
def initialize(app, env)
|
12
|
+
@app = app
|
13
|
+
@machine = env[:machine]
|
14
|
+
@global_env = @machine.env
|
15
|
+
@provider = @machine.provider_name
|
16
|
+
@logger = Log4r::Logger.new('vagrant::persistent_storage::action::manage_storage')
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
# skip if machine is not running and the action is destroy, halt or suspend
|
21
|
+
return @app.call(env) if @machine.state.id != :running && [:destroy, :halt, :suspend].include?(env[:machine_action])
|
22
|
+
# skip if machine is not saved and the action is resume
|
23
|
+
return @app.call(env) if @machine.state.id != :saved && env[:machine_action] == :resume
|
24
|
+
# skip if machine is powered off and the action is resume
|
25
|
+
return @app.call(env) if @machine.state.id == :poweroff && env[:machine_action] == :resume
|
26
|
+
# skip if machine is powered off and the action is resume
|
27
|
+
return @app.call(env) if @machine.state.id == :saved && env[:machine_action] == :resume
|
28
|
+
|
29
|
+
return @app.call(env) unless env[:machine].config.persistent_storage.enabled?
|
30
|
+
return @app.call(env) unless env[:machine].config.persistent_storage.manage?
|
31
|
+
@logger.info '** Managing Persistent Storage **'
|
32
|
+
|
33
|
+
env[:ui].info I18n.t('vagrant_persistent_storage.action.manage_storage')
|
34
|
+
machine = env[:machine]
|
35
|
+
manage_volumes(machine)
|
36
|
+
|
37
|
+
@app.call(env)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "vagrant/action/builder"
|
2
|
+
require "vagrant-persistent-storage/action"
|
3
|
+
require "vagrant-persistent-storage/action/manage_storage"
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module PersistentStorage
|
7
|
+
module Action
|
8
|
+
include Vagrant::Action::Builtin
|
9
|
+
|
10
|
+
autoload :CreateAdapter, File.expand_path("../action/create_adapter.rb", __FILE__)
|
11
|
+
autoload :CreateStorage, File.expand_path("../action/create_storage.rb", __FILE__)
|
12
|
+
autoload :AttachStorage, File.expand_path("../action/attach_storage.rb", __FILE__)
|
13
|
+
autoload :DetachStorage, File.expand_path("../action/detach_storage.rb", __FILE__)
|
14
|
+
autoload :ManageStorage, File.expand_path("../action/manage_storage.rb", __FILE__)
|
15
|
+
|
16
|
+
def self.create_adapter
|
17
|
+
Vagrant::Action::Builder.new.tap do |builder|
|
18
|
+
builder.use ConfigValidate
|
19
|
+
builder.use CreateAdapter
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.create_storage
|
24
|
+
Vagrant::Action::Builder.new.tap do |builder|
|
25
|
+
builder.use ConfigValidate
|
26
|
+
builder.use CreateStorage
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.attach_storage
|
31
|
+
Vagrant::Action::Builder.new.tap do |builder|
|
32
|
+
builder.use ConfigValidate
|
33
|
+
builder.use AttachStorage
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.detach_storage
|
38
|
+
Vagrant::Action::Builder.new.tap do |builder|
|
39
|
+
builder.use ConfigValidate
|
40
|
+
builder.use DetachStorage
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.manage_storage
|
45
|
+
Vagrant::Action::Builder.new.tap do |builder|
|
46
|
+
builder.use ConfigValidate
|
47
|
+
builder.use ManageAll
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,7 +1,146 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module PersistentStorage
|
5
|
+
class Config < Vagrant.plugin('2', :config)
|
6
|
+
|
7
|
+
attr_accessor :size
|
8
|
+
attr_accessor :create
|
9
|
+
attr_accessor :mount
|
10
|
+
attr_accessor :manage
|
11
|
+
attr_accessor :format
|
12
|
+
attr_accessor :enabled
|
13
|
+
attr_accessor :use_lvm
|
14
|
+
attr_accessor :location
|
15
|
+
attr_accessor :mountname
|
16
|
+
attr_accessor :mountpoint
|
17
|
+
attr_accessor :diskdevice
|
18
|
+
attr_accessor :filesystem
|
19
|
+
attr_accessor :volgroupname
|
20
|
+
|
21
|
+
alias_method :create?, :create
|
22
|
+
alias_method :mount?, :mount
|
23
|
+
alias_method :manage?, :manage
|
24
|
+
alias_method :format?, :format
|
25
|
+
alias_method :use_lvm?, :use_lvm
|
26
|
+
alias_method :enabled?, :enabled
|
27
|
+
|
28
|
+
def initialize
|
29
|
+
@size = UNSET_VALUE
|
30
|
+
@create = true
|
31
|
+
@mount = true
|
32
|
+
@manage = true
|
33
|
+
@format = true
|
34
|
+
@use_lvm = true
|
35
|
+
@enabled = false
|
36
|
+
@location = UNSET_VALUE
|
37
|
+
@mountname = UNSET_VALUE
|
38
|
+
@mountpoint = UNSET_VALUE
|
39
|
+
@diskdevice = UNSET_VALUE
|
40
|
+
@filesystem = UNSET_VALUE
|
41
|
+
@volgroupname = UNSET_VALUE
|
42
|
+
end
|
43
|
+
|
44
|
+
def finalize!
|
45
|
+
@size = 0 if @size == UNSET_VALUE
|
46
|
+
@create = true if @create == UNSET_VALUE
|
47
|
+
@mount = true if @mount == UNSET_VALUE
|
48
|
+
@manage = true if @manage == UNSET_VALUE
|
49
|
+
@format = true if @format == UNSET_VALUE
|
50
|
+
@use_lvm = true if @use_lvm == UNSET_VALUE
|
51
|
+
@enabled = false if @enabled == UNSET_VALUE
|
52
|
+
@location = 0 if @location == UNSET_VALUE
|
53
|
+
@mountname = 0 if @mountname == UNSET_VALUE
|
54
|
+
@mountpoint = 0 if @mountpoint == UNSET_VALUE
|
55
|
+
@diskdevice = 0 if @diskdevice == UNSET_VALUE
|
56
|
+
@filesystem = 0 if @filesystem == UNSET_VALUE
|
57
|
+
@volgroupname = 0 if @volgroupname == UNSET_VALUE
|
58
|
+
end
|
59
|
+
|
60
|
+
def validate(machine)
|
61
|
+
errors = []
|
62
|
+
|
63
|
+
errors << validate_bool('persistent_storage.create', @create)
|
64
|
+
errors << validate_bool('persistent_storage.mount', @mount)
|
65
|
+
errors << validate_bool('persistent_storage.mount', @manage)
|
66
|
+
errors << validate_bool('persistent_storage.mount', @format)
|
67
|
+
errors << validate_bool('persistent_storage.mount', @use_lvm)
|
68
|
+
errors << validate_bool('persistent_storage.mount', @enabled)
|
69
|
+
errors.compact!
|
70
|
+
|
71
|
+
if !machine.config.persistent_storage.size.kind_of?(String)
|
72
|
+
errors << I18n.t('vagrant_persistent_storage.config.not_a_string', {
|
73
|
+
:config_key => 'persistent_storage.size',
|
74
|
+
:is_class => size.class.to_s,
|
75
|
+
})
|
76
|
+
end
|
77
|
+
if !machine.config.persistent_storage.location.kind_of?(String)
|
78
|
+
errors << I18n.t('vagrant_persistent_storage.config.not_a_string', {
|
79
|
+
:config_key => 'persistent_storage.location',
|
80
|
+
:is_class => location.class.to_s,
|
81
|
+
})
|
82
|
+
end
|
83
|
+
if !machine.config.persistent_storage.mountname.kind_of?(String)
|
84
|
+
errors << I18n.t('vagrant_persistent_storage.config.not_a_string', {
|
85
|
+
:config_key => 'persistent_storage.mountname',
|
86
|
+
:is_class => mountname.class.to_s,
|
87
|
+
})
|
88
|
+
end
|
89
|
+
if !machine.config.persistent_storage.mountpoint.kind_of?(String)
|
90
|
+
errors << I18n.t('vagrant_persistent_storage.config.not_a_string', {
|
91
|
+
:config_key => 'persistent_storage.mountpoint',
|
92
|
+
:is_class => mountpoint.class.to_s,
|
93
|
+
})
|
94
|
+
end
|
95
|
+
if !machine.config.persistent_storage.diskdevice.kind_of?(String)
|
96
|
+
errors << I18n.t('vagrant_persistent_storage.config.not_a_string', {
|
97
|
+
:config_key => 'persistent_storage.diskdevice',
|
98
|
+
:is_class => diskdevice.class.to_s,
|
99
|
+
})
|
100
|
+
end
|
101
|
+
if !machine.config.persistent_storage.filesystem.kind_of?(String)
|
102
|
+
errors << I18n.t('vagrant_persistent_storage.config.not_a_string', {
|
103
|
+
:config_key => 'persistent_storage.filesystem',
|
104
|
+
:is_class => filesystem.class.to_s,
|
105
|
+
})
|
106
|
+
end
|
107
|
+
if !machine.config.persistent_storage.volgroupname.kind_of?(String)
|
108
|
+
errors << I18n.t('vagrant_persistent_storage.config.not_a_string', {
|
109
|
+
:config_key => 'persistent_storage.volgroupname',
|
110
|
+
:is_class => volgroupname.class.to_s,
|
111
|
+
})
|
112
|
+
end
|
113
|
+
|
114
|
+
mount_point_path = Pathname.new("#{machine.config.persistent_storage.location}")
|
115
|
+
if ! mount_point.path.absolute?
|
116
|
+
errors << I18n.t('vagrant_persistent_storage.config.not_a_path', {
|
117
|
+
:config_key => 'persistent_storage.location',
|
118
|
+
:is_path => location.class.to_s,
|
119
|
+
})
|
120
|
+
end
|
121
|
+
|
122
|
+
{ 'Persistent Storage configuration' => errors }
|
123
|
+
|
124
|
+
if ! File.exists?@location.to_s and ! @create == "true"
|
125
|
+
return { "location" => ["file doesn't exist, and create set to false"] }
|
126
|
+
end
|
127
|
+
{}
|
128
|
+
end
|
129
|
+
|
130
|
+
private
|
131
|
+
|
132
|
+
def validate_bool(key, value)
|
133
|
+
if ![TrueClass, FalseClass].include?(value.class) &&
|
134
|
+
value != UNSET_VALUE
|
135
|
+
I18n.t('vagrant_persistent_storage.config.not_a_bool', {
|
136
|
+
:config_key => key,
|
137
|
+
:value => value.class.to_s
|
138
|
+
})
|
139
|
+
else
|
140
|
+
nil
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
5
145
|
end
|
6
146
|
end
|
7
|
-
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'erb'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module PersistentStorage
|
7
|
+
module ManageStorage
|
8
|
+
|
9
|
+
def populate_template(m)
|
10
|
+
mnt_name = m.config.persistent_storage.mountname
|
11
|
+
mnt_point = m.config.persistent_storage.mountpoint
|
12
|
+
vg_name = m.config.persistent_storage.volgroupname
|
13
|
+
disk_dev = m.config.persistent_storage.diskdevice
|
14
|
+
fs_type = m.config.persistent_storage.filesystem
|
15
|
+
manage = m.config.persistent_storage.manage
|
16
|
+
use_lvm = m.config.persistent_storage.use_lvm
|
17
|
+
mount = m.config.persistent_storage.mount
|
18
|
+
format = m.config.persistent_storage.format
|
19
|
+
|
20
|
+
vg_name = 'vps' unless vg_name != 0
|
21
|
+
disk_dev = '/dev/sdb' unless disk_dev != 0
|
22
|
+
mnt_name = 'vps' unless mnt_name != 0
|
23
|
+
fs_type = 'ext3' unless fs_type != 0
|
24
|
+
if use_lvm
|
25
|
+
device = "/dev/#{vg_name}-vg1/#{mnt_name}"
|
26
|
+
else
|
27
|
+
device = "#{disk_dev}1"
|
28
|
+
end
|
29
|
+
|
30
|
+
## shell script to format disk, create/manage LVM, mount disk
|
31
|
+
disk_operations_template = ERB.new <<-EOF
|
32
|
+
#!/bin/bash
|
33
|
+
# fdisk the disk if it's not a block device already:
|
34
|
+
[ -b #{disk_dev}1 ] || echo 0,,8e | sfdisk #{disk_dev}
|
35
|
+
echo "fdisk returned: $?" >> disk_operation_log.txt
|
36
|
+
|
37
|
+
<% if use_lvm == true %>
|
38
|
+
# Create the physical volume if it doesn't already exist:
|
39
|
+
[[ `pvs #{disk_dev}1` ]] || pvcreate #{disk_dev}1
|
40
|
+
echo "pvcreate returned: $?" >> disk_operation_log.txt
|
41
|
+
# Create the volume group if it doesn't already exist:
|
42
|
+
[[ `vgs #{vg_name}-vg1` ]] || vgcreate #{vg_name}-vg1 #{disk_dev}1
|
43
|
+
echo "vgcreate returned: $?" >> disk_operation_log.txt
|
44
|
+
# Create the logical volume if it doesn't already exist:
|
45
|
+
[[ `lvs #{vg_name}-vg1 | grep #{mnt_name}` ]] || lvcreate -l 100%FREE -n #{mnt_name} #{vg_name}-vg1
|
46
|
+
echo "lvcreate returned: $?" >> disk_operation_log.txt
|
47
|
+
# Activate the volume group if it's inactive:
|
48
|
+
[[ `lvs #{vg_name}-vg1 --noheadings --nameprefixes | grep LVM2_LV_ATTR | grep "wi\-a"` ]] || vgchange #{vg_name}-vg1 -a y
|
49
|
+
echo "vg activation returned: $?" >> disk_operation_log.txt
|
50
|
+
<% end %>
|
51
|
+
|
52
|
+
<% if format == true %>
|
53
|
+
# Create the filesytem if it doesn't already exist
|
54
|
+
[[ `blkid | grep #{mnt_name} | grep #{fs_type}` ]] || mkfs.#{fs_type} #{device}
|
55
|
+
echo "#{fs_type} creation return: $?" >> disk_operation_log.txt
|
56
|
+
<% if mount == true %>
|
57
|
+
# Create mountpoint #{mnt_point}
|
58
|
+
[ -d #{mnt_point} ] || mkdir -p #{mnt_point}
|
59
|
+
# Update fstab with new mountpoint name
|
60
|
+
[[ `grep -i #{device} /etc/fstab` ]] || echo #{device} #{mnt_point} #{fs_type} defaults 0 0 >> /etc/fstab
|
61
|
+
echo "fstab update returned: $?" >> disk_operation_log.txt
|
62
|
+
# Finally, mount the partition
|
63
|
+
[[ `mount | grep #{mnt_point}` ]] || mount #{mnt_point}
|
64
|
+
echo "#{mnt_point} mounting returned: $?" >> disk_operation_log.txt
|
65
|
+
<% end %>
|
66
|
+
<% end %>
|
67
|
+
exit $?
|
68
|
+
EOF
|
69
|
+
|
70
|
+
buffer = disk_operations_template.result(binding)
|
71
|
+
tmp_script = "/tmp/disk_operations_#{mnt_name}.sh"
|
72
|
+
target_script = "/tmp/disk_operations_#{mnt_name}.sh"
|
73
|
+
|
74
|
+
File.open("#{tmp_script}", 'w') do |f|
|
75
|
+
f.write buffer
|
76
|
+
end
|
77
|
+
m.communicate.upload(tmp_script, target_script)
|
78
|
+
m.communicate.sudo("chmod 755 #{target_script}")
|
79
|
+
end
|
80
|
+
|
81
|
+
def run_disk_operations(m)
|
82
|
+
return unless m.communicate.ready?
|
83
|
+
mnt_name = m.config.persistent_storage.mountname
|
84
|
+
mnt_name = 'vps' unless mnt_name != 0
|
85
|
+
target_script = "/tmp/disk_operations_#{mnt_name}.sh"
|
86
|
+
m.communicate.sudo("#{target_script}")
|
87
|
+
end
|
88
|
+
|
89
|
+
def manage_volumes(m)
|
90
|
+
populate_template(m)
|
91
|
+
if m.config.persistent_storage.manage?
|
92
|
+
run_disk_operations(m)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'vagrant'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module PersistentStorage
|
5
|
+
class Plugin < Vagrant.plugin('2')
|
6
|
+
|
7
|
+
include Vagrant::Action::Builtin
|
8
|
+
|
9
|
+
require_relative "action"
|
10
|
+
require_relative "providers/virtualbox/driver/base"
|
11
|
+
require_relative "providers/virtualbox/driver/meta"
|
12
|
+
|
13
|
+
name "persistent_storage"
|
14
|
+
description <<-DESC
|
15
|
+
This plugin provides config to attach persistent storage
|
16
|
+
DESC
|
17
|
+
|
18
|
+
config "persistent_storage" do
|
19
|
+
require_relative "config"
|
20
|
+
Config
|
21
|
+
end
|
22
|
+
|
23
|
+
## NB Currently only works with Virtualbox provider, due to hooks being used
|
24
|
+
action_hook(:persistent_storage, :machine_action_up) do |hook|
|
25
|
+
hook.after VagrantPlugins::ProviderVirtualBox::Action::SaneDefaults,
|
26
|
+
VagrantPlugins::PersistentStorage::Action.create_adapter
|
27
|
+
hook.before VagrantPlugins::ProviderVirtualBox::Action::Boot,
|
28
|
+
VagrantPlugins::PersistentStorage::Action.create_storage
|
29
|
+
hook.before VagrantPlugins::ProviderVirtualBox::Action::Boot,
|
30
|
+
VagrantPlugins::PersistentStorage::Action.attach_storage
|
31
|
+
hook.after VagrantPlugins::ProviderVirtualBox::Action::CheckGuestAdditions,
|
32
|
+
VagrantPlugins::PersistentStorage::Action.manage_storage
|
33
|
+
hook.after VagrantPlugins::PersistentStorage::Action.attach_storage,
|
34
|
+
VagrantPlugins::PersistentStorage::Action.manage_storage
|
35
|
+
end
|
36
|
+
|
37
|
+
action_hook(:persistent_storage, :machine_action_destroy) do |hook|
|
38
|
+
hook.after VagrantPlugins::ProviderVirtualBox::Action::action_halt,
|
39
|
+
VagrantPlugins::PersistentStorage::Action.detach_storage
|
40
|
+
hook.before VagrantPlugins::ProviderVirtualBox::Action::Destroy,
|
41
|
+
VagrantPlugins::PersistentStorage::Action.detach_storage
|
42
|
+
end
|
43
|
+
|
44
|
+
action_hook(:persistent_storage, :machine_action_halt) do |hook|
|
45
|
+
hook.after VagrantPlugins::ProviderVirtualBox::Action::GracefulHalt,
|
46
|
+
VagrantPlugins::PersistentStorage::Action.detach_storage
|
47
|
+
hook.after VagrantPlugins::ProviderVirtualBox::Action::ForcedHalt,
|
48
|
+
VagrantPlugins::PersistentStorage::Action.detach_storage
|
49
|
+
end
|
50
|
+
|
51
|
+
action_hook(:persistent_storage, :machine_action_reload) do |hook|
|
52
|
+
hook.after VagrantPlugins::ProviderVirtualBox::Action::GracefulHalt,
|
53
|
+
VagrantPlugins::PersistentStorage::Action.detach_storage
|
54
|
+
hook.after VagrantPlugins::ProviderVirtualBox::Action::ForcedHalt,
|
55
|
+
VagrantPlugins::PersistentStorage::Action.detach_storage
|
56
|
+
hook.before VagrantPlugins::ProviderVirtualBox::Action::Boot,
|
57
|
+
VagrantPlugins::PersistentStorage::Action.attach_storage
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module ProviderVirtualBox
|
3
|
+
module Driver
|
4
|
+
class Base
|
5
|
+
|
6
|
+
def create_adapter
|
7
|
+
execute("storagectl", @uuid, "--name", "SATA Controller", "--sataportcount", "2")
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_storage(location, size)
|
11
|
+
execute("createhd", "--filename", location, "--size", "#{size}")
|
12
|
+
end
|
13
|
+
|
14
|
+
def attach_storage(location)
|
15
|
+
execute("storageattach", @uuid, "--storagectl", "SATA Controller", "--port", "1", "--device", "0", "--type", "hdd", "--medium", "#{location}")
|
16
|
+
end
|
17
|
+
|
18
|
+
def detach_storage(location)
|
19
|
+
if location and read_persistent_storage(location) == location
|
20
|
+
execute("storageattach", @uuid, "--storagectl", "SATA Controller", "--port", "1", "--device", "0", "--type", "hdd", "--medium", "none")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def read_persistent_storage(location)
|
25
|
+
## Ensure previous operations are complete - bad practise yes, not sure how to avoid this:
|
26
|
+
sleep 3
|
27
|
+
info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true)
|
28
|
+
info.split("\n").each do |line|
|
29
|
+
return $1.to_s if line =~ /^"SATA Controller-1-0"="(.+?)"$/
|
30
|
+
end
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -1,12 +1,13 @@
|
|
1
|
-
require 'vagrant'
|
2
|
-
require 'vagrant/action/builder'
|
3
|
-
require 'vagrant-persistent-storage/config'
|
4
|
-
require 'vagrant-persistent-storage/middleware'
|
1
|
+
require 'vagrant-persistent-storage/plugin'
|
5
2
|
require 'vagrant-persistent-storage/version'
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
module VagrantPlugins
|
5
|
+
module PersistentStorage
|
6
|
+
def self.source_root
|
7
|
+
@source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
I18n.load_path << File.expand_path('locales/en.yml', source_root)
|
11
|
+
I18n.reload!
|
12
|
+
end
|
13
|
+
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
en:
|
2
|
+
vagrant_persistent_storage:
|
3
|
+
action:
|
4
|
+
create_adapter: "** Creating adapter for persistent storage **"
|
5
|
+
create_storage: "** Creating persistent storage **"
|
6
|
+
not_creating: "** Persistent Storage Volume exists, not creating **"
|
7
|
+
attach_storage: "** Attaching persistent storage **"
|
8
|
+
detach_storage: "** Detaching persistent storage **"
|
9
|
+
manage_storage: "** Managing persistent storage **"
|
10
|
+
config:
|
11
|
+
not_a_bool: "A value for %{config_key} can only be true or false, not type '%{value}'"
|
12
|
+
not_an_array_or_string: "A value for %{config_key} must be an Array or String, not type '%{is_class}'"
|
@@ -5,7 +5,7 @@ require 'vagrant-persistent-storage/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "vagrant-persistent-storage"
|
8
|
-
gem.version =
|
8
|
+
gem.version = VagrantPlugins::PersistentStorage::VERSION
|
9
9
|
gem.authors = ["Sebastian Kusnier"]
|
10
10
|
gem.email = ["sebastian@kusnier.net"]
|
11
11
|
gem.description = "A Vagrant plugin that creates a persistent storage and attaches it to guest machine."
|
@@ -17,8 +17,6 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_dependency 'vagrant'
|
21
|
-
|
22
20
|
gem.add_development_dependency 'rake'
|
23
21
|
gem.add_development_dependency 'rspec'
|
24
22
|
end
|
metadata
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-persistent-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
4
|
+
version: 0.0.3
|
11
5
|
platform: ruby
|
12
6
|
authors:
|
13
7
|
- Sebastian Kusnier
|
@@ -15,48 +9,25 @@ autorequire:
|
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
11
|
|
18
|
-
date:
|
12
|
+
date: 2013-09-08 00:00:00 Z
|
19
13
|
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: vagrant
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
32
|
-
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
14
|
- !ruby/object:Gem::Dependency
|
35
15
|
name: rake
|
36
16
|
prerelease: false
|
37
|
-
requirement: &
|
38
|
-
none: false
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
39
18
|
requirements:
|
40
|
-
-
|
19
|
+
- &id002
|
20
|
+
- ">="
|
41
21
|
- !ruby/object:Gem::Version
|
42
|
-
hash: 3
|
43
|
-
segments:
|
44
|
-
- 0
|
45
22
|
version: "0"
|
46
23
|
type: :development
|
47
|
-
version_requirements: *
|
24
|
+
version_requirements: *id001
|
48
25
|
- !ruby/object:Gem::Dependency
|
49
26
|
name: rspec
|
50
27
|
prerelease: false
|
51
28
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
29
|
requirements:
|
54
|
-
-
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
hash: 3
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
version: "0"
|
30
|
+
- *id002
|
60
31
|
type: :development
|
61
32
|
version_requirements: *id003
|
62
33
|
description: A Vagrant plugin that creates a persistent storage and attaches it to guest machine.
|
@@ -72,46 +43,44 @@ files:
|
|
72
43
|
- .gitignore
|
73
44
|
- Gemfile
|
74
45
|
- README.md
|
46
|
+
- Rakefile
|
75
47
|
- lib/vagrant-persistent-storage.rb
|
48
|
+
- lib/vagrant-persistent-storage/action.rb
|
49
|
+
- lib/vagrant-persistent-storage/action/attach_storage.rb
|
50
|
+
- lib/vagrant-persistent-storage/action/create_adapter.rb
|
51
|
+
- lib/vagrant-persistent-storage/action/create_storage.rb
|
52
|
+
- lib/vagrant-persistent-storage/action/detach_storage.rb
|
53
|
+
- lib/vagrant-persistent-storage/action/manage_storage.rb
|
76
54
|
- lib/vagrant-persistent-storage/config.rb
|
77
|
-
- lib/vagrant-persistent-storage/
|
78
|
-
- lib/vagrant-persistent-storage/
|
79
|
-
- lib/vagrant-persistent-storage/
|
55
|
+
- lib/vagrant-persistent-storage/manage_storage.rb
|
56
|
+
- lib/vagrant-persistent-storage/plugin.rb
|
57
|
+
- lib/vagrant-persistent-storage/providers/virtualbox/driver/base.rb
|
58
|
+
- lib/vagrant-persistent-storage/providers/virtualbox/driver/meta.rb
|
80
59
|
- lib/vagrant-persistent-storage/version.rb
|
81
|
-
-
|
60
|
+
- locales/en.yml
|
82
61
|
- vagrant-persistent-storage.gemspec
|
83
62
|
homepage: https://github.com/kusnier/vagrant-persistent-storage
|
84
63
|
licenses: []
|
85
64
|
|
65
|
+
metadata: {}
|
66
|
+
|
86
67
|
post_install_message:
|
87
68
|
rdoc_options: []
|
88
69
|
|
89
70
|
require_paths:
|
90
71
|
- lib
|
91
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
-
none: false
|
93
73
|
requirements:
|
94
|
-
-
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
hash: 3
|
97
|
-
segments:
|
98
|
-
- 0
|
99
|
-
version: "0"
|
74
|
+
- *id002
|
100
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
76
|
requirements:
|
103
|
-
-
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
hash: 3
|
106
|
-
segments:
|
107
|
-
- 0
|
108
|
-
version: "0"
|
77
|
+
- *id002
|
109
78
|
requirements: []
|
110
79
|
|
111
80
|
rubyforge_project:
|
112
|
-
rubygems_version:
|
81
|
+
rubygems_version: 2.0.7
|
113
82
|
signing_key:
|
114
|
-
specification_version:
|
83
|
+
specification_version: 4
|
115
84
|
summary: A Vagrant plugin that creates a persistent storage and attaches it to guest machine.
|
116
85
|
test_files: []
|
117
86
|
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module VagrantPersistentStorage
|
2
|
-
class AttachPersistentStorage
|
3
|
-
def initialize(app, env)
|
4
|
-
@app = app
|
5
|
-
@env = env
|
6
|
-
@vm = env[:vm]
|
7
|
-
end
|
8
|
-
|
9
|
-
def call(env)
|
10
|
-
options = @vm.config.persistent_storage
|
11
|
-
if !options.location ^ !options.size
|
12
|
-
env[:ui].error "Attach Persistent Storage failed. Location and size must be filled out."
|
13
|
-
elsif options.location
|
14
|
-
if !File.exists?(options.location)
|
15
|
-
@vm.config.vm.customize ["createhd", "--filename", options.location, "--size", options.size]
|
16
|
-
env[:ui].success "Create Persistent Storage."
|
17
|
-
end
|
18
|
-
@vm.config.vm.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", 1, "--type", "hdd", "--medium", options.location]
|
19
|
-
|
20
|
-
env[:ui].info "Attach Persistent Storage #{options.location} (Size: #{options.size}MB)"
|
21
|
-
end
|
22
|
-
|
23
|
-
@app.call(env)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module VagrantPersistentStorage
|
2
|
-
class DetachPersistentStorage
|
3
|
-
def initialize(app, env)
|
4
|
-
@app = app
|
5
|
-
@env = env
|
6
|
-
@vm = env[:vm]
|
7
|
-
end
|
8
|
-
|
9
|
-
def call(env)
|
10
|
-
options = @vm.config.persistent_storage
|
11
|
-
if options.location and read_persistent_storage() == options.location
|
12
|
-
@vm.driver.execute("storageattach", @vm.uuid, "--storagectl", "SATA Controller", "--port", "1", "--type", "hdd", "--medium", "none")
|
13
|
-
env[:ui].info "Detach Persistent Storage #{options.location} (Size: #{options.size}MB)"
|
14
|
-
end
|
15
|
-
|
16
|
-
@app.call(env)
|
17
|
-
end
|
18
|
-
|
19
|
-
def read_persistent_storage
|
20
|
-
info = @vm.driver.execute("showvminfo", @vm.uuid, "--machinereadable", :retryable => true)
|
21
|
-
info.split("\n").each do |line|
|
22
|
-
return $1.to_s if line =~ /^"SATA Controller-1-0"="(.+?)"$/
|
23
|
-
end
|
24
|
-
|
25
|
-
nil
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
data/lib/vagrant_init.rb
DELETED