File tree Expand file tree Collapse file tree 2 files changed +21
-8
lines changed
service/lib/agama/autoyast Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,7 @@ def read
4646 hsh [ "hashedPassword" ] = true if password . value . encrypted?
4747 end
4848
49- public_key = root_user . authorized_keys . first
50- hsh [ "sshPublicKey" ] = public_key if public_key
51- hsh [ "sshPublicKeys" ] = root_user . authorized_keys if !root_user . authorized_keys . empty?
49+ hsh . merge ( setup_ssh ( root ) )
5250
5351 return { } if hsh . empty?
5452
@@ -67,6 +65,17 @@ def config
6765 result = reader . read
6866 @config = result . config
6967 end
68+
69+ def setup_ssh ( root_user )
70+ hsh = { }
71+
72+ public_key = root_user . authorized_keys . first
73+
74+ hsh [ "sshPublicKey" ] = public_key if public_key
75+ hsh [ "sshPublicKeys" ] = root_user . authorized_keys if !root_user . authorized_keys . empty?
76+
77+ hsh
78+ end
7079 end
7180 end
7281end
Original file line number Diff line number Diff line change @@ -37,18 +37,15 @@ def read
3737 user = config . users . find { |u | !u . system? && !u . root? }
3838 return { } unless user
3939
40- hsh = {
41- "userName" => user . name ,
42- "fullName" => user . gecos . first . to_s
43- }
40+ hsh = basic_user_info
4441
4542 password = user . password
4643 if password
4744 hsh [ "password" ] = password . value . to_s
4845 hsh [ "hashedPassword" ] = true if password . value . encrypted?
4946 end
5047
51- hsh [ "sshPublicKeys" ] user . authorized_keys if !user . authorized_keys . empty?
48+ hsh [ "sshPublicKeys" ] = user . authorized_keys if !user . authorized_keys . empty?
5249
5350 { "user" => hsh }
5451 end
@@ -65,6 +62,13 @@ def config
6562 result = reader . read
6663 @config = result . config
6764 end
65+
66+ def basic_user_info ( user )
67+ {
68+ "userName" => user . name ,
69+ "fullName" => user . gecos . first . to_s
70+ }
71+ end
6872 end
6973 end
7074end
You can’t perform that action at this time.
0 commit comments