testlab 0.6.14 → 0.6.15
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/lib/testlab/user/lifecycle.rb +17 -3
- data/lib/testlab/user.rb +1 -0
- data/lib/testlab/version.rb +1 -1
- metadata +7 -1
data/Gemfile
CHANGED
@@ -21,17 +21,18 @@ class TestLab
|
|
21
21
|
self.container.node.ssh.exec(%(sudo chroot #{self.container.fs_root} /bin/bash -c '#{groupadd_command}'))
|
22
22
|
end
|
23
23
|
|
24
|
-
useradd_command = %W(useradd --create-home --shell /bin/bash --groups sudo
|
24
|
+
useradd_command = %W(useradd --create-home --shell /bin/bash --groups sudo)
|
25
25
|
useradd_command << "--uid #{self.uid}" if !self.uid.nil?
|
26
26
|
useradd_command << "--gid #{self.gid}" if !self.gid.nil?
|
27
27
|
useradd_command << self.id
|
28
28
|
useradd_command = useradd_command.flatten.compact.join(' ')
|
29
29
|
|
30
|
-
self.container.
|
30
|
+
self.container.lxc.attach(%(-- /bin/bash -c '#{useradd_command}'))
|
31
|
+
self.container.lxc.attach(%(-- /bin/bash -c 'echo "#{self.id}:#{self.password}" | chpasswd'))
|
31
32
|
end
|
32
33
|
|
33
34
|
# ensure the user user gets our node user key
|
34
|
-
user_home_dir = File.join(self.container.fs_root,
|
35
|
+
user_home_dir = File.join(self.container.fs_root, self.home_dir)
|
35
36
|
user_authkeys = File.join(user_home_dir, ".ssh", "authorized_keys")
|
36
37
|
user_authkeys2 = File.join(user_home_dir, ".ssh", "authorized_keys2")
|
37
38
|
|
@@ -40,10 +41,23 @@ class TestLab
|
|
40
41
|
user_authkeys2 => node_authkeys
|
41
42
|
}
|
42
43
|
|
44
|
+
public_identities = Array.new
|
45
|
+
!self.public_identity.nil? and [self.public_identity].flatten.compact.each do |pi|
|
46
|
+
if File.exists?(pi)
|
47
|
+
public_identities << ::IO.read(pi).strip
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
43
51
|
authkeys.each do |destination, source|
|
44
52
|
@ui.logger.info { "SOURCE: #{source} >>> #{destination}" }
|
45
53
|
self.container.node.ssh.exec(%(sudo mkdir -pv #{File.dirname(destination)}))
|
54
|
+
|
46
55
|
self.container.node.ssh.exec(%(sudo grep "$(cat #{source})" #{destination} || sudo cat #{source} | sudo tee -a #{destination}))
|
56
|
+
|
57
|
+
public_identities.each do |pi|
|
58
|
+
self.container.node.ssh.exec(%(sudo grep "#{pi}" #{destination} || sudo echo "#{pi}" | sudo tee -a #{destination}))
|
59
|
+
end
|
60
|
+
|
47
61
|
self.container.node.ssh.exec(%(sudo chmod -v 644 #{destination}))
|
48
62
|
end
|
49
63
|
|
data/lib/testlab/user.rb
CHANGED
data/lib/testlab/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -301,12 +301,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
301
301
|
- - ! '>='
|
302
302
|
- !ruby/object:Gem::Version
|
303
303
|
version: '0'
|
304
|
+
segments:
|
305
|
+
- 0
|
306
|
+
hash: -738732606304836077
|
304
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
305
308
|
none: false
|
306
309
|
requirements:
|
307
310
|
- - ! '>='
|
308
311
|
- !ruby/object:Gem::Version
|
309
312
|
version: '0'
|
313
|
+
segments:
|
314
|
+
- 0
|
315
|
+
hash: -738732606304836077
|
310
316
|
requirements: []
|
311
317
|
rubyforge_project:
|
312
318
|
rubygems_version: 1.8.25
|