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
Kazuhiko Shiozaki
gitlab-shell
Commits
bde689a8
Commit
bde689a8
authored
Mar 12, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate key_line in separate method
parent
9e076ab2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
lib/gitlab_keys.rb
lib/gitlab_keys.rb
+5
-1
No files found.
lib/gitlab_keys.rb
View file @
bde689a8
...
...
@@ -29,11 +29,15 @@ class GitlabKeys
def
add_key
$logger
.
info
"Adding key
#{
@key_id
}
=>
#{
@key
.
inspect
}
"
auth_line
=
"command=
\"
#{
ROOT_PATH
}
/bin/gitlab-shell
#{
@key_id
}
\"
,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty
#{
@key
}
"
auth_line
=
key_line
(
@key_id
,
@key
)
open
(
auth_file
,
'a'
)
{
|
file
|
file
.
puts
(
auth_line
)
}
true
end
def
key_line
(
key_id
,
public_key
)
auth_line
=
"command=
\"
#{
ROOT_PATH
}
/bin/gitlab-shell
#{
key_id
}
\"
,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty
#{
public_key
}
"
end
def
rm_key
$logger
.
info
"Removing key
#{
@key_id
}
"
Tempfile
.
open
(
'authorized_keys'
)
do
|
temp
|
...
...
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