Pārlūkot izejas kodu

touch .refresh_ssh_keys when keys need refreshing

tags/v0.1.6
Jonathan Cobb pirms 4 gadiem
vecāks
revīzija
1e3de575ce
1 mainītis faili ar 11 papildinājumiem un 9 dzēšanām
  1. +11
    -9
      bubble-server/src/main/java/bubble/dao/account/AccountSshKeyDAO.java

+ 11
- 9
bubble-server/src/main/java/bubble/dao/account/AccountSshKeyDAO.java Parādīt failu

@@ -6,6 +6,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.io.File;

import static bubble.ApiConstants.HOME_DIR;
import static org.cobbzilla.util.io.FileUtil.touch;
import static org.cobbzilla.util.security.RsaKeyPair.isValidSshPublicKey;
import static org.cobbzilla.util.security.ShaUtil.sha256_hex;
import static org.cobbzilla.wizard.resources.ResourceUtil.invalidEx;
@@ -50,26 +54,24 @@ public class AccountSshKeyDAO extends AccountOwnedEntityDAO<AccountSshKey> {
}

@Override public AccountSshKey postCreate(AccountSshKey key, Object context) {
if (key.installSshKey()) {
// poke SSH key manager, refresh installed keys
}
if (key.installSshKey()) refreshInstalledKeys();
return super.postCreate(key, context);
}

@Override public AccountSshKey postUpdate(AccountSshKey key, Object context) {
final Account owner = accountDAO.findByUuid(key.getAccount());
if (owner.admin()) {
// poke SSH key manager, refresh installed keys
}
if (owner.admin()) refreshInstalledKeys();
return super.postUpdate(key, context);
}

@Override public void delete(String uuid) {
final AccountSshKey key = findByUuid(uuid);
super.delete(uuid);
if (key.installSshKey()) {
// poke SSH key manager, refresh installed keys
}
if (key.installSshKey()) refreshInstalledKeys();
}

// refresh_bubble_ssh_keys_monitor.sh watches this file (in ansible bubble role)
private static final File REFRESH_SSH_KEYS_FILE = new File(HOME_DIR, ".refresh_ssh_keys");
private void refreshInstalledKeys() { touch(REFRESH_SSH_KEYS_FILE); }

}

Notiek ielāde…
Atcelt
Saglabāt