(hosts []nix.Host)
| 536 | } |
| 537 | |
| 538 | func execListSecretsAsJson(hosts []nix.Host) error { |
| 539 | deploymentDir, err := filepath.Abs(filepath.Dir(deployment)) |
| 540 | if err != nil { |
| 541 | return err |
| 542 | } |
| 543 | secretsByHost := make(map[string](map[string]secrets.Secret)) |
| 544 | |
| 545 | for _, host := range hosts { |
| 546 | singleHostInList := []nix.Host{host} |
| 547 | for _, host := range singleHostInList { |
| 548 | canonicalSecrets := make(map[string]secrets.Secret) |
| 549 | for name, secret := range host.Secrets { |
| 550 | sourcePath := utils.GetAbsPathRelativeTo(secret.Source, deploymentDir) |
| 551 | secret.Source = sourcePath |
| 552 | canonicalSecrets[name] = secret |
| 553 | } |
| 554 | secretsByHost[host.Name] = canonicalSecrets |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | jsonSecrets, err := json.MarshalIndent(secretsByHost, "", " ") |
| 559 | if err != nil { |
| 560 | return err |
| 561 | } |
| 562 | fmt.Fprintf(os.Stdout, "%s\n", jsonSecrets) |
| 563 | |
| 564 | return nil |
| 565 | } |
| 566 | |
| 567 | func getHosts(deploymentPath string) (hosts []nix.Host, err error) { |
| 568 |
no test coverage detected