MCPcopy
hub / github.com/hashicorp/packer / GetCleanedBuildArgs

Function GetCleanedBuildArgs

command/cli.go:114–131  ·  view source on GitHub ↗

GetCleanedBuildArgs returns a map containing build flags specified to build for tracking within the HCP Packer registry. Most of the arguments are kept as-is, except for the -var args, where only the keys are kept to avoid leaking potential secrets.

(ba *BuildArgs)

Source from the content-addressed store, hash-verified

112// Most of the arguments are kept as-is, except for the -var args, where only
113// the keys are kept to avoid leaking potential secrets.
114func GetCleanedBuildArgs(ba *BuildArgs) map[string]interface{} {
115 cleanedArgs := map[string]interface{}{
116 "debug": ba.Debug,
117 "force": ba.Force,
118 "only": ba.Only,
119 "except": ba.Except,
120 "var-files": ba.VarFiles,
121 "path": ba.Path,
122 }
123
124 var varNames []string
125 for k := range ba.Vars {
126 varNames = append(varNames, k)
127 }
128 cleanedArgs["vars"] = varNames
129
130 return cleanedArgs
131}
132
133// BuildArgs represents a parsed cli line for a `packer build`
134type BuildArgs struct {

Callers 1

RunContextMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…