cucumber-chef 3.0.0.rc.5 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,7 +47,7 @@ module Cucumber
47
47
  wait_for_chef_server
48
48
 
49
49
  download_chef_credentials
50
- download_proxy_ssh_credentials
50
+ download_ssh_credentials
51
51
 
52
52
  reboot_test_lab
53
53
  end
@@ -71,11 +71,11 @@ module Cucumber
71
71
  # if it is not in place mkdir fails with Net::SFTP::StatusException on
72
72
  # the Net::SFTP mkdir internal call triggered by a Net::SFTP upload
73
73
  # call
74
- @test_lab.bootstrap_ssh.exec(%(rm -rf #{remote_path}))
74
+ @test_lab.bootstrap_ssh.exec(%(sudo rm -vrf #{remote_path}), :silence => true)
75
75
  begin
76
76
  @test_lab.bootstrap_ssh.upload(local_path, remote_path)
77
77
  rescue Net::SFTP::StatusException => e
78
- @test_lab.bootstrap_ssh.exec(%(mkdir -p #{remote_path}))
78
+ @test_lab.bootstrap_ssh.exec(%(mkdir -vp #{remote_path}), :silence => true)
79
79
  retry
80
80
  end
81
81
  end
@@ -87,44 +87,55 @@ module Cucumber
87
87
  raise ProvisionerError, "You must have the environment variable 'USER' set." if !Cucumber::Chef::Config.user
88
88
 
89
89
  ZTK::Benchmark.bench(:message => "Bootstrapping #{Cucumber::Chef::Config.provider.upcase} instance", :mark => "completed in %0.4f seconds.", :ui => @ui) do
90
- chef_client_attributes = if Cucumber::Chef.chef_pre_11
90
+
91
+ chef_solo_attributes = case Cucumber::Chef.chef_pre_11
92
+ when true then
91
93
  {
92
- "run_list" => %w(role[test_lab] recipe[chef-server::default] recipe[chef-server::apache-proxy] recipe[chef-client]),
93
- "cucumber_chef" => {
94
- "version" => Cucumber::Chef::VERSION,
95
- "prerelease" => Cucumber::Chef::Config.prerelease,
96
- "lab_user" => Cucumber::Chef.lab_user,
97
- "lxc_user" => Cucumber::Chef.lxc_user
98
- },
99
94
  "chef-server" => {
100
95
  "webui_enabled" => true
101
- }
96
+ },
97
+ "run_list" => %w(recipe[chef-server::rubygems-install] recipe[chef-server::apache-proxy] role[test_lab])
102
98
  }
103
- else
99
+ when false then
104
100
  {
105
- "run_list" => %w(role[test_lab]),
106
- "cucumber_chef" => {
107
- "version" => Cucumber::Chef::VERSION,
108
- "prerelease" => Cucumber::Chef::Config.prerelease,
109
- "lab_user" => Cucumber::Chef.lab_user,
110
- "lxc_user" => Cucumber::Chef.lxc_user
111
- }
101
+ "chef-server" => {
102
+ "nginx" => {
103
+ "enable_non_ssl" => true,
104
+ "server_name" => "localhost",
105
+ "url" => "http://localhost"
106
+ },
107
+ "chef_server_webui" => {
108
+ "enable" => true
109
+ }
110
+ },
111
+ "run_list" => %w(recipe[chef-server::default] role[test_lab])
112
112
  }
113
113
  end
114
114
 
115
+ chef_solo_attributes.merge!(
116
+ "cucumber_chef" => {
117
+ "version" => Cucumber::Chef::VERSION,
118
+ "prerelease" => Cucumber::Chef::Config.prerelease,
119
+ "lab_user" => Cucumber::Chef.lab_user,
120
+ "lxc_user" => Cucumber::Chef.lxc_user
121
+ }
122
+ )
123
+
115
124
  context = {
116
- :chef_client_attributes => chef_client_attributes,
117
- :amqp_password => Cucumber::Chef::Config.chef[:amqp_password],
118
- :admin_password => Cucumber::Chef::Config.chef[:admin_password],
125
+ :lab_user => Cucumber::Chef.lab_user,
126
+ :chef_pre_11 => Cucumber::Chef.chef_pre_11,
127
+ :chef_solo_attributes => chef_solo_attributes,
128
+ :chef_version => Cucumber::Chef::Config.chef[:version],
129
+ :chef_validator => (Cucumber::Chef.chef_pre_11 ? '/etc/chef/validation.pem' : '/etc/chef-server/chef-validator.pem'),
130
+ :chef_webui => (Cucumber::Chef.chef_pre_11 ? '/etc/chef/webui.pem' : '/etc/chef-server/chef-webui.pem'),
131
+ :chef_admin => (Cucumber::Chef.chef_pre_11 ? '/etc/chef/admin.pem' : '/etc/chef-server/admin.pem'),
132
+ :default_password => Cucumber::Chef::Config.chef[:default_password],
119
133
  :user => Cucumber::Chef::Config.user,
120
134
  :hostname_short => Cucumber::Chef.lab_hostname_short,
121
- :hostname_full => Cucumber::Chef.lab_hostname_full,
122
- :chef_server_version => Cucumber::Chef::Config.chef[:server_version],
123
- :chef_client_version => Cucumber::Chef::Config.chef[:client_version]
135
+ :hostname_full => Cucumber::Chef.lab_hostname_full
124
136
  }
125
137
 
126
- bootstrap_template_file = (Cucumber::Chef.chef_pre_11 ? 'ubuntu-precise-apt.erb' : 'ubuntu-precise-omnibus.erb')
127
- bootstrap_template = File.join(Cucumber::Chef.root_dir, "lib", "cucumber", "chef", "templates", "bootstrap", bootstrap_template_file)
138
+ bootstrap_template = File.join(Cucumber::Chef.root_dir, "lib", "cucumber", "chef", "templates", "bootstrap", "ubuntu-precise-omnibus.erb")
128
139
 
129
140
  local_bootstrap_file = Tempfile.new("bootstrap")
130
141
  local_bootstrap_filename = local_bootstrap_file.path
@@ -145,11 +156,11 @@ module Cucumber
145
156
  ################################################################################
146
157
 
147
158
  def download_chef_credentials
148
- ZTK::Benchmark.bench(:message => "Downloading chef-server credentials", :mark => "completed in %0.4f seconds.", :ui => @ui) do
159
+ ZTK::Benchmark.bench(:message => "Downloading chef credentials", :mark => "completed in %0.4f seconds.", :ui => @ui) do
149
160
  local_path = File.dirname(Cucumber::Chef.chef_identity)
150
161
  @ui.logger.debug { "local_path == #{local_path.inspect}" }
151
162
 
152
- remote_path = File.join(Cucumber::Chef.lab_user_home_dir, ".chef")
163
+ remote_path = File.join(Cucumber::Chef.bootstrap_user_home_dir, ".chef")
153
164
  @ui.logger.debug { "remote_path == #{remote_path.inspect}" }
154
165
 
155
166
  files = [ File.basename(Cucumber::Chef.chef_identity) ]
@@ -168,48 +179,35 @@ module Cucumber
168
179
 
169
180
  ################################################################################
170
181
 
171
- def download_proxy_ssh_credentials
172
- ZTK::Benchmark.bench(:message => "Downloading proxy SSH credentials", :mark => "completed in %0.4f seconds.", :ui => @ui) do
182
+ def download_ssh_credentials
183
+ ZTK::Benchmark.bench(:message => "Downloading SSH credentials", :mark => "completed in %0.4f seconds.", :ui => @ui) do
173
184
  local_path = File.join(Cucumber::Chef.home_dir, Cucumber::Chef::Config.provider.to_s)
174
- remote_path = File.join(Cucumber::Chef.lab_user_home_dir, ".ssh")
175
-
176
- files = { "id_rsa" => "id_rsa-#{@test_lab.bootstrap_ssh.config.user}" }
177
- files.each do |remote_file, local_file|
178
- local = File.join(local_path, local_file)
179
- File.exists?(local) and File.delete(local)
180
- @test_lab.bootstrap_ssh.download(File.join(remote_path, remote_file), local)
181
- File.chmod(0600, local)
182
- end
183
- end
184
- end
185
185
 
186
- ################################################################################
186
+ users = {
187
+ Cucumber::Chef.lab_user => Cucumber::Chef.lab_user_home_dir,
188
+ Cucumber::Chef.lxc_user => Cucumber::Chef.lxc_user_home_dir
189
+ }
187
190
 
188
- def chef_first_run
189
- ZTK::Benchmark.bench(:message => "Performing chef-client run", :mark => "completed in %0.4f seconds.", :ui => @ui) do
190
- log_level = (ENV['LOG_LEVEL'].downcase rescue (Cucumber::Chef.is_rc? ? "debug" : "info"))
191
+ users.each do |username, home_dir|
192
+ identity_file = File.join(home_dir, ".ssh", "id_rsa")
193
+ temp_file = File.join("/tmp", "id_rsa-#{username}")
194
+ local_file = File.join(local_path, "id_rsa-#{username}")
191
195
 
192
- command = "/usr/bin/chef-client -j /etc/chef/first-boot.json --log_level #{log_level} --once"
193
- command = "sudo #{command}"
194
- @test_lab.bootstrap_ssh.exec(command, :silence => true)
196
+ @test_lab.bootstrap_ssh.exec(%(sudo cp -v #{identity_file} #{temp_file}), :silence => true)
197
+ @test_lab.bootstrap_ssh.exec(%(sudo chown -v #{Cucumber::Chef.bootstrap_user}:#{Cucumber::Chef.bootstrap_user} #{temp_file}), :silence => true)
198
+
199
+ File.exists?(local_file) and File.delete(local_file)
200
+ @test_lab.bootstrap_ssh.download(temp_file, local_file)
201
+ File.chmod(0600, local_file)
202
+ end
195
203
  end
196
204
  end
197
205
 
198
206
  ################################################################################
199
207
 
200
208
  def wait_for_chef_server
201
- if (Cucumber::Chef.chef_pre_11 == true)
202
- ZTK::Benchmark.bench(:message => "Waiting for the chef-server", :mark => "completed in %0.4f seconds.", :ui => @ui) do
203
- ZTK::TCPSocketCheck.new(:host => @test_lab.ip, :port => 4000, :data => "GET", :wait => 120).wait
204
- end
205
-
206
- ZTK::Benchmark.bench(:message => "Waiting for the chef-server-webui", :mark => "completed in %0.4f seconds.", :ui => @ui) do
207
- ZTK::TCPSocketCheck.new(:host => @test_lab.ip, :port => 4040, :data => "GET", :wait => 120).wait
208
- end
209
- else
210
- ZTK::Benchmark.bench(:message => "Waiting for the chef-server nginx daemon", :mark => "completed in %0.4f seconds.", :ui => @ui) do
211
- ZTK::TCPSocketCheck.new(:host => @test_lab.ip, :port => 80, :data => "GET", :wait => 120).wait
212
- end
209
+ ZTK::Benchmark.bench(:message => "Waiting for the chef-server-api HTTPS", :mark => "responded after %0.4f seconds.", :ui => @ui) do
210
+ ZTK::TCPSocketCheck.new(:host => @test_lab.ip, :port => 443, :data => "GET", :wait => 120).wait
213
211
  end
214
212
  end
215
213
 
@@ -1,80 +1,96 @@
1
1
  #!/bin/env bash
2
2
  #
3
- # Cucumber-Chef 'Chef >= 11.0.0' Bootstrap Script
3
+ # Cucumber-Chef v<%= Cucumber::Chef::VERSION %> Bootstrap Script
4
4
  #
5
5
  # Generated <%= Time.now.utc %>
6
6
  #
7
7
  set -x
8
+ export DEBIAN_FRONTEND="noninteractive"
9
+ CHEF_SOLO_ROOT="/tmp/chef-solo"
10
+ KNIFE_CONFIG_EXP_FILE="/tmp/knife-config.exp"
11
+ cd ${CHEF_SOLO_ROOT}
8
12
 
9
- CUCUMBER_CHEF_BOOTSTRAP_DONE="/.cucumber-chef-bootstrap-finished"
10
- # [ -f ${CUCUMBER_CHEF_BOOTSTRAP_DONE} ] && echo "Already bootstrapped!" && exit
11
-
12
- export DEBIAN_FRONTEND=noninteractive
13
- cd /tmp
13
+ grep "<%= @lab_user %>" /etc/sudoers
14
+ if [ $? -eq 1 ]; then
15
+ echo "<%= @lab_user %> ALL=(ALL) NOPASSWD:ALL" | tee -a /etc/sudoers
16
+ fi
14
17
 
15
18
  echo "127.0.0.1 <%= @hostname_full %> <%= @hostname_short %>" | tee -a /etc/hosts
16
19
  echo "<%= @hostname_full %>" | tee /etc/hostname
17
20
  hostname <%= @hostname_full %>
18
21
 
19
22
  apt-get -y --force-yes update
23
+ apt-get -y --force-yes install build-essential expect
24
+
25
+ mkdir -pv /etc/chef /var/log/chef ${HOME}/.chef
26
+
27
+ cat <<EOF | tee /etc/chef/solo.rb
28
+ file_cache_path "${CHEF_SOLO_ROOT}/"
29
+ cookbook_path %w(${CHEF_SOLO_ROOT}/cookbooks/ ${CHEF_SOLO_ROOT}/site-cookbooks/)
30
+ role_path "${CHEF_SOLO_ROOT}/roles/"
31
+ EOF
32
+
33
+ cat <<EOF | tee ${CHEF_SOLO_ROOT}/attributes.json
34
+ <%= @chef_solo_attributes.to_json %>
35
+ EOF
36
+
37
+ wget -v http://www.opscode.com/chef/install.sh
38
+ bash install.sh -v <%= @chef_version %>
39
+ <% if (@chef_pre_11 == false) -%>
40
+
41
+ mkdir -pv /var/chef/cache ${CHEF_SOLO_ROOT}/cookbooks/chef-server
42
+ wget -qO- https://github.com/opscode-cookbooks/chef-server/archive/master.tar.gz | tar xvzC ${CHEF_SOLO_ROOT}/cookbooks/chef-server --strip-components=1
43
+ <% else -%>
20
44
 
21
- cat <<EOF > /tmp/chef-server.json
22
- {
23
- "chef-server": {
24
- "version": "<%= @chef_server_version %>",
25
- "nginx": {
26
- "enable_non_ssl": true,
27
- "server_name": "localhost",
28
- "url": "http://localhost"
29
- },
30
- "chef_server_webui": {
31
- "enable": true
32
- }
33
- },
34
- "run_list": [ "recipe[chef-server::default]" ]
35
- }
45
+ export PATH=/opt/chef/embedded/bin:$PATH
46
+
47
+ cat <<EOF | tee ${CHEF_SOLO_ROOT}/Gemfile
48
+ source 'https://rubygems.org'
49
+ gem 'chef', '<%= @chef_version %>'
50
+ gem 'berkshelf'
51
+ gem 'moneta', '< 0.7.0'
52
+ EOF
53
+
54
+ cat <<EOF | tee ${CHEF_SOLO_ROOT}/Berksfile
55
+ site :opscode
56
+ cookbook 'chef-server'
36
57
  EOF
37
58
 
38
- wget http://www.opscode.com/chef/install.sh
39
- bash install.sh -v <%= @chef_client_version %>
40
- mkdir -p /var/chef/cache /var/chef/cookbooks/chef-server
41
- wget -qO- https://github.com/opscode-cookbooks/chef-server/archive/master.tar.gz | tar xvzC /var/chef/cookbooks/chef-server --strip-components=1
42
- chef-solo -j /tmp/chef-server.json
59
+ gem install bundler --no-ri --no-rdoc
60
+ bundle install --standalone --path vendor/bundle --binstubs
61
+ mv -v ${CHEF_SOLO_ROOT}/cookbooks ${CHEF_SOLO_ROOT}/site-cookbooks
62
+ bin/berks install --path ${CHEF_SOLO_ROOT}/cookbooks/
63
+ <% end -%>
43
64
 
44
- echo -n "Waiting on chef-validator.pem and chef-webui.pem to appear..."
45
- until [ -f /etc/chef-server/chef-validator.pem ] && [ -f /etc/chef-server/chef-webui.pem ]; do
65
+ chef-solo --config /etc/chef/solo.rb --json-attributes ${CHEF_SOLO_ROOT}/attributes.json --logfile /var/log/chef/chef-solo.log --log_level debug
66
+
67
+ echo -n "Waiting on <%= File.basename(@chef_validator) %> and <%= File.basename(@chef_webui) %> to appear..."
68
+ until [ -f <%= @chef_validator %> ] && [ -f <%= @chef_webui %> ]; do
46
69
  echo -n "."
47
70
  sleep 1
48
71
  done
49
72
  echo "done."
50
73
 
51
- ln -s /etc/chef-server/chef-validator.pem /etc/chef/validation.pem
52
- ln -s /etc/chef-server/admin.pem /etc/chef/admin.pem
74
+ cp -v <%= @chef_validator %> <%= @chef_webui %> ~/.chef
53
75
 
54
- mkdir -p ~/.chef
55
- cp /etc/chef-server/chef-validator.pem /etc/chef-server/chef-webui.pem ~/.chef
76
+ <% if (@chef_pre_11 == false) -%>
77
+ ln -sv <%= @chef_validator %> /etc/chef/validation.pem
78
+ ln -sv <%= @chef_admin %> /etc/chef/admin.pem
79
+ <% end -%>
56
80
 
57
- apt-get -y --force-yes install expect
58
- KNIFE_CONFIG_EXP_FILE="/tmp/knife-config.exp"
59
- cat <<EOF > ${KNIFE_CONFIG_EXP_FILE}
81
+ cat <<EOF | tee ${KNIFE_CONFIG_EXP_FILE}
60
82
  #!/usr/bin/expect -f
61
83
  set timeout 10
62
- spawn knife configure -i --server-url https://127.0.0.1 --admin-client-key /etc/chef-server/admin.pem -u ${SUDO_USER} -r '' --defaults --yes -VV
63
- expect "Please enter a password for the new user:" { send "p@ssw0rd1\n" }
84
+ <% if (@chef_pre_11 == false) -%>
85
+ spawn knife configure -i --server-url https://127.0.0.1 --admin-client-key <%= @chef_admin %> -u ${SUDO_USER} -r '' --defaults --yes -VV
86
+ <% else -%>
87
+ spawn knife configure -i --server-url https://127.0.0.1 -u ${SUDO_USER} -r '' --defaults --yes -VV
88
+ <% end -%>
89
+ expect "Please enter a password for the new user:" { send "<%= @default_password %>\n" }
64
90
  interact
65
91
  EOF
66
92
  chmod +x ${KNIFE_CONFIG_EXP_FILE}
67
93
  ${KNIFE_CONFIG_EXP_FILE}
68
94
 
69
95
  knife client create <%= @user %> -a -f ${HOME}/.chef/<%= @user %>.pem --disable-editing --yes -VV
70
- chown -R ${SUDO_USER}:${SUDO_USER} ${HOME}
71
-
72
- knife cookbook upload --all --cookbook-path /tmp/chef-solo/cookbooks --force --yes -VV
73
- knife role from file /tmp/chef-solo/roles/*.rb --yes -VV
74
-
75
- cat <<EOF > /etc/chef/bootstrap-chef-client.json
76
- <%= @chef_client_attributes.to_json %>
77
- EOF
78
- chef-client -j /etc/chef/bootstrap-chef-client.json --validation_key /etc/chef-server/chef-validator.pem --server https://127.0.0.1
79
-
80
- touch ${CUCUMBER_CHEF_BOOTSTRAP_DONE}
96
+ chown -Rv ${SUDO_USER}:${SUDO_USER} ${HOME}
@@ -0,0 +1,32 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+ #
4
+ # Auto-generated by cucumber-chef v#{Cucumber::Chef::VERSION} on #{Time.now.utc} -- DO NOT EDIT!
5
+
6
+ # Vagrant v1 Configuration
7
+ ###########################
8
+ Vagrant::Config.run do |config|
9
+ config.vm.define "test-lab-#{ENV['USER']}".downcase do |test_lab|
10
+ test_lab.vm.box = "precise64"
11
+ test_lab.vm.box_url = "http://files.vagrantup.com/precise64.box"
12
+ test_lab.vm.network :hostonly, "<%= @ip %>"
13
+
14
+ test_lab.vm.customize ["modifyvm", :id, "--cpus", <%= @cpus %>]
15
+ test_lab.vm.customize ["modifyvm", :id, "--memory", <%= @memory %>]
16
+ end
17
+ end
18
+
19
+ # Vagrant v2 Configuration
20
+ ###########################
21
+ Vagrant.configure("2") do |config|
22
+ config.vm.define "test-lab-#{ENV['USER']}".downcase do |test_lab|
23
+ test_lab.vm.box = "precise64"
24
+ test_lab.vm.box_url = "http://files.vagrantup.com/precise64.box"
25
+ test_lab.vm.network :private_network, :ip => "<%= @ip %>"
26
+
27
+ test_lab.vm.provider :virtualbox do |vb|
28
+ vb.customize ["modifyvm", :id, "--cpus", <%= @cpus %>]
29
+ vb.customize ["modifyvm", :id, "--memory", <%= @memory %>]
30
+ end
31
+ end
32
+ end
@@ -1,39 +1,29 @@
1
- ################################################################################
2
- # Cucumber-Chef
3
- ################################################################################
1
+ # If you want to customize configuration options do so here:
2
+
3
+ # provider :vagrant
4
+
5
+ # vagrant.merge!( :identity_file => "#{ENV['HOME']}/.vagrant.d/insecure_private_key",
6
+ # :ssh => {
7
+ # :lab_ip => "192.168.33.10",
8
+ # :lab_port => 22,
9
+ # :lxc_port => 22
10
+ # },
11
+ # :cpus => 4,
12
+ # :memory => 4096 )
13
+
14
+ # aws.merge!( :identity_file => ENV['AWS_IDENTITY'],
15
+ # :ssh => {
16
+ # :lab_port => 22,
17
+ # :lxc_port => 22
18
+ # },
19
+ # :aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
20
+ # :aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
21
+ # :aws_ssh_key_id => ENV['AWS_SSH_KEY_ID'],
22
+ # :region => "us-west-2",
23
+ # :availability_zone => "us-west-2a",
24
+ # :aws_instance_arch => "i386",
25
+ # :aws_instance_type => "c1.medium" )
26
+
27
+ # artifacts ({ "chef-client-log" => "/var/log/chef/client.log",
28
+ # "chef-client-stacktrace" => "/var/chef/cache/chef-stacktrace.out" })
4
29
 
5
- provider :aws
6
- librarian_chef <%= @librarian_chef %>
7
- lxc_user "root"
8
- lab_user "ubuntu"
9
- prerelease <%= @is_rc %>
10
-
11
- artifacts ({ "chef-client-log" => "/var/log/chef/client.log",
12
- "chef-client-stacktrace" => "/var/chef/cache/chef-stacktrace.out" })
13
-
14
-
15
- ################################################################################
16
- # Provider: AWS
17
- ################################################################################
18
-
19
- aws[:aws_access_key_id] = "<%= @aws_access_key %>"
20
- aws[:aws_secret_access_key] = "<%= @aws_secret_access_key %>"
21
-
22
- aws[:aws_ssh_key_id] = "<%= @aws_ssh_id %>"
23
- aws[:identity_file] = "<%= File.join(@aws_ssh_key_dir, @aws_ssh_key) %>"
24
-
25
- aws[:region] = "<%= @region %>-1"
26
- aws[:availability_zone] = "<%= @region %>-1a"
27
-
28
- #aws[:aws_instance_arch] = "i386"
29
- #aws[:aws_instance_disk_store] = "instance-store"
30
- #aws[:aws_instance_type] = "m1.small"
31
-
32
- #aws[:aws_security_group] = "cucumber-chef"
33
-
34
-
35
- ################################################################################
36
- # Provider: Vagrant
37
- ################################################################################
38
-
39
- # TODO
@@ -87,7 +87,8 @@ module Cucumber
87
87
  ################################################################################
88
88
 
89
89
  def chef_pre_11
90
- (Cucumber::Chef::Config.chef[:server_version].to_f < 11.0)
90
+ return false if (Cucumber::Chef::Config.chef[:version].downcase == "latest")
91
+ (Cucumber::Chef::Config.chef[:version].to_f < 11.0)
91
92
  end
92
93
 
93
94
  ################################################################################
@@ -173,7 +174,12 @@ module Cucumber
173
174
  ################################################################################
174
175
 
175
176
  def bootstrap_user
176
- Cucumber::Chef::Config[Cucumber::Chef::Config.provider][:lab_user]
177
+ Cucumber::Chef::Config[Cucumber::Chef::Config.provider][:bootstrap_user]
178
+ end
179
+
180
+ def bootstrap_user_home_dir
181
+ user = Cucumber::Chef::Config[Cucumber::Chef::Config.provider][:bootstrap_user]
182
+ ((user == "root") ? "/root" : "/home/#{user}")
177
183
  end
178
184
 
179
185
  def bootstrap_identity
@@ -201,6 +207,10 @@ module Cucumber
201
207
  lab_identity
202
208
  end
203
209
 
210
+ def lab_ip
211
+ Cucumber::Chef::Config[Cucumber::Chef::Config.provider][:ssh][:lab_ip]
212
+ end
213
+
204
214
  def lab_ssh_port
205
215
  Cucumber::Chef::Config[Cucumber::Chef::Config.provider][:ssh][:lab_port]
206
216
  end
@@ -227,7 +237,7 @@ module Cucumber
227
237
  end
228
238
 
229
239
  def lxc_identity
230
- lxc_identity = File.join(Cucumber::Chef.home_dir, Cucumber::Chef::Config.provider.to_s, "id_rsa-#{lab_user}")
240
+ lxc_identity = File.join(Cucumber::Chef.home_dir, Cucumber::Chef::Config.provider.to_s, "id_rsa-#{lxc_user}")
231
241
  File.exists?(lxc_identity) && File.chmod(0400, lxc_identity)
232
242
  lxc_identity
233
243
  end