difftreelog
fix shared generator condition
in: trunk
10 files changed
cmds/fleet/src/cmds/build_systems.rsdiffbeforeafterbothno syntactic changes
cmds/fleet/src/cmds/secrets/mod.rsdiffbeforeafterbothno syntactic changes
crates/fleet-base/src/fleetdata.rsdiffbeforeafterbothno syntactic changes
crates/nix-eval/src/util.rsdiffbeforeafterboth1use std::time::Instant;1use std::time::Instant;223use anyhow::bail;3use anyhow::bail;4use serde::Deserialize;4use tracing::{debug, warn};5use tracing::{debug, warn};566use crate::{Value, nix_go_json};7use crate::{Value, nix_go_json};89#[derive(Deserialize, Debug)]10struct Assertion {11 assertion: bool,12 message: String,13}7148#[tracing::instrument(level = "info", skip(val))]15#[tracing::instrument(level = "info", skip(val))]9pub async fn assert_warn(action: &str, val: &Value) -> anyhow::Result<()> {16pub async fn assert_warn(action: &str, val: &Value) -> anyhow::Result<()> {10 let before_errors = Instant::now();17 let before_errors = Instant::now();11 let errors: Vec<String> = nix_go_json!(val.errors);18 let errors: Vec<String> = nix_go_json!(val.errors);19 // let assertions: Vec<Assertion> = nix_go_json!(val.assertions);12 debug!("errors evaluation took {:?}", before_errors.elapsed());20 debug!("errors evaluation took {:?} {errors:?} ", before_errors.elapsed());13 if !errors.is_empty() {21 if !errors.is_empty() {14 bail!(22 bail!(15 "failed with error{}{}",23 "failed with error{}{}",crates/nixlike/Cargo.tomldiffbeforeafterboth7[dependencies]7[dependencies]8thiserror.workspace = true8thiserror.workspace = true9910itertools = "0.14.0"10linked-hash-map = "0.5.6"11linked-hash-map = "0.5.6"11peg = "0.8.5"12peg = "0.8.5"12ron = "0.11.0"13ron = "0.11.0"13serde = { version = "1.0.219", features = ["derive"] }14serde = { version = "1.0.219", features = ["derive"] }14serde-transcode = "1.1.1"15serde-transcode = "1.1.1"15serde_json = "1.0.140"16serde_json = "1.0.140"16itertools = "0.14.0"1717lib/default.nixdiffbeforeafterboth152 mkAskPass =152 mkAskPass =153 { prompt ? "Secret value", part ? "secret" }:153 {154 prompt ? "Secret value",155 part ? "secret",156 }:154 (157 (155 {158 {lib/flakePart.nixdiffbeforeafterbothno syntactic changes
modules/nixos.nixdiffbeforeafterbothno syntactic changes
modules/nixos/secrets.nixdiffbeforeafterboth155 assertions = mapAttrsToList (name: secret: let156 assertions = mapAttrsToList (157 name: secret:158 let156 hasSharedDefinition = fleetConfiguration.secrets ? name;159 hasSharedDefinition = fleetConfiguration.secrets ? ${name};157 in {160 in161 {158 assertion = (secret.definition.generator == "shared") == hasSharedDefinition && hasSharedDefinition -> (elem host._module.args.name fleetConfiguration.secrets.${name}.expectedOwners);162 assertion =163 (secret.definition.generator == "shared") == hasSharedDefinition164 && (165 hasSharedDefinition166 -> (elem host._module.args.name fleetConfiguration.secrets.${name}.expectedOwners)167 );159 message = if hasSharedDefinition then"secret ${name} has host-specific secret generator, secrets with host-specific generators can not have shared generator in fleet configuration"168 message =169 if hasSharedDefinition then170 "secret ${name} has host-specific secret generator, secrets with host-specific generators can not have shared generator in fleet configuration"modules/nixos/top-level.nixdiffbeforeafterboth2 pkgs,2 pkgs,3 config,3 config,4 lib,4 lib,5 ...5}:6}:6let7let7 inherit (lib.strings) optionalString;8 inherit (lib.strings) optionalString;