← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1853160] [NEW] uptime code does not work on FreeBSD

 

Public bug reported:

The uptime code in cloudinit/util.py does not work for FreeBSD (any
more)

https://github.com/canonical/cloud-
init/blob/3baabe76a70b28abeee2da77826a35e27cf9019a/cloudinit/util.py#L1806-L1825
(link to the code in question at the time of reporting)


root@container-host-02:~ # python3.6
Python 3.6.9 (default, Oct 24 2019, 01:18:01) 
[GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final 335540)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> libc = ctypes.CDLL('/lib/libc.so.7')
>>> import time
>>> size = ctypes.c_size_t()
>>> buf = ctypes.c_int()
>>> size.value = ctypes.sizeof(buf)
>>> libc.sysctlbyname("kern.boottime", ctypes.byref(buf), ctypes.byref(size), None, 0)
-1
>>> 
root@container-host-02:~ #

and here's what happens when we ask for kern.boottime via sysctl(8):

root@container-host-02:~ # sysctl kern.boottime
kern.boottime: { sec = 1573656128, usec = 384300 } Wed Nov 13 14:42:08 2019
root@container-host-02:~ #

** Affects: cloud-init
     Importance: Undecided
         Status: New


** Tags: freebsd

** Tags added: freebsd

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1853160

Title:
  uptime code does not work on FreeBSD

Status in cloud-init:
  New

Bug description:
  The uptime code in cloudinit/util.py does not work for FreeBSD (any
  more)

  https://github.com/canonical/cloud-
  init/blob/3baabe76a70b28abeee2da77826a35e27cf9019a/cloudinit/util.py#L1806-L1825
  (link to the code in question at the time of reporting)

  
  root@container-host-02:~ # python3.6
  Python 3.6.9 (default, Oct 24 2019, 01:18:01) 
  [GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final 335540)] on freebsd12
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import ctypes
  >>> libc = ctypes.CDLL('/lib/libc.so.7')
  >>> import time
  >>> size = ctypes.c_size_t()
  >>> buf = ctypes.c_int()
  >>> size.value = ctypes.sizeof(buf)
  >>> libc.sysctlbyname("kern.boottime", ctypes.byref(buf), ctypes.byref(size), None, 0)
  -1
  >>> 
  root@container-host-02:~ #

  and here's what happens when we ask for kern.boottime via sysctl(8):

  root@container-host-02:~ # sysctl kern.boottime
  kern.boottime: { sec = 1573656128, usec = 384300 } Wed Nov 13 14:42:08 2019
  root@container-host-02:~ #

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1853160/+subscriptions


Follow ups