diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-03-20 03:07:22 +0300 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-03-20 04:16:26 +0300 |
commit | 983dcba3d4ca0e3dae5a04271adeaa6ecedea488 (patch) | |
tree | 1b01851b3b154af604ab005c20ea3c6ab6416a9f /lib/gitlab/authorized_keys.rb | |
parent | dd43abecf93035d36b649c75c05143cc08db1566 (diff) |
Handle cases when authorized_keys doesn't exist
Modify Gitlab::AuthorizedKeys#rm_key and #list_key_ids to
handle cases when an `Errno::ENOENT` is raised.
Also added test cases in spec to ensure each method will
still work when authorized_keys doesn't exist.
Diffstat (limited to 'lib/gitlab/authorized_keys.rb')
-rw-r--r-- | lib/gitlab/authorized_keys.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab/authorized_keys.rb b/lib/gitlab/authorized_keys.rb index 609d2bd9c77..3fe72f5fd43 100644 --- a/lib/gitlab/authorized_keys.rb +++ b/lib/gitlab/authorized_keys.rb @@ -68,6 +68,8 @@ module Gitlab end true + rescue Errno::ENOENT + false end # Clear the authorized_keys file @@ -96,6 +98,8 @@ module Gitlab end end end + rescue Errno::ENOENT + [] end private |