mirror of https://github.com/certd/certd
chore:
parent
a350b51cf8
commit
6ab627ed5a
|
@ -149,21 +149,23 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
const { crtPath, keyPath, cert, accessId } = this;
|
const { crtPath, keyPath, cert, accessId } = this;
|
||||||
const certReader = new CertReader(cert);
|
const certReader = new CertReader(cert);
|
||||||
const connectConf: SshAccess = await this.accessService.getById(accessId);
|
|
||||||
const sshClient = new SshClient(this.logger);
|
|
||||||
|
|
||||||
const handle = async (opts: CertReaderHandleContext) => {
|
const handle = async (opts: CertReaderHandleContext) => {
|
||||||
const { tmpCrtPath, tmpKeyPath, tmpDerPath, tmpPfxPath, tmpIcPath } = opts;
|
const { tmpCrtPath, tmpKeyPath, tmpDerPath, tmpPfxPath, tmpIcPath } = opts;
|
||||||
if (this.copyToThisHost) {
|
if (this.copyToThisHost) {
|
||||||
this.logger.info('复制到目标路径');
|
this.logger.info('复制到目标路径');
|
||||||
throw new Error('复制到当前主机功能已迁移到 “复制到本机”插件');
|
this.copyFile(tmpCrtPath, crtPath);
|
||||||
// this.copyFile(tmpCrtPath, crtPath);
|
this.copyFile(tmpKeyPath, keyPath);
|
||||||
// this.copyFile(tmpKeyPath, keyPath);
|
this.copyFile(tmpIcPath, this.icPath);
|
||||||
// this.copyFile(tmpIcPath, this.icPath);
|
this.copyFile(tmpPfxPath, this.pfxPath);
|
||||||
// this.copyFile(tmpPfxPath, this.pfxPath);
|
this.copyFile(tmpDerPath, this.derPath);
|
||||||
// this.copyFile(tmpDerPath, this.derPath);
|
this.logger.warn('复制到当前主机功能已迁移到 “复制到本机”插件,请尽快换成复制到本机插件');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const connectConf: SshAccess = await this.accessService.getById(accessId);
|
||||||
|
const sshClient = new SshClient(this.logger);
|
||||||
|
|
||||||
if (!accessId) {
|
if (!accessId) {
|
||||||
throw new Error('主机登录授权配置不能为空');
|
throw new Error('主机登录授权配置不能为空');
|
||||||
}
|
}
|
||||||
|
@ -226,6 +228,8 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.script && this.script?.trim()) {
|
if (this.script && this.script?.trim()) {
|
||||||
|
const connectConf: SshAccess = await this.accessService.getById(accessId);
|
||||||
|
const sshClient = new SshClient(this.logger);
|
||||||
this.logger.info('执行脚本命令');
|
this.logger.info('执行脚本命令');
|
||||||
const scripts = this.script.split('\n');
|
const scripts = this.script.split('\n');
|
||||||
await sshClient.exec({
|
await sshClient.exec({
|
||||||
|
|
Loading…
Reference in New Issue