Skip to content

Commit

Permalink
feat: test backup directory is writable to avoid chown (apache#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
smoldenhauer-ish committed Apr 3, 2023
1 parent 23ac993 commit a91fb00
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion controllers/util/solr_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ func generateSolrSetupInitContainers(solrCloud *solr.SolrCloud, solrCloudStatus
},
}
setupCommands := []string{"cp /tmp/solr.xml /tmp-config/solr.xml"}
setupCommands = append(setupCommands, fmt.Sprintf("adduser -u %d -H -D solr", DefaultSolrUser))

// Add prep for backup-restore Repositories
// This entails setting the correct permissions for the directory
Expand All @@ -602,7 +603,8 @@ func generateSolrSetupInitContainers(solrCloud *solr.SolrCloud, solrCloudStatus
volumeMounts = append(volumeMounts, *volumeMount)

setupCommands = append(setupCommands, fmt.Sprintf(
"chown -R %d:%d %s",
"(su solr -c 'test -w %s' || chown -R %d:%d %s)",
volumeMount.MountPath,
DefaultSolrUser,
DefaultSolrGroup,
volumeMount.MountPath))
Expand Down

0 comments on commit a91fb00

Please sign in to comment.