[fix] 修正旧版用户名数据
This commit is contained in:
parent
195f0752bb
commit
3ff940a939
|
@ -164,6 +164,33 @@ public partial class AppDeployNode : Entity<AppDeployNode>
|
|||
#endregion
|
||||
|
||||
#region 业务操作
|
||||
/// <summary>修正旧版用户名数据</summary>
|
||||
/// <returns></returns>
|
||||
public Int32 FixOldUserName()
|
||||
{
|
||||
// 兼容旧数据
|
||||
var user = UserName;
|
||||
if (user.IsNullOrEmpty()) return 0;
|
||||
|
||||
// Windows 用户名
|
||||
if (user != "$" && user != "$$" && user[^1] == '$')
|
||||
{
|
||||
ProcessUser = user;
|
||||
UserName = null;
|
||||
return Update();
|
||||
}
|
||||
|
||||
if (user == Deploy?.UserName)
|
||||
{
|
||||
// 如果和应用的用户名相同,则不设置用户名
|
||||
ProcessUser = user;
|
||||
UserName = null;
|
||||
return Update();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转应用服务信息
|
||||
/// </summary>
|
||||
|
@ -189,6 +216,7 @@ public partial class AppDeployNode : Entity<AppDeployNode>
|
|||
MaxMemory = app.MaxMemory,
|
||||
Mode = Mode,
|
||||
};
|
||||
|
||||
if (inf.Name.IsNullOrEmpty()) inf.Name = app.Name;
|
||||
if (inf.FileName.IsNullOrEmpty()) inf.FileName = app.FileName;
|
||||
if (inf.Arguments.IsNullOrEmpty()) inf.Arguments = app.Arguments;
|
||||
|
|
|
@ -56,25 +56,28 @@ public class DeployController : BaseController
|
|||
var list = AppDeployNode.FindAllByNodeId(_node.ID);
|
||||
|
||||
var rs = new List<DeployInfo>();
|
||||
foreach (var item in list)
|
||||
foreach (var deployNode in list)
|
||||
{
|
||||
// 不返回未启用的发布集,如果需要在客户端删除,则通过指令下发来实现
|
||||
if (!item.Enable) continue;
|
||||
if (!deployNode.Enable) continue;
|
||||
|
||||
// 过滤需要的应用部署
|
||||
if (deployId > 0 && item.Id != deployId) continue;
|
||||
if (deployId > 0 && deployNode.Id != deployId) continue;
|
||||
|
||||
var app = item.Deploy;
|
||||
var app = deployNode.Deploy;
|
||||
if (app == null || !app.Enable) continue;
|
||||
|
||||
if (!deployName.IsNullOrEmpty())
|
||||
{
|
||||
if (!item.DeployName.IsNullOrEmpty() && item.DeployName != deployName ||
|
||||
item.DeployName.IsNullOrEmpty() && app.Name != deployName) continue;
|
||||
if (!deployNode.DeployName.IsNullOrEmpty() && deployNode.DeployName != deployName ||
|
||||
deployNode.DeployName.IsNullOrEmpty() && app.Name != deployName) continue;
|
||||
}
|
||||
if (!appName.IsNullOrEmpty() && app.AppName != appName) continue;
|
||||
|
||||
var inf = _deployService.BuildDeployInfo(item, _node);
|
||||
// 修正旧的用户名
|
||||
deployNode.FixOldUserName();
|
||||
|
||||
var inf = _deployService.BuildDeployInfo(deployNode, _node);
|
||||
if (inf == null) continue;
|
||||
|
||||
rs.Add(inf);
|
||||
|
|
|
@ -111,6 +111,7 @@ public class AppDeployNodeController : EntityController<AppDeployNode>
|
|||
var node = entity.Node;
|
||||
if (node != null) entity.IP = node.IP;
|
||||
|
||||
entity.FixOldUserName();
|
||||
entity.Deploy?.Fix();
|
||||
|
||||
return base.Valid(entity, type, post);
|
||||
|
|
Loading…
Reference in New Issue