diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-08-29 11:28:22 +0300 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-08-29 11:33:04 +0300 |
commit | a1ec2ad0b2638f084dffbe804b681c96dc6dadb8 (patch) | |
tree | eff3f8eee80adf8abdf7b656512f85ffee5527dd /lib/gitlab/authorized_keys.rb | |
parent | b047359de5b365022d63b8da10a3a87f3ad92397 (diff) |
Auto create authorized_keys file if doesn't exist
Utilize the auto repair functionality of system checks.
Diffstat (limited to 'lib/gitlab/authorized_keys.rb')
-rw-r--r-- | lib/gitlab/authorized_keys.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/authorized_keys.rb b/lib/gitlab/authorized_keys.rb index ca9b65b7c44..820a78b653c 100644 --- a/lib/gitlab/authorized_keys.rb +++ b/lib/gitlab/authorized_keys.rb @@ -22,6 +22,15 @@ module Gitlab false end + # Creates the authorized_keys file if it doesn't exist + # + # @return [Boolean] + def create + open_authorized_keys_file(File::CREAT) { true } + rescue Errno::EACCES + false + end + # Add id and its key to the authorized_keys file # # @param [String] id identifier of key prefixed by `key-` |