swarm-archive: grant only once an archive is up; keep logins across a gap in placements
The archive host creates a ready marker in the store and swarm-controller writes no credentials before it exists, so a swarm without an archive, and a mixed-version swarm, leave every hive backup a logged no-op. A hive with no declaration no longer counts as placing nothing: its copies and its agents' user lines stay. The restic password is pinned by tests across a revoke, a re-placement and a move.
This commit is contained in:
parent
306aae0378
commit
91f36f39d2
1 changed files with 241 additions and 52 deletions
|
|
@ -965,13 +965,28 @@ pub(crate) async fn placements(
|
|||
wanted: &wanted::WantedWriter,
|
||||
hives: &[String],
|
||||
) -> Result<std::collections::BTreeSet<(String, String)>> {
|
||||
Ok(placements_with_gaps(wanted, hives).await?.0)
|
||||
}
|
||||
|
||||
/// [`placements`], and the hives that have no declaration at all. Such a hive
|
||||
/// places nothing here, but the queue cannot tell a hive that never had agents
|
||||
/// from one whose declaration is not there (yet).
|
||||
pub(crate) async fn placements_with_gaps(
|
||||
wanted: &wanted::WantedWriter,
|
||||
hives: &[String],
|
||||
) -> Result<(
|
||||
std::collections::BTreeSet<(String, String)>,
|
||||
std::collections::BTreeSet<String>,
|
||||
)> {
|
||||
let mut placed = std::collections::BTreeSet::new();
|
||||
let mut undeclared = std::collections::BTreeSet::new();
|
||||
for hive in hives {
|
||||
let Some(declared) = wanted
|
||||
.view(hive)
|
||||
.await
|
||||
.map_err(|e| e.context(format!("read where hive {hive} places agents")))?
|
||||
else {
|
||||
undeclared.insert(hive.clone());
|
||||
continue;
|
||||
};
|
||||
placed.extend(
|
||||
|
|
@ -982,7 +997,7 @@ pub(crate) async fn placements(
|
|||
.map(|(name, _)| (hive.clone(), name)),
|
||||
);
|
||||
}
|
||||
Ok(placed)
|
||||
Ok((placed, undeclared))
|
||||
}
|
||||
|
||||
/// Every agent in `placements`, with its archetype.
|
||||
|
|
|
|||
Loading…
Reference in a new issue