pvl/hosts.py
changeset 421 585eadaed270
parent 412 b557b472ffa1
--- a/pvl/hosts.py	Sun Apr 27 01:44:30 2014 +0300
+++ b/pvl/hosts.py	Sat Jul 26 13:42:37 2014 +0300
@@ -184,7 +184,11 @@
             down = None
         
         if not location :
-            location = None
+            location = location_domain = None
+        elif '@' in location:
+            location, location_domain = location.split('@', 1)
+        else:
+            location_domain = None
 
         return cls(host,
                 domain      = domain,
@@ -196,6 +200,7 @@
                 alias6      = alias6,
                 owner       = owner,
                 location    = location,
+                location_domain = location_domain,
                 boot        = boot,
                 forward     = forward,
                 reverse     = reverse,
@@ -211,6 +216,7 @@
             alias=(),
             owner=None,
             location=None,
+            location_domain=None,
             boot=None,
             alias4=None, alias6=None,
             forward=None, reverse=None,
@@ -225,7 +231,8 @@
             ethernet    - { index: ethernet }
             alias       - list
             owner       - str: LDAP uid
-            location    - name
+            location    - location name@ part
+            location_domain - location @domain part
             alias4      - list (CNAME -> A)
             alias6      - list (CNAME -> AAAA)
             forward     - generate forward records, or CNAME into given zone
@@ -243,6 +250,7 @@
         self.alias6 = alias6
         self.owner = owner
         self.location = location
+        self.location_domain = location_domain
         self.boot = boot
         self.forward = forward
         self.reverse = reverse