Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3768834
D3162.id8068.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
962 B
Referenced Files
None
Subscribers
None
D3162.id8068.diff
View Options
diff --git a/src/mergedictionaries/sources/git.py b/src/mergedictionaries/sources/git.py
--- a/src/mergedictionaries/sources/git.py
+++ b/src/mergedictionaries/sources/git.py
@@ -79,9 +79,22 @@
return False
+ @staticmethod
+ def get_hostname():
+ env_hostname_keys = [
+ "HOST",
+ "HOSTNAME",
+ ]
+ for key in env_hostname_keys:
+ if key in os.environ:
+ return os.environ[key]
+
+ return subprocess.run(["hostname"], capture_output=True).stdout.decode().strip()
+
@staticmethod
def get_commit_message():
- return f"Sync personal dictionary\n\nSync application: merge-dictionaries\nSync hostname: {os.environ['HOSTNAME']}"
+ hostname = GitRepository.get_hostname()
+ return f"Sync personal dictionary\n\nSync application: merge-dictionaries\nSync hostname: {hostname}"
def run(self, commands):
for command in commands:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 10:52 (20 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2256601
Default Alt Text
D3162.id8068.diff (962 B)
Attached To
Mode
D3162: Get hostname in $HOST or through `hostname`
Attached
Detach File
Event Timeline
Log In to Comment