Add 'php/phpxmlrpc/' from commit 'cd5dbb4a511e7a616a61187a5de1a611a9748cbd'
[plcapi.git] / PLC / Methods / AddSite.py
index 09d7507..2150a91 100644 (file)
@@ -1,11 +1,11 @@
-# $Id$
-# $URL$
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Sites import Site, Sites
 from PLC.Auth import Auth
 
+from PLC.Methods.AddSiteTag import AddSiteTag
+
 can_update = lambda (field, value): field in \
              ['name', 'abbreviated_name', 'login_base',
               'is_public', 'latitude', 'longitude', 'url',
@@ -40,4 +40,11 @@ class AddSite(Method):
         self.event_objects = {'Site': [site['site_id']]}
         self.message = 'Site %d created' % site['site_id']
 
+        # Set Site HRN
+        root_auth = self.api.config.PLC_HRN_ROOT
+        tagname = 'hrn'
+        tagvalue = '.'.join([root_auth, site['login_base']])
+        AddSiteTag(self.api).__call__(auth,site['site_id'],tagname,tagvalue)
+
+
         return site['site_id']