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
snf-ganeti
Commits
1ff08570
Commit
1ff08570
authored
Mar 18, 2008
by
Michael Hanselmann
Browse files
Use new cluster alias in known_hosts file
Reviewed-by: ultrotter
parent
b047857b
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/cmdlib.py
View file @
1ff08570
...
...
@@ -96,7 +96,7 @@ class LogicalUnit(object):
"""
if
not
self
.
__ssh
:
self
.
__ssh
=
ssh
.
SshRunner
()
self
.
__ssh
=
ssh
.
SshRunner
(
self
.
sstore
)
return
self
.
__ssh
ssh
=
property
(
fget
=
__GetSSH
)
...
...
lib/ssh.py
View file @
1ff08570
...
...
@@ -30,6 +30,7 @@ from ganeti import logger
from
ganeti
import
utils
from
ganeti
import
errors
from
ganeti
import
constants
from
ganeti
import
ssconf
KNOWN_HOSTS_OPTS
=
[
...
...
@@ -90,6 +91,15 @@ class SshRunner:
"""Wrapper for SSH commands.
"""
def
__init__
(
self
,
sstore
=
None
):
if
sstore
is
None
:
self
.
sstore
=
ssconf
.
SimpleStore
()
else
:
self
.
sstore
=
sstore
def
_GetHostKeyAliasOption
(
self
):
return
"-oHostKeyAlias=%s"
%
self
.
sstore
.
GetClusterName
()
def
BuildCmd
(
self
,
hostname
,
user
,
command
,
batch
=
True
,
ask_key
=
False
,
tty
=
False
):
"""Build an ssh command to execute a command on a remote node.
...
...
@@ -108,6 +118,7 @@ class SshRunner:
"""
argv
=
[
"ssh"
,
"-q"
]
argv
.
extend
(
KNOWN_HOSTS_OPTS
)
argv
.
append
(
self
.
_GetHostKeyAliasOption
())
if
batch
:
# if we are in batch mode, we can't ask the key
if
ask_key
:
...
...
@@ -163,6 +174,7 @@ class SshRunner:
command
=
[
"scp"
,
"-q"
,
"-p"
]
command
.
extend
(
KNOWN_HOSTS_OPTS
)
command
.
extend
(
BATCH_MODE_OPTS
)
command
.
append
(
self
.
_GetHostKeyAliasOption
())
command
.
append
(
filename
)
command
.
append
(
"%s:%s"
%
(
node
,
filename
))
...
...
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