Commit b5dfc04e authored by mh's avatar mh
Browse files

run the upgrade for all, report overall status at the end

parent b2e68727
...@@ -25,11 +25,13 @@ end ...@@ -25,11 +25,13 @@ end
# the main method # the main method
def run_script def run_script
log "Starting wordpress upgrade" log "Starting wordpress upgrade"
success = wp_directories.all? do |wd| # run the upgrade for all, report
# overall status at the end
success = wp_directories.map do |wd|
upgrade_wordpress(wd) upgrade_wordpress(wd)
end end
log "Finished wordpress upgrade" log "Finished wordpress upgrade"
return success return success.all?
end end
## script specific methods ## script specific methods
...@@ -75,11 +77,16 @@ def upgrade_wordpress(wd) ...@@ -75,11 +77,16 @@ def upgrade_wordpress(wd)
# run the upgrade as sftp user # run the upgrade as sftp user
log "Running the upgrade script in #{wd}" log "Running the upgrade script in #{wd}"
cmd_prefix = options['scl'] ? "scl enable #{options['scl']} -- " : '' cmd_prefix = options['scl'] ? "scl enable #{options['scl']} -- " : ''
sudo(sftp_user_uid,group_gid) do status = sudo(sftp_user_uid,group_gid) do
cmd("#{cmd_prefix}/usr/local/bin/upgrade_wordpress #{shellescape(wd)}") cmd("#{cmd_prefix}/usr/local/bin/upgrade_wordpress #{shellescape(wd)}")
end end
log "Upgrading Wordpress in #{wd} finished." if status.exitstatus > 0
return true log "Error while upgrading Wordpress in #{wd} - Exitcode: #{status.exitstatus}"
return false
else
log "Upgrading Wordpress in #{wd} finished."
return true
end
rescue => e rescue => e
log "Error while upgrading wordpress in #{wd}: #{e.message}" log "Error while upgrading wordpress in #{wd}: #{e.message}"
return false return false
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment