Message345486
I have modified -
_NODE_GETTERS_WIN32 = [_windll_getnode, _netbios_getnode, _ipconfig_getnode]
_NODE_GETTERS_UNIX = [_unix_getnode, _ifconfig_getnode, _ip_getnode,
_arp_getnode, _lanscan_getnode, _netstat_getnode]
to:
+683 # _OS_GETTERS, when known, are targetted for a specific OS or platform.
+684 # The order is by 'common practice' on the specified platform.
+685 # Note: 'posix' and 'windows' _OS_GETTERS are prefixed by a dll/dlload() method
+686 # which, when successful, means none of these "external" methods are called.
+687 # _GETTERS is (also) used by test_uuid.py to SkipUnless(), e.g.,
+688 # @unittest.skipUnless(_uuid._ifconfig_getnode in _uuid._GETTERS, ...)
+689 if _LINUX:
+690 _OS_GETTERS = [_ip_getnode, _ifconfig_getnode]
+691 elif _DARWIN:
+692 _OS_GETTERS = [_ifconfig_getnode, _arp_getnode, _netstat_getnode]
+693 elif _WINDOWS:
+694 _OS_GETTERS = [_netbios_getnode, _ipconfig_getnode]
+695 elif _AIX:
+696 _OS_GETTERS = [_netstat_getnode]
+697 else:
+698 _OS_GETTERS = [_ifconfig_getnode, _ip_getnode, _arp_getnode,
+699 _netstat_getnode, _lanscan_getnode]
+700 if os.name == 'posix':
+701 _GETTERS = [_unix_getnode] + _OS_GETTERS
+702 elif os.name == 'nt':
+703 _GETTERS = [_windll_getnode] + _OS_GETTERS
+704 else:
+705 _GETTERS = _OS_GETTERS
The shortened list, and in particular the move of _ip_getnode before _ifconfig_getnode is my experience that the "old" programs such as ifconfig, arp, and netstat are (occasionally) not available - with "ip" being the replacement for all.
Further, re: linux, on the two distros I could test (centos and debian) neither arp nor netstat return a (useable) MACADDR aka "node" value.
Requesting verification from people with other platforms.
Also, would like to know specifics for other platforms (e.g., OpenBSD, HPUX, Solaris).
More generally speaking - if os.name is "posix" or "windows" - this lists are almost irrelevant because the "DLL" _uuid module should provide the needed value.
The "plus" is that on systems that audit such things, there are fewer calls to non-existent programs and/or negative side-effects from calling programs that can/do not provide any useful data. |
|
Date |
User |
Action |
Args |
2019-06-13 09:39:16 | Michael.Felt | set | recipients:
+ Michael.Felt, pitrou, serhiy.storchaka, David.Edelsohn, italip |
2019-06-13 09:39:16 | Michael.Felt | set | messageid: <1560418756.79.0.480626600733.issue28009@roundup.psfhosted.org> |
2019-06-13 09:39:16 | Michael.Felt | link | issue28009 messages |
2019-06-13 09:39:16 | Michael.Felt | create | |
|