From 602e6d4985351cd9db55b1fb2c52388e4555e344 Mon Sep 17 00:00:00 2001
From: Faiyaz Ahmed <faiyaza@cs.princeton.edu>
Date: Tue, 25 Nov 2008 19:30:43 +0000
Subject: [PATCH] Merge changes that existed in branch concerning slicefamily
 w/ trunk. Also changed logging in 1.7 branch to be less noisey. Removed
 support for proper.

---
 conf_files.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/conf_files.py b/conf_files.py
index ef4b1f0..fd926a5 100644
--- a/conf_files.py
+++ b/conf_files.py
@@ -48,7 +48,20 @@ class conf_files:
             logger.log('conf_files: cannot find group %s -- %s not updated'%(cf_rec['file_group'],dest))
             return
         url = 'https://%s/%s' % (self.config.PLC_BOOT_HOST, cf_rec['source'])
+        # set node_id at the end of the request - hacky
+        if tools.node_id():
+            if url.find('?') >0: url += '&'
+            else:                url += '?'
+            url += "node_id=%d"%tools.node_id()
+        else:
+            logger.log('%s -- WARNING, cannot add node_id to request'%dest)
+        # pass slicefamily as well, as stored in /etc/planetlab/slicefamily ont the node
+        if tools.slicefamily():
+            if url.find('?') >0: url += '&'
+            else:                url += '?'
+            url += "slicefamily=%s"%tools.slicefamily()
         try:
+            logger.verbose("retrieving URL=%s"%url)
             contents = curlwrapper.retrieve(url, self.config.cacert)
         except xmlrpclib.ProtocolError,e:
             logger.log('conf_files: failed to retrieve %s from %s, skipping' % (dest, url))
@@ -58,7 +71,7 @@ class conf_files:
         if self.system(cf_rec['preinstall_cmd']):
             self.system(err_cmd)
             if not cf_rec['ignore_cmd_errors']: return
-        logger.verbose('conf_files: installing file %s from %s' % (dest, url))
+        logger.log('conf_files: installing file %s from %s' % (dest, url))
         try: os.makedirs(os.path.dirname(dest))
         except OSError: pass
         tools.write_file(dest, lambda f: f.write(contents), mode=mode, uidgid=(uid,gid))
-- 
2.47.0