Parcourir la source

Fix account sync preconditions

pull/54/head
Kristijan Mitrovic il y a 4 ans
Parent
révision
f19ab9e946
1 fichiers modifiés avec 9 ajouts et 5 suppressions
  1. +9
    -5
      bubble-server/src/main/java/bubble/service/account/StandardSyncAccountService.java

+ 9
- 5
bubble-server/src/main/java/bubble/service/account/StandardSyncAccountService.java Voir le fichier

@@ -46,14 +46,12 @@ public class StandardSyncAccountService implements SyncAccountService {
log.warn("sync: thisNetwork was null, sync_account is impossible");
return;
}
if (!account.admin()) {
log.info("sync: not syncing non-admin account");
return;
}

if (!account.sync()) {
log.info("sync: account sync disabled for account: "+account.getName());
return;
}

final AnsibleInstallType installType = thisNetwork.getInstallType();
if (installType == AnsibleInstallType.sage) {
// changing account on sage, notify all bubbles launched by user that have syncAccount == true
@@ -62,7 +60,7 @@ public class StandardSyncAccountService implements SyncAccountService {
if (network.getState() != BubbleNetworkState.running) continue;
if (!network.syncAccount()) continue;
for (BubbleNode node : nodeDAO.findByNetwork(network.getUuid())) {
if (node.getUuid().equals(configuration.getThisNode().getUuid())) {
if (node.getUuid().equals(thisNetwork.getUuid())) {
log.info("sync: not notifying self");
continue;
}
@@ -72,10 +70,16 @@ public class StandardSyncAccountService implements SyncAccountService {
}

} else if (installType == AnsibleInstallType.node) {
if (account.getUuid().equals(thisNetwork.getAccount())) {
log.info("sync: not syncing non-owner account from node to sage");
return;
}

if (!thisNetwork.syncAccount()) {
log.info("sync: disabled for node, not sending sync_account notification");
return;
}

// changing account on node, notify sage, which will then notify all bubbles launched by user that have
// syncAccount == true
log.info("sync: sending sync_account notification from node to sage: "+configuration.getSageNode());


Chargement…
Annuler
Enregistrer