File tree Expand file tree Collapse file tree
x-pack/elastic-agent/pkg/agent/cmd Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ const (
3737)
3838
3939var (
40+ // Used to strip the appended ({uuid}) from the name of an enrollment token. This makes much easier for
41+ // a container to reference a token by name, without having to know what the generated UUID is for that name.
4042 tokenNameStrip = regexp .MustCompile (`\s\([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\)$` )
4143)
4244
@@ -327,7 +329,7 @@ func findPolicy(policies []kibanaPolicy) (*kibanaPolicy, error) {
327329func findKey (keys []kibanaAPIKey , policy * kibanaPolicy ) (* kibanaAPIKey , error ) {
328330 tokenName := envWithDefault (defaultTokenName , "FLEET_TOKEN_NAME" )
329331 for _ , key := range keys {
330- name := tokenNameStrip .ReplaceAllString (key .Name , "" )
332+ name := strings . TrimSpace ( tokenNameStrip .ReplaceAllString (key .Name , "" ) )
331333 if name == tokenName && key .PolicyID == policy .ID {
332334 return & key , nil
333335 }
You can’t perform that action at this time.
0 commit comments