浏览代码

Merge branch 'master' into kris/move_log_flag_api_calls

pull/40/head
jonathan 4 年前
父节点
当前提交
11337eda3a
共有 4 个文件被更改,包括 36 次插入23 次删除
  1. +7
    -1
      bubble-server/src/main/java/bubble/resources/account/MeResource.java
  2. +27
    -20
      bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java
  3. +1
    -1
      bubble-server/src/main/resources/META-INF/bubble/bubble.properties
  4. +1
    -1
      utils/cobbzilla-utils

+ 7
- 1
bubble-server/src/main/java/bubble/resources/account/MeResource.java 查看文件

@@ -72,6 +72,7 @@ import static org.cobbzilla.util.daemon.ZillaRuntime.*;
import static org.cobbzilla.util.http.HttpContentTypes.*;
import static org.cobbzilla.util.json.JsonUtil.json;
import static org.cobbzilla.wizard.resources.ResourceUtil.*;
import static org.cobbzilla.wizard.server.RestServerBase.reportError;

@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@@ -91,7 +92,12 @@ public class MeResource {
public Response me(@Context ContainerRequest ctx) {
try {
final Account account = userPrincipal(ctx);
return ok(account.setPolicy(policyDAO.findSingleByAccount(account.getUuid())));
final Account acct = accountDAO.findByUuid(account.getUuid());
if (acct == null) {
reportError("MeResource.me: account in session but not in DB: "+account.getName()+"/"+account.getUuid());
return unauthorized();
}
return ok(acct.setPolicy(policyDAO.findSingleByAccount(account.getUuid())));
} catch (Exception e) {
return notFound();
}


+ 27
- 20
bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java 查看文件

@@ -640,30 +640,37 @@ public class StandardNetworkService implements NetworkService {
public boolean isReachable(BubbleNode node) {
final String prefix = "isReachable(" + node.id() + "): ";
try {
log.info(prefix+"starting");
log.info(prefix + "starting");

final NotificationReceipt receipt = notificationService.notify(node, NotificationType.health_check, null);
BubbleNodeState state = null;
if (receipt == null) {
log.info(prefix+"health_check failed, checking via cloud");
final CloudService cloud = cloudDAO.findByUuid(node.getCloud());
if (cloud == null) {
log.warn(prefix+"cloud not found: "+node.getCloud());
return false;
}
final BubbleNode status = cloud.getComputeDriver(configuration).status(node);
if (status != null) {
state = status.getState();
if (state != null && state.active()) {
log.info(prefix + "cloud status was: " + state + ", returning true");
return true;
}
}
if (receipt != null) {
log.debug(prefix + "receiving regular health_check receipt - all ok");
return true;
}
log.warn(prefix+"no way of reaching node "+node.id()+" (state="+state+"), returning false");
return false;

log.info(prefix+"health_check failed, checking via cloud");
final CloudService cloud = cloudDAO.findByUuid(node.getCloud());
if (cloud == null) {
log.warn(prefix + "cloud not found: " + node.getCloud());
return false;
}

final BubbleNode status = cloud.getComputeDriver(configuration).status(node);
if (status == null) {
log.warn(prefix + "node's status not found on the cloud: " + node.getCloud());
return false;
}

final BubbleNodeState state = status.getState();
if (state != null && state.active()) {
log.info(prefix + "node's state on cloud was ok: " + state);
return true;
} else {
log.warn(prefix + "bad node's state on cloud: " + state);
return false;
}
} catch (Exception e) {
log.warn(prefix+e);
log.warn(prefix + e, e);
return false;
}
}


+ 1
- 1
bubble-server/src/main/resources/META-INF/bubble/bubble.properties 查看文件

@@ -1 +1 @@
bubble.version=Adventure 0.15.5
bubble.version=Adventure 0.15.6

+ 1
- 1
utils/cobbzilla-utils

@@ -1 +1 @@
Subproject commit 51d700f6fe634d092adb3f238caf429a2d4c4dc7
Subproject commit b6e60fe9771478a7210c018332395284fae0dd4b

正在加载...
取消
保存