Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
synnefo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
synnefo
Commits
75c66567
Commit
75c66567
authored
12 years ago
by
Christos Stavrakakis
Browse files
Options
Downloads
Patches
Plain Diff
ci: Copy ssh keys
Add option for copying ssh keys to the created vm.
parent
d5b90719
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ci/utils.py
+15
-0
15 additions, 0 deletions
ci/utils.py
with
15 additions
and
0 deletions
ci/utils.py
+
15
−
0
View file @
75c66567
...
...
@@ -203,6 +203,7 @@ class SynnefoCI(object):
server
=
self
.
_wait_transition
(
server_id
,
"
BUILD
"
,
"
ACTIVE
"
)
self
.
_get_server_ip_and_port
(
server
)
self
.
_copy_ssh_keys
()
self
.
setup_fabric
()
self
.
logger
.
info
(
"
Setup firewall
"
)
...
...
@@ -252,6 +253,20 @@ class SynnefoCI(object):
self
.
write_config
(
'
server_port
'
,
server_port
)
self
.
logger
.
debug
(
"
Server
'
s ssh port is %s
"
%
_green
(
server_port
))
@_check_fabric
def
_copy_ssh_keys
(
self
):
authorized_keys
=
self
.
config
.
get
(
"
Deployment
"
,
"
ssh_keys
"
)
if
os
.
path
.
exists
(
authorized_keys
):
keyfile
=
'
/tmp/%s.pub
'
%
fabric
.
env
.
user
_run
(
'
mkdir -p ~/.ssh && chmod 700 ~/.ssh
'
,
False
)
fabric
.
put
(
authorized_keys
,
keyfile
)
_run
(
'
cat %s >> ~/.ssh/authorized_keys
'
%
keyfile
,
False
)
_run
(
'
rm %s
'
%
keyfile
,
False
)
self
.
logger
.
debug
(
"
Uploaded ssh authorized keys
"
)
else
:
self
.
logger
.
debug
(
"
No ssh keys found
"
)
def
write_config
(
self
,
option
,
value
,
section
=
"
Temporary Options
"
):
"""
Write changes back to config file
"""
try
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment