On Wednesday, September 19, 2012 5:06:56 AM UTC+10, Andy Parker wrote: > > > Probably OSX since that is what most of the Puppet Labs employees use. >
Sounds good. I'm forced to use Windows XP and I don't have local administrator access. :-) > On Mon, Sep 17, 2012 at 7:39 PM, Alex Harvey wrote: > > > So I am proposing the following changes as a fix to the bug I am working > on > > > - remove the who -b code altogether, including the associated RSpec > test. > > - add a case statement to make it explicit as to which OS uses which > method > > What is the advantage of this over just checking what commands are > available? My fear with something like this is that as the list of > kernels changes this will get out of sync. It also seems to be that > the kernel isn't really the determining facter about how to get > uptime, rather the available command is. > Yes, I take your point. I guess there are advantages and disadvantages in both approaches. Checking only for the availability of a command can lead to similar problems when the same commands get implemented differently on different OSes. Obviously, who -b is one example of this. Or consider the Solaris 'kstat' command. At the moment, it only exists in Solaris, as far as I can tell. But Oracle is porting a whole lot of Solaris features into Oracle Linux. And the open source community often ports features from OpenSolaris into various Linux distributions. If hypothetically kstat gets ported, it probably won't behave in quite the same way as it does in Solaris. All said though I am happy to omit the case statement and follow the structure of the existing code. I spent yesterday afternoon fine tuning Malcolm Howe's suggestion so as to cope with the differences in output of uptime on Solaris, AIX & HP-UX. It means I'll need to test about 64 or more different cases of 'uptime' output ('up 1 day', 'up 1 day, 1 min', 'up 1 day, 1 hr', 'up 1 day, 1:01', 'up 1 day(s)', lots of fun. I think it will actually work on Linux & BSD as well but perhaps it's best not to change the /proc/uptime & sysctl methods). Anyhow how do you feel about the rest of my plan? Would the following be okay - Instead of def self.get_uptime_seconds_unix uptime_proc_uptime or uptime_sysctl or uptime_kstat or uptime_who_dash_b end we could have def self.get_uptime_seconds_unix uptime_proc_uptime or uptime_sysctl or uptime_uptime end TIA, Alex -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-dev/-/2mpA0A7dnZ0J. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.