Skip to content

Commit

Permalink
Set selinux permissive before backup/restore
Browse files Browse the repository at this point in the history
  • Loading branch information
jc-rh committed Mar 22, 2023
1 parent f42691f commit f4c3b6d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
21 changes: 21 additions & 0 deletions recovery/bindata/upgrade-recovery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ function trigger_redeployment {
function take_backup {
log_info "Taking backup"

setenforce 0
if [ $? -ne 0 ]; then
fatal "Failed to enter permissive mode"
fi

log_info "Wiping previous deployments and pinning active"
while :; do
ostree admin undeploy 1 || break
Expand Down Expand Up @@ -261,6 +266,8 @@ function take_backup {
fatal "Failed to backup additional managed files"
fi

setenforce 1

log_info "Backup complete"
}

Expand Down Expand Up @@ -297,6 +304,11 @@ function check_active_deployment {
function restore_files {
display_current_status

setenforce 0
if [ $? -ne 0 ]; then
fatal "Failed to enter permissive mode"
fi

#
# Wipe current containers by shutting down kubelet, deleting containers and pods,
# then stopping and wiping crio
Expand Down Expand Up @@ -349,11 +361,18 @@ function restore_files {

record_progress "restore_files"

setenforce 1

echo "Please reboot now with 'systemctl reboot', then run '${PROG} --resume'" >&2
exit 0
}

function restore_cluster {
setenforce 0
if [ $? -ne 0 ]; then
fatal "Failed to enter permissive mode"
fi

#
# Restore /var/lib/kubelet content
#
Expand Down Expand Up @@ -411,6 +430,8 @@ function restore_cluster {
log_info "Required containers have restarted"

record_progress "restore_cluster"

setenforce 1
}

function post_restore_steps {
Expand Down
22 changes: 22 additions & 0 deletions recovery/generated/zz_generated.bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f4c3b6d

Please sign in to comment.