Skip to content

Commit

Permalink
fix writting new keys
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Aug 19, 2022
1 parent c0352ef commit f3ed7d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/lib/y2users/linux/users_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def write_ssh_auth_keys
next
end

system_user.authorized_keys = user.authorized_keys
write_user_auth_keys(system_user, old_keys)
end
end
Expand Down Expand Up @@ -168,9 +169,9 @@ def edit_user(initial_user, target_user)
edit_password(target_user) if initial_user.password != target_user.password

previous_keys = initial_user.authorized_keys || []
if previous_keys != target_user.authorized_keys
@users_to_write_ssh_keys[target_user] = previous_keys
end
return if previous_keys == target_user.authorized_keys

@users_to_write_ssh_keys[target_user] = previous_keys
end

# Updates root aliases
Expand Down
2 changes: 1 addition & 1 deletion test/lib/y2users/linux/users_writer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def issues(messages)

context "and the user home exists" do
let(:system_user) { test3.copy }
let(:system_config) { Y2Users::Config.new.tap { |c| c.attach([system_user]) }}
let(:system_config) { Y2Users::Config.new.tap { |c| c.attach([system_user]) } }

before do
allow(Yast::FileUtils).to receive(:IsDirectory).with(test3.home.path).and_return(true)
Expand Down

0 comments on commit f3ed7d3

Please sign in to comment.