Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The changes made to the Runner between two releases wait under Unreleased and go

- **Outbound by default:** a Runner started without `RTE_MODE` dials the controller, as the README shows
- **Restricted namespaces:** the jobs' pods meet the restricted Pod Security Standard
- **No inventory:** a form without one no longer has ansible read every file of the playbook's folder as one

## 7.8.0

Expand Down
6 changes: 5 additions & 1 deletion internal/ansible/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,17 @@ func Args(extravars map[string]any, f Files) []string {
if f.Vault {
args = append(args, "--vault-password-file=/bin/cat")
}
// none when the form names none (inventory: ""), as the controller's own Runner does : an
// empty -i would make ansible read every file of the playbook's folder as an inventory
var inventories []any
switch inv := extravars["__inventory__"].(type) {
case nil:
case []any:
inventories = inv
default:
inventories = []any{inv}
if truthy(inv) {
inventories = []any{inv}
}
}
for _, i := range inventories {
if s, ok := i.(string); ok {
Expand Down
4 changes: 4 additions & 0 deletions internal/ansible/prepare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ func TestArgs(t *testing.T) {
if got := strings.Join(Args(map[string]any{"__verbosity__": 9.0}, Files{Extravars: "e", Hidden: "h"}), " "); got != "-e @e -e @h -vvvvv " {
t.Errorf("args %q", got)
}
// a form without an inventory (inventory: "") : no -i at all
if got := strings.Join(Args(map[string]any{"__inventory__": "", "__playbook__": "p"}, Files{Extravars: "e", Hidden: "h"}), " "); got != "-e @e -e @h p" {
t.Errorf("no inventory %q", got)
}
}

// TestPlaybookEnv checks the application's and the Runner's variables never reach a playbook.
Expand Down