Mailinglist Archive: yast-commit (725 mails)

< Previous Next >
[yast-commit] <rest-service> master : system - do reboot/shutdown only in 'production' mode
  • From: Ladislav Slezak <lslezak@xxxxxxxxxx>
  • Date: Thu, 13 Aug 2009 16:01:38 +0200
  • Message-id: <E1MbdhE-0006S6-Er@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 61a05cdc92bbadef1248298cea49ebd3f98979ed
Author: Ladislav Slezak <lslezak@xxxxxxxxxx>
Date: Thu Aug 13 16:01:38 2009 +0200

system - do reboot/shutdown only in 'production' mode

This prevents rebooting the system during development or from
a test suite.
---
plugins/system/app/models/system.rb | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/plugins/system/app/models/system.rb
b/plugins/system/app/models/system.rb
index 9739a6d..079c635 100644
--- a/plugins/system/app/models/system.rb
+++ b/plugins/system/app/models/system.rb
@@ -46,11 +46,21 @@ class System
case action

when :reboot
- Rails.logger.debug 'Rebooting the computer...'
- return computer.Reboot == 0
+ if ENV['RAILS_ENV'] == 'production'
+ Rails.logger.debug 'Rebooting the computer...'
+ return computer.Reboot == 0
+ else
+ Rails.logger.debug "Skipping reboot in
#{ENV['RAILS_ENV']} mode"
+ return true
+ end
when :shutdown
- Rails.logger.debug 'Shutting down the computer...'
- return computer.Shutdown == 0
+ if ENV['RAILS_ENV'] == 'production'
+ Rails.logger.debug 'Shutting down the computer...'
+ return computer.Shutdown == 0
+ else
+ Rails.logger.debug "Skipping shutdown in
#{ENV['RAILS_ENV']} mode"
+ return true
+ end
else
Rails.logger.error "Unsupported HAL command: #{action}"
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages