git.delta.rocks / jrsonnet / refs/commits / 718d88b1fcc6

difftreelog

fix post-refactor

Yaroslav Bolyukin2024-01-01parent: #d0d2d55.patch.diff
in: trunk

3 files changed

modifiedcmds/fleet/src/cmds/secrets/mod.rsdiffbeforeafterboth
167167
168 let on: String = nix_go_json!(default_generator.impureOn);168 let on: String = nix_go_json!(default_generator.impureOn);
169 let call_package = nix_go!(169 let call_package = nix_go!(
170 config_field.buildableSystems(Obj {170 config_field.hosts[{ on }]
171 localSystem: { config.local_system.clone() },171 .nixosSystem
172 })[{ on }]
173 .config172 .config
174 .nixpkgs173 .nixpkgs
175 .resolvedPkgs174 .resolvedPkgs
486 }485 }
487486
488 let config_field = &config.config_unchecked_field;487 let config_field = &config.config_unchecked_field;
489 let config_field = nix_go!(config_field.configUnchecked);
490 let field = nix_go!(config_field.sharedSecrets[{ name }]);488 let field = nix_go!(config_field.sharedSecrets[{ name }]);
491489
492 let updated = update_owner_set(490 let updated = update_owner_set(
512 let shared_set = config.list_shared().into_iter().collect::<HashSet<_>>();510 let shared_set = config.list_shared().into_iter().collect::<HashSet<_>>();
513 for missing in expected_shared_set.difference(&shared_set) {511 for missing in expected_shared_set.difference(&shared_set) {
514 let config_field = &config.config_unchecked_field;512 let config_field = &config.config_unchecked_field;
515 let config_field = nix_go!(config_field.configUnchecked);
516 let secret = nix_go!(config_field.sharedSecrets[{ missing }]);513 let secret = nix_go!(config_field.sharedSecrets[{ missing }]);
517 let expected_owners: Option<Vec<String>> =514 let expected_owners: Option<Vec<String>> =
518 nix_go_json!(secret.expectedOwners);515 nix_go_json!(secret.expectedOwners);
561 info!("updating secret: {name}");558 info!("updating secret: {name}");
562 let data = config.shared_secret(name)?;559 let data = config.shared_secret(name)?;
563 let config_field = &config.config_unchecked_field;560 let config_field = &config.config_unchecked_field;
564 let config_field = nix_go!(config_field.configUnchecked);
565 let expected_owners: Vec<String> =561 let expected_owners: Vec<String> =
566 nix_go_json!(config_field.sharedSecrets[{ name }].expectedOwners);562 nix_go_json!(config_field.sharedSecrets[{ name }].expectedOwners);
567 if expected_owners.is_empty() {563 if expected_owners.is_empty() {
modifiedcmds/fleet/src/host.rsdiffbeforeafterboth
204204
205 pub async fn host(&self, name: &str) -> Result<ConfigHost> {205 pub async fn host(&self, name: &str) -> Result<ConfigHost> {
206 let config = &self.config_unchecked_field;206 let config = &self.config_unchecked_field;
207 let nixos_config = nix_go!(config.configuredSystems[{ name }].config);207 let nixos_config = nix_go!(config.hosts[{ name }].nixosSystem.config);
208 Ok(ConfigHost {208 Ok(ConfigHost {
209 config: self.clone(),209 config: self.clone(),
210 name: name.to_owned(),210 name: name.to_owned(),
236 /// Shared secrets configured in fleet.nix or in flake236 /// Shared secrets configured in fleet.nix or in flake
237 pub async fn list_configured_shared(&self) -> Result<Vec<String>> {237 pub async fn list_configured_shared(&self) -> Result<Vec<String>> {
238 let config_field = &self.config_unchecked_field;238 let config_field = &self.config_unchecked_field;
239 nix_go!(config_field.configUnchecked.sharedSecrets)239 nix_go!(config_field.sharedSecrets).list_fields().await
240 .list_fields()
241 .await
242 }240 }
299 pub async fn shared_secret_expected_owners(&self, secret: &str) -> Result<Vec<String>> {297 pub async fn shared_secret_expected_owners(&self, secret: &str) -> Result<Vec<String>> {
300 let config_field = &self.config_unchecked_field;298 let config_field = &self.config_unchecked_field;
301 Ok(nix_go_json!(299 Ok(nix_go_json!(
302 config_field.configUnchecked.sharedSecrets[{ secret }].expectedOwners300 config_field.sharedSecrets[{ secret }].expectedOwners
303 ))301 ))
304 }302 }
305303
modifiedlib/default.nixdiffbeforeafterboth
22 ++ [22 ++ [
23 data23 data
24 ({...}: {24 ({...}: {
25 inherit globalModules hosts;25 inherit globalModules hosts overlays;
26 })26 })
27 ]27 ]
28 ++ modules;28 ++ modules;
39 root,39 root,
40 data,40 data,
41 }: {41 }: {
42 configuredHosts = root.config.hosts;
43 config = root.config;42 config = root.config;
44 };43 };
45 defaultData = withData {44 defaultData = withData {
49 uncheckedData = withData {inherit data root;};48 uncheckedData = withData {inherit data root;};
50 in {49 in {
51 inherit nixpkgs overlays;50 inherit nixpkgs overlays;
52 inherit (defaultData) configuredHosts configuredSystems config buildableSystems;51 inherit (defaultData) config;
53 unchecked = {52 unchecked = {
54 inherit (uncheckedData) configuredHosts configuredSystems config buildableSystems;53 inherit (uncheckedData) config;
55 };54 };
56 };55 };
57}56}