summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Metadata.py
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2010-01-23 23:12:40 +0000
committerSol Jerome <solj@ices.utexas.edu>2010-01-23 23:12:40 +0000
commitc54cf38556731fbd7f7b5dbe8f02a8f994637932 (patch)
tree64ef4bb7c3f7a89c75208baa244606db7f45435c /src/lib/Server/Plugins/Metadata.py
parentc5f49b7fdccebe00fc6aebd70abf0230bfd3c9e8 (diff)
downloadbcfg2-c54cf38556731fbd7f7b5dbe8f02a8f994637932.tar.gz
bcfg2-c54cf38556731fbd7f7b5dbe8f02a8f994637932.tar.bz2
bcfg2-c54cf38556731fbd7f7b5dbe8f02a8f994637932.zip
Metadata: Write out proper file when clients.xml is a symlink
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5701 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/Metadata.py')
-rw-r--r--src/lib/Server/Plugins/Metadata.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py
index 94e3cfe26..c610cc955 100644
--- a/src/lib/Server/Plugins/Metadata.py
+++ b/src/lib/Server/Plugins/Metadata.py
@@ -5,6 +5,7 @@ import copy
import fcntl
import lxml.etree
import os
+import os.path
import socket
import time
import Bcfg2.Server.Plugin
@@ -501,9 +502,14 @@ class Metadata(Bcfg2.Server.Plugin.Plugin,
raise MetadataRuntimeError
datafile.close()
+ # check if clients.xml is a symlink
+ clientsxml = "%s/%s" % (self.data, 'clients.xml')
+ if os.path.islink(clientsxml):
+ clientsxml = os.readlink(clientsxml)
+
try:
os.rename("%s/%s" % (self.data, 'clients.xml.new'),
- "%s/%s" % (self.data, 'clients.xml'))
+ "%s/%s" % (clientsxml))
except:
self.logger.error("Metadata: Failed to rename clients.xml.new")
raise MetadataRuntimeError