You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am running machineid in a code sandbox that uses a docker container. The package fails with error:
Traceback (mostrecentcalllast):
File"/workspace/run.py", line8, in<module>File"/usr/local/lib/python3.10/site-packages/machineid/__init__.py", line103, inhashed_idreturnhmac.new(bytes(app_id.encode()), id().encode(), hashlib.sha256).hexdigest()
File"/usr/local/lib/python3.10/site-packages/machineid/__init__.py", line94, inidraiseException('failed to obtain id on platform {}'.format(platform))
Exception: failedtoobtainidonplatformlinux
Checking the package, I have the following id() method:
defid() ->str:
""" id returns the platform specific device GUID of the current host OS. """ifplatform=='darwin':
id=__exec__("ioreg -d2 -c IOPlatformExpertDevice | awk -F\\\" '/IOPlatformUUID/{print $(NF-1)}'")
ifplatform=='win32'orplatform=='cygwin'orplatform=='msys':
id=__reg__('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography', 'MachineGuid')
ifnotid:
id=__exec__('wmic csproduct get uuid').split('\n')[2] \
.strip()
ifplatform.startswith('linux'):
id=__read__('/var/lib/dbus/machine-id')
ifnotid:
id=__read__('/etc/machine-id')
ifnotid:
cgroup=__read__('/proc/self/cgroup')
ifcgroup:
if'docker'incgroup:
id=__exec__('head -1 /proc/self/cgroup | cut -d/ -f3')
ifnotid:
mountinfo=__read__('/proc/self/mountinfo')
ifmountinfo:
if'docker'inmountinfo:
id=__exec__("grep 'systemd' /proc/self/mountinfo | cut -d/ -f3")
ifplatform.startswith('openbsd') orplatform.startswith('freebsd'):
id=__read__('/etc/hostid')
ifnotid: id=__exec__('kenv -q smbios.system.uuid')
ifnotid:
raiseException('failed to obtain id on platform {}'.format(platform))
returnid
In particular, I am running docker in linux, so I'm interested in the commands. As expected by the error, none of the linux specific paths has a valid machine id associated with it. We're wondering if this should be trying to read /etc/hostname if the other two checks fail?
The text was updated successfully, but these errors were encountered:
Hi, I am running
machineid
in a code sandbox that uses a docker container. The package fails with error:Checking the package, I have the following
id()
method:In particular, I am running docker in linux, so I'm interested in the commands. As expected by the error, none of the linux specific paths has a valid machine id associated with it. We're wondering if this should be trying to read
/etc/hostname
if the other two checks fail?The text was updated successfully, but these errors were encountered: