diff --git a/script/gs_sshexkey b/script/gs_sshexkey index fe3034e..f7f63b0 100644 --- a/script/gs_sshexkey +++ b/script/gs_sshexkey @@ -165,9 +165,11 @@ Usage: General options: -f Host file containing the IP address of nodes. + -h Host ip list. Separate multiple nodes with commas(,). -l Path of log file. --skip-hostname-set Whether to skip hostname setting. (The default value is set.) + -W Password of nodes. -?, --help Show help information for this utility, and exit the command line mode. -V, --version Show version information. @@ -188,10 +190,14 @@ General options: if ("hostfile" in paraDict.keys()): self.hostFile = paraDict.get("hostfile") + if ("nodename" in paraDict.keys()): + self.hostList = paraDict.get("nodename") if ("logFile" in paraDict.keys()): self.logFile = paraDict.get("logFile") if ("skipHostnameSet" in paraDict.keys()): self.skipHostnameSet = paraDict.get("skipHostnameSet") + if ("passwords" in paraDict.keys()): + self.passwd = paraDict.get("passwords") def checkParameter(self): """ @@ -200,23 +206,24 @@ General options: output: NA """ # check required parameters - if (self.hostFile == ""): - self.usage() - GaussLog.exitWithError(ErrorCode.GAUSS_500["GAUSS_50001"] - % 'f' + ".") - if (not os.path.exists(self.hostFile)): - GaussLog.exitWithError(ErrorCode.GAUSS_502["GAUSS_50201"] - % self.hostFile) - if (not os.path.isabs(self.hostFile)): - GaussLog.exitWithError(ErrorCode.GAUSS_502["GAUSS_50213"] - % self.hostFile) + if len(self.hostList) == 0: + if (self.hostFile == ""): + self.usage() + GaussLog.exitWithError(ErrorCode.GAUSS_500["GAUSS_50001"] + % 'f' + ".") + if (not os.path.exists(self.hostFile)): + GaussLog.exitWithError(ErrorCode.GAUSS_502["GAUSS_50201"] + % self.hostFile) + if (not os.path.isabs(self.hostFile)): + GaussLog.exitWithError(ErrorCode.GAUSS_502["GAUSS_50213"] + % self.hostFile) - # read host file to hostList - self.readHostFile() + # read host file to hostList + self.readHostFile() - if (self.hostList == []): - GaussLog.exitWithError(ErrorCode.GAUSS_500["GAUSS_50004"] - % 'f' + " It cannot be empty.") + if (self.hostList == []): + GaussLog.exitWithError(ErrorCode.GAUSS_500["GAUSS_50004"] + % 'f' + " It cannot be empty.") # check logfile if (self.logFile != ""): diff --git a/script/gspylib/common/ParameterParsecheck.py b/script/gspylib/common/ParameterParsecheck.py index 028062f..eee6dbb 100644 --- a/script/gspylib/common/ParameterParsecheck.py +++ b/script/gspylib/common/ParameterParsecheck.py @@ -79,7 +79,7 @@ gs_check = ["-?", "--help", "-V", "--version", "-e:", "-i:", "--ShrinkNodes=", "--nodegroup-name=", "--skip-root-items", "--set"] gs_sshexkey = ["-?", "--help", "-V", "--version", - "-f:", "--skip-hostname-set", "-l:"] + "-f:", "--skip-hostname-set", "-l:", "-h:", "-W:"] gs_backup = ["-?", "--help", "-V", "--version", "--backup-dir=", "--parameter", "--force", "--binary", "--all", "-l:", "-h:", "-t:", "-X:"]