kitchen-vagrant 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/kitchen-vagrant.gemspec +1 -1
- data/lib/kitchen/driver/vagrant.rb +28 -19
- data/lib/kitchen/driver/vagrant_version.rb +1 -1
- metadata +6 -6
data/CHANGELOG.md
CHANGED
data/kitchen-vagrant.gemspec
CHANGED
@@ -17,7 +17,7 @@ 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 'test-kitchen', '~> 1.0.0.alpha.
|
20
|
+
gem.add_dependency 'test-kitchen', '~> 1.0.0.alpha.2'
|
21
21
|
|
22
22
|
gem.add_development_dependency 'cane'
|
23
23
|
gem.add_development_dependency 'tailor'
|
@@ -39,45 +39,40 @@ module Kitchen
|
|
39
39
|
no_parallel_for :create, :destroy
|
40
40
|
|
41
41
|
def create(state)
|
42
|
-
|
43
|
-
create_vagrantfile(state)
|
42
|
+
create_vagrantfile
|
44
43
|
run "vagrant up --no-provision"
|
45
|
-
|
44
|
+
set_ssh_state(state)
|
45
|
+
info("Vagrant instance #{instance.to_str} created.")
|
46
46
|
end
|
47
47
|
|
48
48
|
def converge(state)
|
49
|
-
create_vagrantfile
|
49
|
+
create_vagrantfile
|
50
50
|
ssh_args = build_ssh_args(state)
|
51
51
|
install_omnibus(ssh_args) if config[:require_chef_omnibus]
|
52
52
|
run "vagrant provision"
|
53
53
|
end
|
54
54
|
|
55
55
|
def setup(state)
|
56
|
-
create_vagrantfile
|
56
|
+
create_vagrantfile
|
57
57
|
super
|
58
58
|
end
|
59
59
|
|
60
60
|
def verify(state)
|
61
|
-
create_vagrantfile
|
61
|
+
create_vagrantfile
|
62
62
|
super
|
63
63
|
end
|
64
64
|
|
65
65
|
def destroy(state)
|
66
66
|
return if state[:hostname].nil?
|
67
67
|
|
68
|
-
create_vagrantfile
|
68
|
+
create_vagrantfile
|
69
69
|
@vagrantfile_created = false
|
70
70
|
run "vagrant destroy -f"
|
71
71
|
FileUtils.rm_rf(vagrant_root)
|
72
|
-
info("Vagrant instance
|
72
|
+
info("Vagrant instance #{instance.to_str} destroyed.")
|
73
73
|
state.delete(:hostname)
|
74
74
|
end
|
75
75
|
|
76
|
-
def login_command(state)
|
77
|
-
create_vagrantfile(state)
|
78
|
-
LoginCommand.new(%W{vagrant ssh}, :chdir => vagrant_root)
|
79
|
-
end
|
80
|
-
|
81
76
|
def verify_dependencies
|
82
77
|
check_vagrant_version
|
83
78
|
check_berkshelf_plugin
|
@@ -88,10 +83,6 @@ module Kitchen
|
|
88
83
|
WEBSITE = "http://downloads.vagrantup.com/"
|
89
84
|
MIN_VER = "1.1.0"
|
90
85
|
|
91
|
-
def ssh(ssh_args, cmd)
|
92
|
-
run %{vagrant ssh --command '#{cmd}'}
|
93
|
-
end
|
94
|
-
|
95
86
|
def run(cmd, options = {})
|
96
87
|
cmd = "echo #{cmd}" if config[:dry_run]
|
97
88
|
run_command(cmd, { :cwd => vagrant_root }.merge(options))
|
@@ -108,11 +99,11 @@ module Kitchen
|
|
108
99
|
)
|
109
100
|
end
|
110
101
|
|
111
|
-
def create_vagrantfile
|
102
|
+
def create_vagrantfile
|
112
103
|
return if @vagrantfile_created
|
113
104
|
|
114
105
|
vagrantfile = File.join(vagrant_root, "Vagrantfile")
|
115
|
-
debug("Creating Vagrantfile for
|
106
|
+
debug("Creating Vagrantfile for #{instance.to_str} (#{vagrantfile})")
|
116
107
|
FileUtils.mkdir_p(vagrant_root)
|
117
108
|
File.open(vagrantfile, "wb") { |f| f.write(creator.render) }
|
118
109
|
@vagrantfile_created = true
|
@@ -122,6 +113,24 @@ module Kitchen
|
|
122
113
|
Kitchen::Vagrant::VagrantfileCreator.new(instance, config)
|
123
114
|
end
|
124
115
|
|
116
|
+
def set_ssh_state(state)
|
117
|
+
hash = vagrant_ssh_config
|
118
|
+
|
119
|
+
state[:hostname] = hash["HostName"]
|
120
|
+
state[:username] = hash["User"]
|
121
|
+
state[:ssh_key] = hash["IdentityFile"]
|
122
|
+
state[:port] = hash["Port"]
|
123
|
+
end
|
124
|
+
|
125
|
+
def vagrant_ssh_config
|
126
|
+
output = run("vagrant ssh-config", :live_stream => nil)
|
127
|
+
lines = output.split("\n").map do |line|
|
128
|
+
tokens = line.strip.partition(" ")
|
129
|
+
[tokens.first, tokens.last.gsub(/"/, '')]
|
130
|
+
end
|
131
|
+
Hash[lines]
|
132
|
+
end
|
133
|
+
|
125
134
|
def vagrant_version
|
126
135
|
version_string = silently_run("vagrant --version")
|
127
136
|
version_string = version_string.chomp.split(" ").last
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-vagrant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-kitchen
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.0.0.alpha.
|
21
|
+
version: 1.0.0.alpha.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.0.0.alpha.
|
29
|
+
version: 1.0.0.alpha.2
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: cane
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
segments:
|
109
109
|
- 0
|
110
|
-
hash:
|
110
|
+
hash: 1825624288279070212
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
none: false
|
113
113
|
requirements:
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
version: '0'
|
117
117
|
segments:
|
118
118
|
- 0
|
119
|
-
hash:
|
119
|
+
hash: 1825624288279070212
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
122
|
rubygems_version: 1.8.24
|