summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-04-25 12:23:31 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-04-25 12:23:31 +0000
commit31733381b3c2479f79a32a9ecab3ea7ded4d0e8b (patch)
tree9362aada7b361385c80f916495348d07664a63e6
parentfbfe78fdca2b417844a2c70fcf0cb460c1655fcd (diff)
downloadbcfg2-31733381b3c2479f79a32a9ecab3ea7ded4d0e8b.tar.gz
bcfg2-31733381b3c2479f79a32a9ecab3ea7ded4d0e8b.tar.bz2
bcfg2-31733381b3c2479f79a32a9ecab3ea7ded4d0e8b.zip
auto-reformat server fingerprint if needed (Resolves Ticket #546)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4560 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Options.py3
-rw-r--r--src/lib/Server/Admin/Client.py13
-rw-r--r--src/lib/Server/Plugins/Metadata.py4
3 files changed, 13 insertions, 7 deletions
diff --git a/src/lib/Options.py b/src/lib/Options.py
index f52c8bea8..92a71eaf7 100644
--- a/src/lib/Options.py
+++ b/src/lib/Options.py
@@ -155,6 +155,7 @@ class OptionSet(dict):
self[key] = val
list_split = lambda x:x.replace(' ','').split(',')
+flist_split = lambda x:list_split(x.replace(':', '').lower())
def colon_split(c_string):
if c_string:
return c_string.split(':')
@@ -223,7 +224,7 @@ CLIENT_FILE = Option('configure from a file rather than querying the server',
default=False, cmd='-f', odesc='<specification path>')
SERVER_FINGERPRINT = Option('Server Fingerprint', default=[], cmd='-F',
cf=('communication', 'fingerprint'),
- odesc='<f1,f2>', cook=list_split)
+ odesc='<f1,f2>', cook=flist_split)
CLIENT_QUICK = Option('disable some checksum verification', default=False,
cmd='-q', )
CLIENT_BACKGROUND = Option('Daemonize the agent', default=False, cmd='-i', )
diff --git a/src/lib/Server/Admin/Client.py b/src/lib/Server/Admin/Client.py
index 682c12013..9d75a6ab3 100644
--- a/src/lib/Server/Admin/Client.py
+++ b/src/lib/Server/Admin/Client.py
@@ -7,10 +7,15 @@ class Client(Bcfg2.Server.Admin.Mode):
__longhelp__ = __shorthelp__ + '\n\tCreate or delete client entries'
def __init__(self):
Bcfg2.Server.Admin.Mode.__init__(self)
- self.tree = lxml.etree.parse(self.get_repo_path() + \
- '/Metadata/clients.xml')
- self.root = self.tree.getroot()
-
+ try:
+ self.bcore = Bcfg2.Server.Core.Core(self.repo, [], ['Metadata'],
+ 'foo', False)
+ except Bcfg2.Server.Core.CoreInitError, msg:
+ self.errExit("Core load failed because %s" % msg)
+ [bcore.fam.Service() for _ in range(5)]
+ while bcore.fam.Service():
+ pass
+
def __call__(self, args):
Bcfg2.Server.Admin.Mode.__call__(self, args)
if args[0] == 'add':
diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py
index beaa1cc81..25a6bad1e 100644
--- a/src/lib/Server/Plugins/Metadata.py
+++ b/src/lib/Server/Plugins/Metadata.py
@@ -31,7 +31,7 @@ class ClientMetadata(object):
class ProbeSet(Bcfg2.Server.Plugin.EntrySet):
def __init__(self, path, fam):
- fpattern = '[A-Za-z]+'
+ fpattern = '[A-Za-z_\-]+'
Bcfg2.Server.Plugin.EntrySet.__init__(self, fpattern, path, True,
Bcfg2.Server.Plugin.SpecificData)
fam.AddMonitor(path, self)
@@ -262,7 +262,7 @@ class Metadata(Bcfg2.Server.Plugin.Plugin):
try:
datafile = open("%s/%s" % (self.data, 'probed.xml'), 'w')
except IOError:
- self.logger.error("Failed to write clients.xml")
+ self.logger.error("Failed to write probed.xml")
raise MetadataRuntimeError
datafile.write(data)
self.pdirty = False