Merge pull request #3655 from reasonerjt/scanjob-permission-fix

Fix permission issue in job_log directory
This commit is contained in:
Yan 2017-11-21 23:28:39 +08:00 committed by GitHub
commit bef15d6180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -5,5 +5,8 @@ fi
if [ -d /var/log/jobs ]; then if [ -d /var/log/jobs ]; then
chown -R 10000:10000 /var/log/jobs/ chown -R 10000:10000 /var/log/jobs/
fi fi
if [ -d /var/log/jobs/scan_job ]; then
chmod +x /var/log/jobs/scan_job
fi
sudo -E -u \#10000 "/harbor/harbor_jobservice" sudo -E -u \#10000 "/harbor/harbor_jobservice"

View File

@ -28,7 +28,7 @@ func NewLogger(j Job) (*log.Logger, error) {
logFile := j.LogPath() logFile := j.LogPath()
d := filepath.Dir(logFile) d := filepath.Dir(logFile)
if _, err := os.Stat(d); os.IsNotExist(err) { if _, err := os.Stat(d); os.IsNotExist(err) {
err := os.MkdirAll(d, 0660) err := os.MkdirAll(d, 0755)
if err != nil { if err != nil {
log.Errorf("Failed to create directory for log file %s, the error: %v", logFile, err) log.Errorf("Failed to create directory for log file %s, the error: %v", logFile, err)
} }