Commit 451aec94 authored by mh's avatar mh
Browse files

make the script reporting it's success

parent 530067ba
......@@ -31,6 +31,7 @@ def run_script
directories['only_webreadable'].each { |path| adjust(path, 'u+rwX,g-w,o-rwx' ) }
directories['web_writable'].each { |path| adjust(path, 'u+rwX,g+rwX,o-rwx' ) }
log "Finished adjusting permissions"
return true
end
## script specific methods
......
......@@ -183,6 +183,7 @@ ensure
tf.unlink
end
success = true
begin
@run_file = ARGV.shift
usage if @run_file.nil? || !File.exists?(@run_file = File.expand_path(@run_file))
......@@ -210,10 +211,13 @@ begin
end
File.open(lockfile,'w'){|f| f << $$ }
run_script
success = run_script
rescue => e
log "Error while running script: #{e.message}"
success = false
ensure
File.delete(@run_file) if File.exists?(@run_file)
File.delete(lockfile)
end
exit success ? 0 : 1
......@@ -47,6 +47,7 @@ def run_script
end
log "Wrote #{keys.size} keys to the authorized_keys file"
log "Finished managing sshkeys"
return true
end
# this will also trigger the run of the script
......
......@@ -33,6 +33,7 @@ def run_script
log "Errors might occur, as files got removed or renamed. You can ignore them in this step."
reset_update_mode
log "done."
return true
end
def perm_file
......
......@@ -25,10 +25,11 @@ end
# the main method
def run_script
log "Starting wordpress upgrade"
wp_directories.each do |wd|
success = wp_directories.all? do |wd|
upgrade_wordpress(wd)
end
log "Finished wordpress upgrade"
return success
end
## script specific methods
......@@ -79,6 +80,7 @@ def upgrade_wordpress(wd)
log "Upgrading Wordpress in #{wd} finished."
rescue => e
log "Error while upgrading wordpress in #{wd}: #{e.message}"
return false
end
# this will also trigger the run of the script
......
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