@@ -207,7 +207,7 @@ func BuildMongoDBReplicaSetStatefulSetModificationFunction(mdb MongoDBStatefulSe
207207
208208 agentLogLevel := mdbv1 .LogLevelInfo
209209 if mdb .GetAgentLogLevel () != "" {
210- agentLogLevel = string ( mdb .GetAgentLogLevel () )
210+ agentLogLevel = mdb .GetAgentLogLevel ()
211211 }
212212
213213 agentLogFile := automationconfig .DefaultAgentLogFile
@@ -256,17 +256,17 @@ func BaseAgentCommand() string {
256256
257257// AutomationAgentCommand withAgentAPIKeyExport detects whether we want to deploy this agent with the agent api key exported
258258// it can be used to register the agent with OM.
259- func AutomationAgentCommand (withAgentAPIKeyExport bool , logLevel string , logFile string , maxLogFileDurationHours int ) []string {
259+ func AutomationAgentCommand (withAgentAPIKeyExport bool , logLevel mdbv1. LogLevel , logFile string , maxLogFileDurationHours int ) []string {
260260 // This is somewhat undocumented at https://www.mongodb.com/docs/ops-manager/current/reference/mongodb-agent-settings/
261261 // Not setting the -logFile option make the mongodb-agent log to stdout. Setting -logFile /dev/stdout will result in
262262 // an error by the agent trying to open /dev/stdout-verbose and still trying to do log rotation.
263263 // To keep consistent with old behavior not setting the logFile in the config does not log to stdout but keeps
264264 // the default logFile as defined by DefaultAgentLogFile. Setting the logFile explictly to "/dev/stdout" will log to stdout.
265265 agentLogOptions := ""
266266 if logFile == "/dev/stdout" {
267- agentLogOptions += " -logLevel " + logLevel
267+ agentLogOptions += " -logLevel " + string ( logLevel )
268268 } else {
269- agentLogOptions += " -logFile " + logFile + " -logLevel " + logLevel + " -maxLogFileDurationHrs " + strconv .Itoa (maxLogFileDurationHours )
269+ agentLogOptions += " -logFile " + logFile + " -logLevel " + string ( logLevel ) + " -maxLogFileDurationHrs " + strconv .Itoa (maxLogFileDurationHours )
270270 }
271271
272272 if withAgentAPIKeyExport {
@@ -275,7 +275,7 @@ func AutomationAgentCommand(withAgentAPIKeyExport bool, logLevel string, logFile
275275 return []string {"/bin/bash" , "-c" , MongodbUserCommand + BaseAgentCommand () + " -cluster=" + clusterFilePath + automationAgentOptions + agentLogOptions }
276276}
277277
278- func mongodbAgentContainer (automationConfigSecretName string , volumeMounts []corev1.VolumeMount , logLevel string , logFile string , maxLogFileDurationHours int , agentImage string ) container.Modification {
278+ func mongodbAgentContainer (automationConfigSecretName string , volumeMounts []corev1.VolumeMount , logLevel mdbv1. LogLevel , logFile string , maxLogFileDurationHours int , agentImage string ) container.Modification {
279279 _ , containerSecurityContext := podtemplatespec .WithDefaultSecurityContextsModifications ()
280280 return container .Apply (
281281 container .WithName (AgentName ),
@@ -284,7 +284,7 @@ func mongodbAgentContainer(automationConfigSecretName string, volumeMounts []cor
284284 container .WithReadinessProbe (DefaultReadiness ()),
285285 container .WithResourceRequirements (resourcerequirements .Defaults ()),
286286 container .WithVolumeMounts (volumeMounts ),
287- container .WithCommand (AutomationAgentCommand (false , logFile , logLevel , maxLogFileDurationHours )),
287+ container .WithCommand (AutomationAgentCommand (false , logLevel , logFile , maxLogFileDurationHours )),
288288 containerSecurityContext ,
289289 container .WithEnvs (
290290 corev1.EnvVar {
0 commit comments