提交 beffacb5 编写于 作者: hlwwx's avatar hlwwx

对编辑config文件时增加能否编辑控制

上级 6d15936a
......@@ -148,11 +148,13 @@ public class BaseTools {
String localip = getIpAddress();
Nodes nodes = Config.nodes();
//同步config文件
for (String node : nodes.keySet()) {
//其他服务器
if (!node.equalsIgnoreCase(localip)) {
if (nodes.get(node).getApplication().getEnable() || nodes.get(node).getCenter().getEnable()) {
Syncflag = executeSyncFile(syncFilePath, node, nodes.get(node).nodeAgentPort());
if(Config.nodes().centerServers().first().getValue().getConfigApiEnable()) {
for (String node : nodes.keySet()) {
//其他服务器
if (!node.equalsIgnoreCase(localip)) {
if (nodes.get(node).getApplication().getEnable() || nodes.get(node).getCenter().getEnable()) {
Syncflag = executeSyncFile(syncFilePath, node, nodes.get(node).nodeAgentPort());
}
}
}
}
......
......@@ -45,8 +45,17 @@ public class ActionSave extends BaseAction {
String fileName = wi.getFileName();
String data = wi.getFileContent();
File file = new File(Config.base(),"config/"+fileName);
if(!Config.nodes().centerServers().first().getValue().getConfigApiEnable()) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
wo.setTime(df.format(new Date()));
wo.setStatus("failure");
wo.setMessage("禁止编辑");
result.setData(wo);
return result;
}
File file = new File(Config.base(),Config.dir_config()+"/"+fileName);
if(!file.exists()) {
file.createNewFile();
}
......@@ -63,7 +72,7 @@ public class ActionSave extends BaseAction {
//其他服务器
if(!node.equalsIgnoreCase(curServer)) {
if(nodes.get(node).getApplication().getEnable() || nodes.get(node).getCenter().getEnable()){
boolean Syncflag = executeSyncFile("config/"+fileName , node ,nodes.get(node).nodeAgentPort());
boolean Syncflag = executeSyncFile(Config.dir_config()+"/"+fileName , node ,nodes.get(node).nodeAgentPort());
}
}
}
......@@ -181,10 +190,13 @@ public class ActionSave extends BaseAction {
@FieldDescribe("执行结果")
private String status;
@FieldDescribe("执行消息")
private String message;
@FieldDescribe("config文件内容")
private String fileContent;
@FieldDescribe("是否Sample")
private boolean isSample;
......@@ -219,6 +231,13 @@ public class ActionSave extends BaseAction {
public void setSample(boolean isSample) {
this.isSample = isSample;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册