54
54
// Used to strip the appended ({uuid}) from the name of an enrollment token. This makes much easier for
55
55
// a container to reference a token by name, without having to know what the generated UUID is for that name.
56
56
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}\)$` )
57
-
58
- skipFileCapabilities bool
59
57
)
60
58
61
59
func newContainerCommand (_ []string , streams * cli.IOStreams ) * cobra.Command {
@@ -144,14 +142,14 @@ all the above actions will be skipped, because the Elastic Agent has already bee
144
142
occurs on every start of the container set FLEET_FORCE to 1.
145
143
` ,
146
144
Run : func (c * cobra.Command , args []string ) {
147
- if err := logContainerCmd (streams ); err != nil {
145
+ if err := logContainerCmd (c , streams ); err != nil {
148
146
logError (streams , err )
149
147
os .Exit (1 )
150
148
}
151
149
},
152
150
}
153
151
154
- cmd .Flags ().BoolVar ( & skipFileCapabilities , skipFileCapabilitiesFlag , false , "" )
152
+ cmd .Flags ().Bool ( skipFileCapabilitiesFlag , false , "skip setting file capabilities " )
155
153
156
154
return & cmd
157
155
}
@@ -164,8 +162,13 @@ func logInfo(streams *cli.IOStreams, a ...interface{}) {
164
162
fmt .Fprintln (streams .Out , a ... )
165
163
}
166
164
167
- func logContainerCmd (streams * cli.IOStreams ) error {
168
- shouldExit , err := initContainer (streams )
165
+ func logContainerCmd (cmd * cobra.Command , streams * cli.IOStreams ) error {
166
+ skipFileCapabilities , err := cmd .Flags ().GetBool (skipFileCapabilitiesFlag )
167
+ if err != nil {
168
+ return err
169
+ }
170
+
171
+ shouldExit , err := initContainer (streams , skipFileCapabilities )
169
172
if err != nil {
170
173
return err
171
174
}
0 commit comments