Revision b43dcc5a lib/ssh.py
b/lib/ssh.py | ||
---|---|---|
1 | 1 |
# |
2 | 2 |
# |
3 | 3 |
|
4 |
# Copyright (C) 2006, 2007 Google Inc. |
|
4 |
# Copyright (C) 2006, 2007, 2010 Google Inc.
|
|
5 | 5 |
# |
6 | 6 |
# This program is free software; you can redistribute it and/or modify |
7 | 7 |
# it under the terms of the GNU General Public License as published by |
... | ... | |
66 | 66 |
"""Wrapper for SSH commands. |
67 | 67 |
|
68 | 68 |
""" |
69 |
def __init__(self, cluster_name): |
|
69 |
def __init__(self, cluster_name, ipv6=False): |
|
70 |
"""Initializes this class. |
|
71 |
|
|
72 |
@type cluster_name: str |
|
73 |
@param cluster_name: name of the cluster |
|
74 |
@type ipv6: bool |
|
75 |
@param ipv6: If true, force ssh to use IPv6 addresses only |
|
76 |
|
|
77 |
""" |
|
70 | 78 |
self.cluster_name = cluster_name |
79 |
self.ipv6 = ipv6 |
|
71 | 80 |
|
72 | 81 |
def _BuildSshOptions(self, batch, ask_key, use_cluster_key, |
73 | 82 |
strict_host_check, private_key=None, quiet=True): |
... | ... | |
128 | 137 |
else: |
129 | 138 |
options.append("-oStrictHostKeyChecking=no") |
130 | 139 |
|
140 |
if self.ipv6: |
|
141 |
options.append("-6") |
|
142 |
|
|
131 | 143 |
return options |
132 | 144 |
|
133 | 145 |
def BuildCmd(self, hostname, user, command, batch=True, ask_key=False, |
Also available in: Unified diff