@@ -61,7 +61,7 @@ func createQueueManager(name string, devMode bool) (bool, error) {
6161 return false , err
6262 }
6363
64- dataDir := getQueueManagerDataDir (mounts , name )
64+ dataDir := getQueueManagerDataDir (mounts , replaceCharsInQMName ( name ) )
6565
6666 // Run 'dspmqinf' to check if 'mqs.ini' configuration file exists
6767 // If command succeeds, the queue manager (or standby queue manager) has already been created
@@ -316,7 +316,7 @@ func updateQMini(qmname string) error {
316316 log .Printf ("Error getting mounts for queue manager" )
317317 return err
318318 }
319- dataDir := getQueueManagerDataDir (mounts , qmname )
319+ dataDir := getQueueManagerDataDir (mounts , replaceCharsInQMName ( qmname ) )
320320 qmgrDir := filepath .Join (dataDir , "qm.ini" )
321321 //read the initial version.
322322 // #nosec G304 - qmgrDir filepath is derived from dspmqinf
@@ -337,3 +337,17 @@ func updateQMini(qmname string) error {
337337 }
338338 return nil
339339}
340+
341+ // If queue manager name contains a '.', then the '.' will be replaced with '!'
342+ // in the name of the data directory created by the queue manager. Similarly
343+ // '/' will be replaced with '&'.
344+ func replaceCharsInQMName (qmname string ) string {
345+ replacedName := qmname
346+ if strings .Contains (replacedName , "." ) {
347+ replacedName = strings .ReplaceAll (replacedName , "." , "!" )
348+ }
349+ if strings .Contains (replacedName , "/" ) {
350+ replacedName = strings .ReplaceAll (replacedName , "/" , "&" )
351+ }
352+ return replacedName
353+ }
0 commit comments