ssh 安装插件端

This commit is contained in:
bwcx_jzy 2019-08-17 22:02:14 +08:00
parent fc40158393
commit ecd528c366
4 changed files with 12 additions and 7 deletions

View File

@ -17,6 +17,7 @@
11. 【Server】 新增清空构建代码(解决代码冲突)(感谢@xieyue200810)
12. 搭建插件化基础架构
13. 用户权限重构,使用角色支持更细粒的权限控制
14. 新增ssh快速部署插件端
### 解决BUG、优化功能

View File

@ -8,5 +8,4 @@
* 在线修改配置
* 一键安装脚本
* 支持docker容器部署
* ssh部署插件端

View File

@ -129,21 +129,25 @@ public class SshInstallAgentController extends BaseServerController {
// 休眠10秒
Thread.sleep(10 * 1000);
if (StrUtil.isEmpty(nodeModel.getLoginName()) || StrUtil.isEmpty(nodeModel.getLoginPwd())) {
File saveFile;
File saveFile = null;
try {
// 获取远程的授权信息
String normalize = FileUtil.normalize(StrUtil.format("{}/{}/{}", path, ConfigBean.DATA, ConfigBean.AUTHORIZE));
saveFile = FileUtil.file(tempFilePath, IdUtil.fastSimpleUUID() + ConfigBean.AUTHORIZE);
sshService.download(sshModel, normalize, saveFile);
//
String json = FileUtil.readString(saveFile, CharsetUtil.CHARSET_UTF_8);
AgentAutoUser autoUser = JSONObject.parseObject(json, AgentAutoUser.class);
nodeModel.setLoginPwd(autoUser.getAgentPwd());
nodeModel.setLoginName(autoUser.getAgentName());
} catch (Exception e) {
DefaultSystemLog.ERROR().error("拉取授权信息失败", e);
return JsonMessage.getString(500, "获取授权信息失败", e);
} finally {
FileUtil.del(saveFile);
}
String json = FileUtil.readString(saveFile, CharsetUtil.CHARSET_UTF_8);
AgentAutoUser autoUser = JSONObject.parseObject(json, AgentAutoUser.class);
nodeModel.setLoginPwd(autoUser.getAgentPwd());
nodeModel.setLoginName(autoUser.getAgentName());
}
nodeModel.setOpenStatus(true);
// 绑定关系
nodeModel.setSshId(sshModel.getId());
nodeService.addItem(nodeModel);

View File

@ -23,7 +23,8 @@
进入
</button>
<button th:if="${item.sshId}" op="terminal" th:data-name="${sshName.get(item.sshId)}"
<button th:if="${item.sshId!=null && sshName.get(item.sshId)!=null}" op="terminal"
th:data-name="${sshName.get(item.sshId)}"
th:data-id="${item.sshId}"
class="layui-btn layui-btn-sm layui-btn-normal ">
<i class="layui-icon layui-icon-layer"></i>