lib/testlab/user/lifecycle.rb in testlab-0.6.2 vs lib/testlab/user/lifecycle.rb in testlab-0.6.3
- old
+ new
@@ -10,14 +10,10 @@
@ui.logger.debug { "User Create: #{self.id} " }
node_home_dir = ((self.container.node.user == "root") ? %(/root) : %(/home/#{self.container.node.user}))
node_authkeys = File.join(node_home_dir, ".ssh", "authorized_keys")
- user_home_dir = File.join(self.container.lxc.fs_root, ((self.id == "root") ? %(/root) : %(/home/#{self.id})))
- user_authkeys = File.join(user_home_dir, ".ssh", "authorized_keys")
- user_authkeys2 = File.join(user_home_dir, ".ssh", "authorized_keys2")
-
# ensure the container user exists
container_passwd_file = File.join(self.container.lxc.fs_root, "etc", "passwd")
if self.container.node.ssh.exec(%(sudo grep "#{self.id}" #{container_passwd_file}), :ignore_exit_status => true).exit_code != 0
if !self.gid.nil?
@@ -33,9 +29,13 @@
self.container.node.ssh.exec(%(sudo chroot #{self.container.lxc.fs_root} /bin/bash -c '#{useradd_command}'))
end
# ensure the user user gets our node user key
+ user_home_dir = File.join(self.container.lxc.fs_root, ((self.id == "root") ? %(/root) : %(/home/#{self.id})))
+ user_authkeys = File.join(user_home_dir, ".ssh", "authorized_keys")
+ user_authkeys2 = File.join(user_home_dir, ".ssh", "authorized_keys2")
+
authkeys = {
node_authkeys => user_authkeys,
node_authkeys => user_authkeys2
}