Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
75c66567
Commit
75c66567
authored
Jul 29, 2013
by
Christos Stavrakakis
Browse files
ci: Copy ssh keys
Add option for copying ssh keys to the created vm.
parent
d5b90719
Changes
1
Hide whitespace changes
Inline
Side-by-side
ci/utils.py
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
:
...
...
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