kitchen-vagrant 0.7.3 → 0.7.4

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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.7.4 / 2013-03-28
2
+
3
+ ### Improvements
4
+
5
+ * Drop `vagrant ssh -c` & communicate directly via SSH. ([@fnichol][])
6
+
7
+
1
8
  ## 0.7.3 / 2013-03-28
2
9
 
3
10
  ### Bug fixes
@@ -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.1'
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
- state[:hostname] = instance.name
43
- create_vagrantfile(state)
42
+ create_vagrantfile
44
43
  run "vagrant up --no-provision"
45
- info("Vagrant instance <#{state[:hostname]}> created.")
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(state)
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(state)
56
+ create_vagrantfile
57
57
  super
58
58
  end
59
59
 
60
60
  def verify(state)
61
- create_vagrantfile(state)
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(state)
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 <#{state[:hostname]}> destroyed.")
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(state)
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 <#{state[:hostname]}> (#{vagrantfile})")
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
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for Vagrant Kitchen driver
24
- VAGRANT_VERSION = "0.7.3"
24
+ VAGRANT_VERSION = "0.7.4"
25
25
  end
26
26
  end
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.3
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-28 00:00:00.000000000 Z
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.1
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.1
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: -151733166854554987
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: -151733166854554987
119
+ hash: 1825624288279070212
120
120
  requirements: []
121
121
  rubyforge_project:
122
122
  rubygems_version: 1.8.24