فهرست منبع

Merge pull request #2014 from enkore/f/hostname->fqdn

posix: use fully-qualified hostname + node ID
enkore 8 سال پیش
والد
کامیت
07049098ee
2فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 2 1
      src/borg/archiver.py
  2. 3 3
      src/borg/platform/posix.pyx

+ 2 - 1
src/borg/archiver.py

@@ -48,7 +48,7 @@ from .helpers import ProgressIndicatorPercent
 from .item import Item
 from .item import Item
 from .key import key_creator, tam_required_file, tam_required, RepoKey, PassphraseKey
 from .key import key_creator, tam_required_file, tam_required, RepoKey, PassphraseKey
 from .keymanager import KeyManager
 from .keymanager import KeyManager
-from .platform import get_flags, umount
+from .platform import get_flags, umount, get_process_id
 from .remote import RepositoryServer, RemoteRepository, cache_if_remote
 from .remote import RepositoryServer, RemoteRepository, cache_if_remote
 from .repository import Repository
 from .repository import Repository
 from .selftest import selftest
 from .selftest import selftest
@@ -1194,6 +1194,7 @@ class Archiver:
 
 
         # Additional debug information
         # Additional debug information
         print('CRC implementation:', crc32.__name__)
         print('CRC implementation:', crc32.__name__)
+        print('Process ID:', get_process_id())
         return EXIT_SUCCESS
         return EXIT_SUCCESS
 
 
     @with_repository()
     @with_repository()

+ 3 - 3
src/borg/platform/posix.pyx

@@ -1,5 +1,6 @@
 import errno
 import errno
 import os
 import os
+import uuid
 import socket
 import socket
 import subprocess
 import subprocess
 
 
@@ -7,6 +8,7 @@ import subprocess
 cdef extern from "wchar.h":
 cdef extern from "wchar.h":
     cdef int wcswidth(const Py_UNICODE *str, size_t n)
     cdef int wcswidth(const Py_UNICODE *str, size_t n)
 
 
+
 def swidth(s):
 def swidth(s):
     str_len = len(s)
     str_len = len(s)
     terminal_width = wcswidth(s, str_len)
     terminal_width = wcswidth(s, str_len)
@@ -21,7 +23,7 @@ def swidth(s):
 # the lock made by the parent, so it needs to use the same PID for that.
 # the lock made by the parent, so it needs to use the same PID for that.
 _pid = os.getpid()
 _pid = os.getpid()
 # XXX this sometimes requires live internet access for issuing a DNS query in the background.
 # XXX this sometimes requires live internet access for issuing a DNS query in the background.
-_hostname = socket.gethostname()
+_hostname = '%s@%s' % (socket.getfqdn(), uuid.getnode())
 
 
 
 
 def get_process_id():
 def get_process_id():
@@ -75,5 +77,3 @@ def local_pid_alive(pid):
 # most POSIX platforms (but not Linux)
 # most POSIX platforms (but not Linux)
 def umount(mountpoint):
 def umount(mountpoint):
     return subprocess.call(['umount', mountpoint])
     return subprocess.call(['umount', mountpoint])
-
-