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 4, 2023
1 parent c16b34e commit 1071393
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 @@ -618,6 +618,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 @@ -627,7 +628,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 1071393

Please sign in to comment.