vagrant-alpine 0.2.0 → 0.3.0
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/.rubocop.yml +4 -2
- data/.ruby-version +1 -1
- data/.travis.yml +4 -4
- data/Gemfile +3 -3
- data/README.md +3 -2
- data/Rakefile +1 -1
- data/lib/vagrant-alpine/cap/nfs_client.rb +42 -12
- data/lib/vagrant-alpine/version.rb +1 -1
- data/spec/cap/change_host_name_spec.rb +114 -114
- data/spec/cap/configure_networks_spec.rb +35 -35
- data/spec/cap/halt_spec.rb +16 -16
- data/spec/cap/nfs_client_spec.rb +51 -19
- data/spec/cap/rsync_spec.rb +32 -30
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d14a610a33c058c4a2b9d2562da0c44d77d6da7
|
4
|
+
data.tar.gz: 8a29b732ac12fe585d4126a0bb0779673eacad40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fcc00f9947f877ba5477700d04834f4e0b756b5a4d6c43bebbe343875de0515a0576664212287c48dfdf75370b0e304c93b1ba75c2925c7707a673fd827c800
|
7
|
+
data.tar.gz: 8bb43f67931aa0f35fafa96b47867712ed5c843c99dc4a4bf263d2256715ab0cc906ba27a9821bf28827da917db2557dd9aaa901043c1563b09aad3231fc3bb7
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.2.
|
1
|
+
ruby-2.2.5
|
data/.travis.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
2
|
+
before_install:
|
3
|
+
- gem uninstall bundler --all --executables
|
4
|
+
- gem install bundler --version '~> 1.7.0'
|
3
5
|
# - sudo apt-get update -qq
|
4
6
|
# - sudo apt-get install -qq -y bsdtar
|
5
7
|
# - rvm @global do gem uninstall bundler --all --executables
|
6
8
|
# - gem uninstall bundler --all --executables
|
7
|
-
# - gem install bundler --version '
|
8
|
-
rvm:
|
9
|
-
- 2.2.0
|
9
|
+
# - gem install bundler --version '~> 1.7.0'
|
10
10
|
env:
|
11
11
|
global:
|
12
12
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gemspec
|
3
|
+
# gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
6
|
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
|
@@ -11,7 +11,7 @@ group :plugins do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
group :test do
|
14
|
-
gem 'rake'
|
14
|
+
gem 'rake', '< 11.0'
|
15
|
+
gem 'rspec'
|
15
16
|
gem 'rubocop'
|
16
17
|
end
|
17
|
-
|
data/README.md
CHANGED
@@ -16,6 +16,7 @@ This is a [Vagrant](http://vagrantup.com/) plugin adding support for [Alpine Lin
|
|
16
16
|
|
17
17
|
## Changes
|
18
18
|
|
19
|
+
* v0.3.0 - update to fix defunct alpine apk repository in maier/alpine-3.3* boxes so that nfs client will install correctly.
|
19
20
|
* v0.2.0 - add `apk update` and `apk add --upgrade` to nfs client install
|
20
21
|
|
21
22
|
## Installation
|
@@ -31,14 +32,14 @@ $ vagrant init maier/alpine-3.3.1-x86_64
|
|
31
32
|
$ vagrant up
|
32
33
|
```
|
33
34
|
|
34
|
-
or
|
35
|
+
or
|
35
36
|
|
36
37
|
```sh
|
37
38
|
$ vagrant init maier/alpine-3.2.3-x86_64
|
38
39
|
$ vagrant up
|
39
40
|
```
|
40
41
|
|
41
|
-
or
|
42
|
+
or
|
42
43
|
|
43
44
|
```sh
|
44
45
|
$ vagrant init maier/alpine-3.1.3-x86_64
|
data/Rakefile
CHANGED
@@ -1,16 +1,46 @@
|
|
1
1
|
module VagrantPlugins
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
module GuestAlpine
|
3
|
+
module Cap
|
4
|
+
class NFSClient
|
5
|
+
def self.nfs_client_install(machine)
|
6
|
+
comm = machine.communicate
|
7
|
+
comm.sudo <<-EOS.gsub(/^\s+\|\s?/, '')
|
8
|
+
| # work around defunct repository in configuration
|
9
|
+
| # box: maier/apline-3.3
|
10
|
+
| repo_file="/etc/apk/repositories"
|
11
|
+
| if [ $(grep -c "repos.dfw.lax-noc.com" $repo_file) -ne 0 ]; then
|
12
|
+
| repo_file_bak="${repo_file}.orig"
|
13
|
+
| echo "updating repositories"
|
14
|
+
| cp $repo_file $repo_file_bak
|
15
|
+
| sed -e 's/repos.dfw.lax-noc.com/dl-cdn.alpinelinux.org/' $repo_file_bak > $repo_file
|
16
|
+
| fi
|
17
|
+
|
|
18
|
+
| echo "updating repository indices"
|
19
|
+
| apk update
|
20
|
+
| if [ $? -ne 0 ]; then
|
21
|
+
| exit 1
|
22
|
+
| fi
|
23
|
+
|
|
24
|
+
| echo "installing nfs-utils"
|
25
|
+
| apk add --upgrade nfs-utils
|
26
|
+
| if [ $? -ne 0 ]; then
|
27
|
+
| exit 1
|
28
|
+
| fi
|
29
|
+
|
|
30
|
+
| echo "installing rpc.statd"
|
31
|
+
| rc-update add rpc.statd
|
32
|
+
| if [ $? -ne 0 ]; then
|
33
|
+
| exit 1
|
34
|
+
| fi
|
35
|
+
|
|
36
|
+
| echo "starting rpc.statd service"
|
37
|
+
| rc-service rpc.statd start
|
38
|
+
| if [ $? -ne 0 ]; then
|
39
|
+
| exit 1
|
40
|
+
| fi
|
41
|
+
EOS
|
42
|
+
end
|
43
|
+
end
|
12
44
|
end
|
13
|
-
end
|
14
45
|
end
|
15
|
-
end
|
16
46
|
end
|
@@ -2,127 +2,127 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe 'VagrantPlugins::GuestAlpine::Cap::ChangeHostname' do
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
let(:machine) { double('machine') }
|
9
|
-
let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
10
|
-
let(:old_hostname) { 'oldhostname.olddomain.tld' }
|
11
|
-
|
12
|
-
before do
|
13
|
-
allow(machine).to receive(:communicate).and_return(communicator)
|
14
|
-
communicator.stub_command('hostname -f', stdout: old_hostname)
|
15
|
-
end
|
16
|
-
|
17
|
-
after do
|
18
|
-
communicator.verify_expectations!
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '.change_host_name' do
|
22
|
-
it 'updates /etc/hostname on the machine' do
|
23
|
-
communicator.expect_command("echo 'newhostname' > /etc/hostname")
|
24
|
-
described_class.change_host_name(machine, 'newhostname.newdomain.tld')
|
5
|
+
let(:described_class) do
|
6
|
+
VagrantPlugins::GuestAlpine::Plugin.components.guest_capabilities[:alpine].get(:change_host_name)
|
25
7
|
end
|
8
|
+
let(:machine) { double('machine') }
|
9
|
+
let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
10
|
+
let(:old_hostname) { 'oldhostname.olddomain.tld' }
|
26
11
|
|
27
|
-
|
28
|
-
|
29
|
-
|
12
|
+
before do
|
13
|
+
allow(machine).to receive(:communicate).and_return(communicator)
|
14
|
+
communicator.stub_command('hostname -f', stdout: old_hostname)
|
30
15
|
end
|
31
16
|
|
32
|
-
|
33
|
-
|
34
|
-
described_class.change_host_name(machine, 'newhostname.newdomain.tld')
|
17
|
+
after do
|
18
|
+
communicator.verify_expectations!
|
35
19
|
end
|
36
20
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
21
|
+
describe '.change_host_name' do
|
22
|
+
it 'updates /etc/hostname on the machine' do
|
23
|
+
communicator.expect_command("echo 'newhostname' > /etc/hostname")
|
24
|
+
described_class.change_host_name(machine, 'newhostname.newdomain.tld')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'does nothing when the provided hostname is not different' do
|
28
|
+
described_class.change_host_name(machine, 'oldhostname.olddomain.tld')
|
29
|
+
expect(communicator.received_commands).to eq(['hostname -f'])
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'refreshes the hostname service with the hostname command' do
|
33
|
+
communicator.expect_command('hostname -F /etc/hostname')
|
34
|
+
described_class.change_host_name(machine, 'newhostname.newdomain.tld')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'renews dhcp on the system with the new hostname' do
|
38
|
+
communicator.expect_command('ifdown -a; ifup -a; ifup eth0')
|
39
|
+
described_class.change_host_name(machine, 'newhostname.newdomain.tld')
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
42
|
+
describe 'flipping out the old hostname in /etc/hosts' do
|
43
|
+
let(:sed_command) do
|
44
|
+
# Here we run the change_host_name through and extract the recorded sed
|
45
|
+
# command from the dummy communicator
|
46
|
+
described_class.change_host_name(machine, 'newhostname.newdomain.tld')
|
47
|
+
communicator.received_commands.find { |cmd| cmd =~ /^sed/ }
|
48
|
+
end
|
49
|
+
|
50
|
+
# Now we extract the regexp from that sed command so we can do some
|
51
|
+
# verification on it
|
52
|
+
let(:expression) { sed_command.sub(%r{^sed -ri '\(.*\)' /etc/hosts$}, "\1") }
|
53
|
+
let(:search) { Regexp.new(expression.split('@')[1], Regexp::EXTENDED) }
|
54
|
+
let(:replace) { expression.split('@')[2] }
|
55
|
+
|
56
|
+
let(:grep_command) { "grep '#{old_hostname}' /etc/hosts" }
|
57
|
+
|
58
|
+
before do
|
59
|
+
communicator.stub_command(grep_command, exit_code: 0)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'works on an simple /etc/hosts file' do
|
63
|
+
original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
|
64
|
+
127.0.0.1 localhost
|
65
|
+
127.0.1.1 oldhostname.olddomain.tld oldhostname
|
66
|
+
ETC_HOSTS
|
67
|
+
|
68
|
+
modified_etc_hosts = original_etc_hosts.gsub(search, replace)
|
69
|
+
|
70
|
+
expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
|
71
|
+
127.0.0.1 localhost
|
72
|
+
127.0.1.1 newhostname.newdomain.tld newhostname
|
73
|
+
RESULT
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'does not modify lines which contain similar hostnames' do
|
77
|
+
original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
|
78
|
+
127.0.0.1 localhost
|
79
|
+
127.0.1.1 oldhostname.olddomain.tld oldhostname
|
80
|
+
# common prefix, but different fqdn
|
81
|
+
192.168.12.34 oldhostname.olddomain.tld.different
|
82
|
+
# different characters at the dot
|
83
|
+
192.168.34.56 oldhostname-olddomain.tld
|
84
|
+
ETC_HOSTS
|
85
|
+
|
86
|
+
modified_etc_hosts = original_etc_hosts.gsub(search, replace)
|
87
|
+
|
88
|
+
expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
|
89
|
+
127.0.0.1 localhost
|
90
|
+
127.0.1.1 newhostname.newdomain.tld newhostname
|
91
|
+
# common prefix, but different fqdn
|
92
|
+
192.168.12.34 oldhostname.olddomain.tld.different
|
93
|
+
# different characters at the dot
|
94
|
+
192.168.34.56 oldhostname-olddomain.tld
|
95
|
+
RESULT
|
96
|
+
end
|
97
|
+
|
98
|
+
it "appends 127.0.1.1 if it isn't there" do
|
99
|
+
communicator.stub_command(grep_command, exit_code: 1)
|
100
|
+
described_class.change_host_name(machine, 'newhostname.newdomain.tld')
|
101
|
+
|
102
|
+
sed = communicator.received_commands.find { |cmd| cmd =~ /^sed/ }
|
103
|
+
expect(sed).to be_nil
|
104
|
+
|
105
|
+
echo = communicator.received_commands.find { |cmd| cmd =~ /^echo/ }
|
106
|
+
expect(echo).to_not be_nil
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'when the old fqdn has a trailing dot' do
|
110
|
+
let(:old_hostname) { 'oldhostname.withtrailing.dot.' }
|
111
|
+
|
112
|
+
it 'modifies /etc/hosts properly' do
|
113
|
+
original_etc_hosts = <<-ETC_HOSTS.gsub(/^ */, '')
|
114
|
+
127.0.0.1 localhost
|
115
|
+
127.0.1.1 oldhostname.withtrailing.dot. oldhostname
|
116
|
+
ETC_HOSTS
|
117
|
+
|
118
|
+
modified_etc_hosts = original_etc_hosts.gsub(search, replace)
|
119
|
+
|
120
|
+
expect(modified_etc_hosts).to eq <<-RESULT.gsub(/^ */, '')
|
121
|
+
127.0.0.1 localhost
|
122
|
+
127.0.1.1 newhostname.newdomain.tld newhostname
|
123
|
+
RESULT
|
124
|
+
end
|
125
|
+
end
|
124
126
|
end
|
125
|
-
end
|
126
127
|
end
|
127
|
-
end
|
128
128
|
end
|
@@ -2,39 +2,39 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe 'VagrantPlugins::GuestAlpine::Cap::ConfigureNetworks' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
5
|
+
let(:described_class) do
|
6
|
+
VagrantPlugins::GuestAlpine::Plugin.components.guest_capabilities[:alpine].get(:configure_networks)
|
7
|
+
end
|
8
|
+
let(:machine) { double('machine') }
|
9
|
+
let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
allow(machine).to receive(:communicate).and_return(communicator)
|
13
|
+
end
|
14
|
+
|
15
|
+
after do
|
16
|
+
communicator.verify_expectations!
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should configure networks' do
|
20
|
+
networks = [
|
21
|
+
{ type: :static, ip: '192.168.10.10', netmask: '255.255.255.0', interface: 0, name: 'eth0' },
|
22
|
+
{ type: :dhcp, interface: 1, name: 'eth1' }
|
23
|
+
]
|
24
|
+
|
25
|
+
expect(communicator).to receive(:sudo).with("sed -e '/^#VAGRANT-BEGIN/,$ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces.pre")
|
26
|
+
expect(communicator).to receive(:sudo).with("sed -ne '/^#VAGRANT-END/,$ p' /etc/network/interfaces | tail -n +2 > /tmp/vagrant-network-interfaces.post")
|
27
|
+
expect(communicator).to receive(:sudo).with('/sbin/ifdown eth0 2> /dev/null')
|
28
|
+
expect(communicator).to receive(:sudo).with('/sbin/ip addr flush dev eth0 2> /dev/null')
|
29
|
+
expect(communicator).to receive(:sudo).with('/sbin/ifdown eth1 2> /dev/null')
|
30
|
+
expect(communicator).to receive(:sudo).with('/sbin/ip addr flush dev eth1 2> /dev/null')
|
31
|
+
expect(communicator).to receive(:sudo).with('cat /tmp/vagrant-network-interfaces.pre /tmp/vagrant-network-entry /tmp/vagrant-network-interfaces.post > /etc/network/interfaces')
|
32
|
+
expect(communicator).to receive(:sudo).with('rm -f /tmp/vagrant-network-interfaces.pre /tmp/vagrant-network-entry /tmp/vagrant-network-interfaces.post')
|
33
|
+
expect(communicator).to receive(:sudo).with('/sbin/ifup eth0')
|
34
|
+
expect(communicator).to receive(:sudo).with('/sbin/ifup eth1')
|
35
|
+
|
36
|
+
allow_message_expectations_on_nil
|
37
|
+
|
38
|
+
described_class.configure_networks(machine, networks)
|
39
|
+
end
|
40
40
|
end
|
data/spec/cap/halt_spec.rb
CHANGED
@@ -2,23 +2,23 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe 'VagrantPlugins::GuestAlpine::Cap::Halt' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
let(:described_class) do
|
6
|
+
VagrantPlugins::GuestAlpine::Plugin.components.guest_capabilities[:alpine].get(:halt)
|
7
|
+
end
|
8
|
+
let(:machine) { double('machine') }
|
9
|
+
let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
before do
|
12
|
+
allow(machine).to receive(:communicate).and_return(communicator)
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
after do
|
16
|
+
communicator.verify_expectations!
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
it 'should halt guest' do
|
20
|
+
expect(communicator).to receive(:sudo).with('poweroff')
|
21
|
+
allow_message_expectations_on_nil
|
22
|
+
described_class.halt(machine)
|
23
|
+
end
|
24
24
|
end
|
data/spec/cap/nfs_client_spec.rb
CHANGED
@@ -2,27 +2,59 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe 'VagrantPlugins::GuestAlpine::Cap::NFSClient' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
let(:machine) { double('machine') }
|
9
|
-
let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
5
|
+
let(:described_class) do
|
6
|
+
VagrantPlugins::GuestAlpine::Plugin.components.guest_capabilities[:alpine].get(:nfs_client_install)
|
7
|
+
end
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
9
|
+
let(:machine) { double('machine') }
|
10
|
+
let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
before do
|
13
|
+
allow(machine).to receive(:communicate).and_return(communicator)
|
14
|
+
end
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
communicator.should_receive(:sudo).with('rc-update add rpc.statd')
|
23
|
-
communicator.should_receive(:sudo).with('rc-service rpc.statd start')
|
16
|
+
after do
|
17
|
+
communicator.verify_expectations!
|
18
|
+
end
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
it 'should install nfs client' do
|
21
|
+
x = <<-EOS.gsub(/^\s+\|\s?/, '')
|
22
|
+
| # work around defunct repository in configuration
|
23
|
+
| # box: maier/apline-3.3
|
24
|
+
| repo_file="/etc/apk/repositories"
|
25
|
+
| if [ $(grep -c "repos.dfw.lax-noc.com" $repo_file) -ne 0 ]; then
|
26
|
+
| repo_file_bak="${repo_file}.orig"
|
27
|
+
| echo "updating repositories"
|
28
|
+
| cp $repo_file $repo_file_bak
|
29
|
+
| sed -e 's/repos.dfw.lax-noc.com/dl-cdn.alpinelinux.org/' $repo_file_bak > $repo_file
|
30
|
+
| fi
|
31
|
+
|
|
32
|
+
| echo "updating repository indices"
|
33
|
+
| apk update
|
34
|
+
| if [ $? -ne 0 ]; then
|
35
|
+
| exit 1
|
36
|
+
| fi
|
37
|
+
|
|
38
|
+
| echo "installing nfs-utils"
|
39
|
+
| apk add --upgrade nfs-utils
|
40
|
+
| if [ $? -ne 0 ]; then
|
41
|
+
| exit 1
|
42
|
+
| fi
|
43
|
+
|
|
44
|
+
| echo "installing rpc.statd"
|
45
|
+
| rc-update add rpc.statd
|
46
|
+
| if [ $? -ne 0 ]; then
|
47
|
+
| exit 1
|
48
|
+
| fi
|
49
|
+
|
|
50
|
+
| echo "starting rpc.statd service"
|
51
|
+
| rc-service rpc.statd start
|
52
|
+
| if [ $? -ne 0 ]; then
|
53
|
+
| exit 1
|
54
|
+
| fi
|
55
|
+
EOS
|
56
|
+
expect(communicator).to receive(:sudo).with(x)
|
57
|
+
allow_message_expectations_on_nil
|
58
|
+
described_class.nfs_client_install(machine)
|
59
|
+
end
|
28
60
|
end
|
data/spec/cap/rsync_spec.rb
CHANGED
@@ -2,34 +2,36 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe 'VagrantPlugins::GuestAlpine::Cap::RSync' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
5
|
+
let(:machine) { double('machine') }
|
6
|
+
let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
allow(machine).to receive(:communicate).and_return(communicator)
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
communicator.verify_expectations!
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:described_class) do
|
17
|
+
VagrantPlugins::GuestAlpine::Plugin.components.guest_capabilities[:alpine].get(:rsync_install)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should install rsync' do
|
21
|
+
# communicator.should_receive(:sudo).with('apk add rsync')
|
22
|
+
expect(communicator).to receive(:sudo).with('apk add rsync')
|
23
|
+
allow_message_expectations_on_nil
|
24
|
+
described_class.rsync_install(machine)
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:described_class) do
|
28
|
+
VagrantPlugins::GuestAlpine::Plugin.components.guest_capabilities[:alpine].get(:rsync_installed)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should verify rsync installed' do
|
32
|
+
# communicator.should_receive(:test).with('test -f /usr/bin/rsync')
|
33
|
+
expect(communicator).to receive(:test).with('test -f /usr/bin/rsync')
|
34
|
+
allow_message_expectations_on_nil
|
35
|
+
described_class.rsync_installed(machine)
|
36
|
+
end
|
35
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-alpine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- matt maier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.4.
|
136
|
+
rubygems_version: 2.4.8
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Enables Vagrant to manage Alpine Linux Guests.
|