def createHostKeys(self): self.logger.debug("In Function {0}".format(inspect.stack()[0][3])) key_fname = os.path.join(self.ssh_dir, "host_key") self.logger.info("Generating ssh keys {0}".format(key_fname)) op=common.exec_cmd_op(["ssh-keygen", "-P", "", "-f", key_fname]) self.logger.info(op)
def cleanup(): logger.debug("Commisioning stage 2 cleanup") logger.info("Unmounting the cdrom after commision") out = common.exec_cmd_op(["umount", "/media/cdrom0"]) if out: logger.info(out)
def remove_domain_from_known_host(self): self.logger.debug("In Function {0}".format(inspect.stack()[0][3])) self.logger.debug("Removing domain from known hosts") op=common.exec_cmd_op(["ssh-keygen", "-R", self.ip_host[0], "-f", self.known_host]) self.logger.info( op)
def smart_install(l): logger.debug("In Function {0}".format(inspect.stack()[0][3])) for rpm in l: logger.info("Installing rpm file {0}".format(rpm)) cmd = ["smart", "install", "{0}".format(rpm), "-y"] out = common.exec_cmd_op(cmd) logger.info(out) logger.debug("Installation of packages done")
def remote_cp(self, src, dst): self.logger.debug("In Function {0}".format(inspect.stack()[0][3])) self.logger.debug("Executing remote copy") op=common.exec_cmd_op(["scp", "-F", self.ssh_config, src, self.ip_host[0]+":"+dst]) self.logger.info( op)
def exec_remote_cmd(self, cmd): self.logger.debug("In Function {0}".format(inspect.stack()[0][3])) self.logger.debug("Executing ssh command") op=common.exec_cmd_op(["ssh", "-F", self.ssh_config, self.ip_host[0], cmd]) self.logger.info( op)
def do_ssh_linkup(self): self.logger.debug("In Function {0}".format(inspect.stack()[0][3])) self.logger.debug("Attempting ssh linkup") op=common.exec_cmd_op(["ssh", "-o","UserKnownHostsFile={0}".format(self.known_host), "-o", "StrictHostKeyChecking=no", "-i", self.id, self.ip_host[0], "hostname"]) self.logger.info(op)