Mailinglist Archive: yast-devel (246 mails)

< Previous Next >
Re: [yast-devel] Re: [yast-commit] <rest-service> master : system - do reboot/shutdown only in 'production' mode
  • From: Klaus Kaempf <kkaempf@xxxxxxx>
  • Date: Fri, 14 Aug 2009 09:46:57 +0200
  • Message-id: <20090814074657.GC4645@xxxxxxxxxxxxx>
* Martin Vidner <mvidner@xxxxxxx> [Aug 14. 2009 09:07]:
On Thu, Aug 13, 2009 at 09:31:29PM +0200, Klaus Kaempf wrote:
* Ladislav Slezak <lslezak@xxxxxxxxxx> [Aug 13. 2009 19:04]:
+ if ENV['RAILS_ENV'] == 'production'
+ Rails.logger.debug 'Rebooting the computer...'
+ return computer.Reboot == 0

'Reboot' seems to be a function. However according to Ruby naming
conventions 'Reboot' is a class (first letter upper case).

+ else
+ Rails.logger.debug "Skipping reboot in
#{ENV['RAILS_ENV']} mode"
+ return true
+ end

The result of the "when :reboot" case is of boolean type. Let the
'reboot' function also return a boolean and drop the comparison with 0

These are valid points, but "computer" is a HAL object (via DBus):
computer = hal_service.object('/org/freedesktop/Hal/devices/computer')

Ah, now this explains it. ;-)

- The methods return "Int32 return_code". Not worth wrapping to a
boolean, I think.


- Converting method names from ruby_style to DbusStyle could work.
Should I look into it?

Probably not worth it. We just have to take care that such D-Bus
objects are properly encapsulated. The current system/app/models/system.rb
is a proper encapsulation imho.

SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N├╝rnberg)

To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >