diff options
author | DJ Mountney <david@twkie.net> | 2016-08-10 11:46:04 -0700 |
---|---|---|
committer | DJ Mountney <david@twkie.net> | 2016-08-10 11:51:16 -0700 |
commit | 6e4ada2e9e215256dffffc20ec14960c1bbf17e9 (patch) | |
tree | e2b6d99a4a2c8c052f7bde59f061f46b1eda3413 /lib | |
parent | 0b73855f1b83818683f5a1de83090bb043a51616 (diff) | |
download | gitlab-shell-6e4ada2e9e215256dffffc20ec14960c1bbf17e9.tar.gz |
Update the keys permission check to open the file in write mode.
That way the file is created if it does not exist.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab_keys.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab_keys.rb b/lib/gitlab_keys.rb index d4c4102..eb359f8 100644 --- a/lib/gitlab_keys.rb +++ b/lib/gitlab_keys.rb @@ -106,7 +106,7 @@ class GitlabKeys end def check_permissions - open_auth_file('r+') { true } + open_auth_file(File::RDWR | File::CREAT) { true } rescue => ex puts "error: could not open #{auth_file}: #{ex}" if File.exist?(auth_file) @@ -132,7 +132,7 @@ class GitlabKeys def lock_file @lock_file ||= auth_file + '.lock' end - + def open_auth_file(mode) open(auth_file, mode, 0600) do |file| file.chmod(0600) |