Revision cffbbae7 lib/ssh.py

b/lib/ssh.py
33 33
from ganeti import constants
34 34
from ganeti import netutils
35 35
from ganeti import pathutils
36
from ganeti import vcluster
36 37

  
37 38

  
38 39
def FormatParamikoFingerprint(fingerprint):
......
184 185
                                      quiet=quiet))
185 186
    if tty:
186 187
      argv.extend(["-t", "-t"])
187
    argv.extend(["%s@%s" % (user, hostname), command])
188

  
189
    argv.append("%s@%s" % (user, hostname))
190

  
191
    # Insert variables for virtual nodes
192
    argv.extend("export %s=%s;" %
193
                (utils.ShellQuote(name), utils.ShellQuote(value))
194
                for (name, value) in
195
                  vcluster.EnvironmentForHost(hostname).items())
196

  
197
    argv.append(command)
198

  
188 199
    return argv
189 200

  
190 201
  def Run(self, *args, **kwargs):
......
225 236
    if netutils.IP6Address.IsValid(node):
226 237
      node = netutils.FormatAddress((node, None))
227 238

  
228
    command.append("%s:%s" % (node, filename))
239
    command.append("%s:%s" % (node, vcluster.ExchangeNodeRoot(node, filename)))
229 240

  
230 241
    result = utils.RunCmd(command)
231 242

  
......
255 266
        - detail: string with details
256 267

  
257 268
    """
258
    retval = self.Run(node, "root", "hostname --fqdn", quiet=False)
269
    cmd = ("if test -z \"$GANETI_HOSTNAME\"; then"
270
           "  hostname --fqdn;"
271
           "else"
272
           "  echo \"$GANETI_HOSTNAME\";"
273
           "fi")
274
    retval = self.Run(node, "root", cmd, quiet=False)
259 275

  
260 276
    if retval.failed:
261 277
      msg = "ssh problem"

Also available in: Unified diff