Skip to content

Commit

Permalink
fix: filter EUID when sourcing variable files
Browse files Browse the repository at this point in the history
Fixes stuff like this:

```
[root@testbox-arch /]# cat /tmp/test-template-01J6DD4XM9BR40A7HZ5349T5TM
Testing templating!
Printing all variables available, via template
-------------------
Printing host variables:
EUID: 0
mango_group_template_var: Hi, I'm a group variable!
mango_host_template_var: Hi, I'm a host variable!
mango_host_var_for_override: This is the original host variable content.
mango_role_template_var: Hi, I'm a role variable!
package_install: pacman -Sy
-------------------
Printing module variables:
EUID: 0
mango_host_var_for_override: Module has updated host var!
mango_module_template_var: Hi, I'm a module variable!
-------------------
Printing all variables (merged, where module variables override host variables):
EUID: 0
mango_group_template_var: Hi, I'm a group variable!
mango_host_template_var: Hi, I'm a host variable!
mango_host_var_for_override: Module has updated host var!
mango_module_template_var: Hi, I'm a module variable!
mango_role_template_var: Hi, I'm a role variable!
package_install: pacman -Sy
```
  • Loading branch information
tjhop committed Aug 29, 2024
1 parent 58e25f9 commit add15ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type VariableMap map[string]string
// func with const []string return containing environment variables that get
// removed from the environent when sourcing a file
func getEnvVarBlacklist() []string {
return []string{"PWD", "HOME", "PATH", "IFS", "OPTIND", "GID", "UID"}
return []string{"PWD", "HOME", "PATH", "IFS", "OPTIND", "GID", "UID", "EUID"}
}

// SourceFile()/SourceNode() functions inspired heavily by old convenience
Expand Down

0 comments on commit add15ac

Please sign in to comment.