summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-10-28 15:04:03 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-10-28 15:04:03 +0000
commitf03b9ddfaf67766ccfb493eb31e204b5ec87ecbc (patch)
treea1e5deb9b08e63175c6fe35be00481a82bf6ac31 /src/lib
parent0da49314befd28017a1c0949af3b71eb0893b2c7 (diff)
downloadbcfg2-f03b9ddfaf67766ccfb493eb31e204b5ec87ecbc.tar.gz
bcfg2-f03b9ddfaf67766ccfb493eb31e204b5ec87ecbc.tar.bz2
bcfg2-f03b9ddfaf67766ccfb493eb31e204b5ec87ecbc.zip
Fix bcfg2-admin for new host-specific entries
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4955 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Server/Admin/Pull.py28
-rw-r--r--src/lib/Server/Plugins/Cfg.py11
2 files changed, 22 insertions, 17 deletions
diff --git a/src/lib/Server/Admin/Pull.py b/src/lib/Server/Admin/Pull.py
index 6695ca715..4eef85ab0 100644
--- a/src/lib/Server/Admin/Pull.py
+++ b/src/lib/Server/Admin/Pull.py
@@ -1,4 +1,4 @@
-import binascii, difflib, getopt, lxml.etree, time, ConfigParser
+import getopt
import Bcfg2.Server.Admin
class Pull(Bcfg2.Server.Admin.MetadataCore):
@@ -60,23 +60,25 @@ class Pull(Bcfg2.Server.Admin.MetadataCore):
for k, v in data.iteritems():
if v:
new_entry[k] = v
- print new_entry
+ #print new_entry
return new_entry
def Choose(self, choices):
'''Determine where to put pull data'''
if self.mode == 'interactive':
- # FIXME improve bcfg2-admin pull interactive mode to add new entries
- print "Plugin returned choice:"
- if choices[0].all:
- print " => global entry"
- elif choices[0].group:
- print (" => group entry: %s (prio %d)" %
- (choices[0].group, choices[0].prio))
- else:
- print " => host entry: %s" % (choices[0].hostname)
- if raw_input("Use this entry? [yN]: ") in ['y', 'Y']:
- return choices[0]
+ for choice in choices:
+ print "Plugin returned choice:"
+ if id(choice) == id(choices[0]):
+ print "(current entry)",
+ if choice.all:
+ print " => global entry"
+ elif choice.group:
+ print (" => group entry: %s (prio %d)" %
+ (choice.group, choice.prio))
+ else:
+ print " => host entry: %s" % (choice.hostname)
+ if raw_input("Use this entry? [yN]: ") in ['y', 'Y']:
+ return choice
return False
else:
# mode == 'force'
diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py
index 3a4341e73..fee4eb8db 100644
--- a/src/lib/Server/Plugins/Cfg.py
+++ b/src/lib/Server/Plugins/Cfg.py
@@ -86,9 +86,12 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
def list_accept_choices(self, metadata):
'''return a list of candidate pull locations'''
used = self.get_pertinent_entries(metadata)
- if len(used) > 1:
- return []
- return [used[0].specific]
+ ret = []
+ if used:
+ ret.append(used[0].specific)
+ if not ret[0].hostname:
+ ret.append(Bcfg2.Server.Plugin.Specificity(hostname=metadata.hostname))
+ return ret
def build_filename(self, specific):
bfname = self.path + '/' + self.path.split('/')[-1]
@@ -106,7 +109,7 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
logger.info("Wrote file %s" % name)
badattr = [attr for attr in ['owner', 'group', 'perms'] if attr in new_entry]
if badattr:
- if hasattr(self.entries[name.split('/')[-1]], 'infoxml'):
+ if self.infoxml:
print "InfoXML support not yet implemented"
return
metadata_updates = {}