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)
| 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. |
| 114 | func 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` |
| 134 | type BuildArgs struct { |
no outgoing calls
no test coverage detected
searching dependent graphs…