File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 11"""
22ers.api
33
4- Provides class ERS implementing API to Entity Rgistry System.
4+ Provides class ERS implementing API to Entity Registry System.
55
66"""
77import re
88import sys
9- import uuid
109
1110from hashlib import md5
1211from socket import gethostname
@@ -34,14 +33,18 @@ def __init__(self,
3433 self ._init_host_urn ()
3534
3635 def _init_host_urn (self ):
37- fingerprint = md5 (gethostname ()).hexdigest ()
38- self .host_urn = "urn:ers:host:{}" .format (fingerprint )
36+ # Use uuid provided by CouchDB 1.3+, fallback to hostname fingerprint
37+ try :
38+ uid = self .store .info ()['uuid' ]
39+ except KeyError :
40+ uid = md5 (gethostname ()).hexdigest ()
41+ self .host_urn = "urn:ers:host:{}" .format (uid )
3942
4043 def get_machine_uuid (self ):
4144 '''
4245 @return a unique identifier for this ERS node
4346 '''
44- return str ( uuid . getnode ())
47+ return self . host_urn . split ( ':' )[ - 1 ]
4548
4649 def _is_failing (self , url ):
4750 """
You can’t perform that action at this time.
0 commit comments