Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore grafana.db selinux context after engine-restore #916

Merged

Conversation

mwperina
Copy link
Member

Restore proper selinux context for /var/lib/grafana/grafana.db when
restoring from backup created by engine-backup.

Signed-off-by: Martin Perina mperina@redhat.com

Restore proper selinux context for /var/lib/grafana/grafana.db when
restoring from backup created by engine-backup.

Signed-off-by: Martin Perina <mperina@redhat.com>
@mwperina
Copy link
Member Author

/ost basic-suite-master el9stream

@michalskrivanek michalskrivanek merged commit d1b378c into oVirt:master Jan 30, 2024
3 of 4 checks passed
@mwperina mwperina deleted the fix-grafana-context-after-restore branch January 30, 2024 09:38
@@ -1703,7 +1703,8 @@ restoreSQLiteDB() {
chmod 0750 "${db_dir}" 2>> "${LOG}" || logdie "chmod failed"
chown "${dir_owner}" "${db_dir}" 2>> "${LOG}" || output "Warning: ${dir_owner} user or group missing"
fi
cp -a "${backupfile}" "${db_file}" 2>> "${LOG}" || "cp failed"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"cp failed"... 🤦

@@ -1703,7 +1703,8 @@ restoreSQLiteDB() {
chmod 0750 "${db_dir}" 2>> "${LOG}" || logdie "chmod failed"
chown "${dir_owner}" "${db_dir}" 2>> "${LOG}" || output "Warning: ${dir_owner} user or group missing"
fi
cp -a "${backupfile}" "${db_file}" 2>> "${LOG}" || "cp failed"
cp -a "${backupfile}" "${db_file}" 2>> "${LOG}" || logdie "cp failed"
restorecon "${db_file}" || log "Restoring selinux context failed"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM. Looks like a bug - I wonder how come it wasn't reported years ago. Perhaps it only happens if the parent dir is created manually with a non-default context, or something like that - no idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants