import os
-from ganeti import logger
from ganeti import utils
from ganeti import errors
from ganeti import constants
"""Wrapper for SSH commands.
"""
- def __init__(self, cfg):
- self.cfg = cfg
+ def __init__(self, cluster_name):
+ self.cluster_name = cluster_name
def _BuildSshOptions(self, batch, ask_key, use_cluster_key,
strict_host_check):
]
if use_cluster_key:
- options.append("-oHostKeyAlias=%s" % self.cfg.GetClusterName())
+ options.append("-oHostKeyAlias=%s" % self.cluster_name)
# TODO: Too many boolean options, maybe convert them to more descriptive
# constants.
"""
if not os.path.isabs(filename):
- logger.Error("file %s must be an absolute path" % (filename))
+ logging.error("File %s must be an absolute path", filename)
return False
if not os.path.isfile(filename):
- logger.Error("file %s does not exist" % (filename))
+ logging.error("File %s does not exist", filename)
return False
command = [constants.SCP, "-q", "-p"]
result = utils.RunCmd(command)
if result.failed:
- logger.Error("copy to node %s failed (%s) error %s,"
- " command was %s" %
- (node, result.fail_reason, result.output, result.cmd))
+ logging.error("Copy to node %s failed (%s) error %s,"
+ " command was %s",
+ node, result.fail_reason, result.output, result.cmd)
return not result.failed