summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2022-03-01 10:51:30 -0800
committerScott Gasch <[email protected]>2022-03-01 10:51:30 -0800
commit0dc52d000262da329728e01444242e35809e107e (patch)
tree3d44129056e0c1b36e1a44322478c431379ac523
parent7dd95b88a2a1a977506300f337e4b50a2df13141 (diff)
Teach site_location about the .local hostname suffix that the mac
gets when connected to a VPN.
-rw-r--r--site_config.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/site_config.py b/site_config.py
index 7f6410d..5a4eeff 100644
--- a/site_config.py
+++ b/site_config.py
@@ -82,15 +82,18 @@ def other_location() -> str:
>>> x in set(['HOUSE', 'CABIN'])
True
+ >>> y = this_location()
+ >>> x == y
+ False
+
"""
- hostname = platform.node()
- if '.house' in hostname:
- location = 'CABIN'
- elif '.cabin' in hostname:
- location = 'HOUSE'
+ this = this_location()
+ if this == 'HOUSE':
+ return 'CABIN'
+ elif this == 'CABIN':
+ return 'HOUSE'
else:
- raise Exception(f"{hostname} doesn't help me know where I'm running?!")
- return location
+ raise Exception(f"{this} doesn't tell me where I'm running?!")
def this_location() -> str:
@@ -107,6 +110,8 @@ def this_location() -> str:
location = 'HOUSE'
elif '.cabin' in hostname:
location = 'CABIN'
+ elif '.local' in hostname:
+ location = 'HOUSE'
else:
raise Exception(f"{hostname} doesn't help me know where I'm running?!")
return location