Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-shell
Commits
6e4ada2e
Commit
6e4ada2e
authored
Aug 10, 2016
by
DJ Mountney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the keys permission check to open the file in write mode.
That way the file is created if it does not exist.
parent
0b73855f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
lib/gitlab_keys.rb
lib/gitlab_keys.rb
+2
-2
spec/gitlab_keys_spec.rb
spec/gitlab_keys_spec.rb
+7
-0
No files found.
lib/gitlab_keys.rb
View file @
6e4ada2e
...
@@ -106,7 +106,7 @@ class GitlabKeys
...
@@ -106,7 +106,7 @@ class GitlabKeys
end
end
def
check_permissions
def
check_permissions
open_auth_file
(
'r+'
)
{
true
}
open_auth_file
(
File
::
RDWR
|
File
::
CREAT
)
{
true
}
rescue
=>
ex
rescue
=>
ex
puts
"error: could not open
#{
auth_file
}
:
#{
ex
}
"
puts
"error: could not open
#{
auth_file
}
:
#{
ex
}
"
if
File
.
exist?
(
auth_file
)
if
File
.
exist?
(
auth_file
)
...
...
spec/gitlab_keys_spec.rb
View file @
6e4ada2e
...
@@ -183,6 +183,13 @@ describe GitlabKeys do
...
@@ -183,6 +183,13 @@ describe GitlabKeys do
gitlab_keys
.
should_receive
(
:open_auth_file
).
and_raise
(
"imaginary error"
)
gitlab_keys
.
should_receive
(
:open_auth_file
).
and_raise
(
"imaginary error"
)
expect
(
gitlab_keys
.
exec
).
to
eq
(
false
)
expect
(
gitlab_keys
.
exec
).
to
eq
(
false
)
end
end
it
'creates the keys file if it does not exist'
do
create_authorized_keys_fixture
FileUtils
.
rm
(
tmp_authorized_keys_path
)
expect
(
gitlab_keys
.
exec
).
to
eq
(
true
)
expect
(
File
.
exist?
(
tmp_authorized_keys_path
)).
to
eq
(
true
)
end
end
end
describe
:exec
do
describe
:exec
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment