summaryrefslogtreecommitdiffstats
path: root/src/lib/Server
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-11-19 05:25:25 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-11-19 05:25:25 +0000
commitddc74a543f53d4197e990def51628f961af5b8cd (patch)
treee432e743fff65d7342bce7e47f07a99a9ec4f899 /src/lib/Server
parent18f8668b60cea58fa26ae96c81e201e321547e1a (diff)
downloadbcfg2-ddc74a543f53d4197e990def51628f961af5b8cd.tar.gz
bcfg2-ddc74a543f53d4197e990def51628f961af5b8cd.tar.bz2
bcfg2-ddc74a543f53d4197e990def51628f961af5b8cd.zip
POSIX: Remove support for old-style posix entries
This commit forces the user to specify <Path> entries on the server side while still maintaining compatibility with old clients via the POSIXCompat plugin. Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5582 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r--src/lib/Server/Plugin.py3
-rw-r--r--src/lib/Server/Plugins/NagiosGen.py16
-rw-r--r--src/lib/Server/Plugins/SSHbase.py48
-rw-r--r--src/lib/Server/Plugins/Snapshots.py23
-rw-r--r--src/lib/Server/Reports/reports/models_new.py8
-rw-r--r--src/lib/Server/Reports/reports/models_old.py8
6 files changed, 54 insertions, 52 deletions
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py
index 2b8b30f5c..51156a567 100644
--- a/src/lib/Server/Plugin.py
+++ b/src/lib/Server/Plugin.py
@@ -711,7 +711,6 @@ class GroupSpool(Plugin, Generator):
Generator.__init__(self)
if self.data[-1] == '/':
self.data = self.data[:-1]
- self.Entries['ConfigFile'] = {}
self.Entries['Path'] = {}
self.entries = {}
self.handles = {}
@@ -739,7 +738,6 @@ class GroupSpool(Plugin, Generator):
dirpath,
self.es_child_cls,
self.encoding)
- self.Entries['ConfigFile'][ident] = self.entries[ident].bind_entry
self.Entries['Path'][ident] = self.entries[ident].bind_entry
if not posixpath.isdir(epath):
# do not pass through directory events
@@ -751,7 +749,6 @@ class GroupSpool(Plugin, Generator):
if fbase in self.entries:
# a directory was deleted
del self.entries[fbase]
- del self.Entries['ConfigFile'][fbase]
del self.Entries['Path'][fbase]
else:
self.entries[ident].handle_event(event)
diff --git a/src/lib/Server/Plugins/NagiosGen.py b/src/lib/Server/Plugins/NagiosGen.py
index 82326b760..38934f090 100644
--- a/src/lib/Server/Plugins/NagiosGen.py
+++ b/src/lib/Server/Plugins/NagiosGen.py
@@ -29,14 +29,20 @@ class NagiosGen(Bcfg2.Server.Plugin.Plugin,
def __init__(self, core, datastore):
Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore)
Bcfg2.Server.Plugin.Generator.__init__(self)
- self.Entries = {'ConfigFile':
+ self.Entries = {'Path':
{'/etc/nagiosgen.status' : self.createhostconfig,
'/etc/nagios/nagiosgen.cfg': self.createserverconfig}}
- self.client_attrib = {'encoding': 'ascii', 'owner':'root', \
- 'group':'root', 'perms':'0400'}
- self.server_attrib = {'encoding': 'ascii', 'owner':'nagios', \
- 'group':'nagios', 'perms':'0440'}
+ self.client_attrib = {'encoding':'ascii',
+ 'owner':'root',
+ 'group':'root',
+ 'type':'file',
+ 'perms':'0400'}
+ self.server_attrib = {'encoding':'ascii',
+ 'owner':'nagios',
+ 'group':'nagios',
+ 'type':'file',
+ 'perms':'0440'}
def createhostconfig(self, entry, metadata):
'''Build host specific configuration file'''
diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py
index a3690a05a..9739b9801 100644
--- a/src/lib/Server/Plugins/SSHbase.py
+++ b/src/lib/Server/Plugins/SSHbase.py
@@ -13,22 +13,23 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
Bcfg2.Server.Plugin.Generator,
Bcfg2.Server.Plugin.DirectoryBacked,
Bcfg2.Server.Plugin.PullTarget):
- '''The sshbase generator manages ssh host keys (both v1 and v2)
- for hosts. It also manages the ssh_known_hosts file. It can
- integrate host keys from other management domains and similarly
- export its keys. The repository contains files in the following
- formats:
-
- ssh_host_key.H_(hostname) -> the v1 host private key for
- (hostname)
- ssh_host_key.pub.H_(hostname) -> the v1 host public key
- for (hostname)
- ssh_host_(dr)sa_key.H_(hostname) -> the v2 ssh host
- private key for (hostname)
- ssh_host_(dr)sa_key.pub.H_(hostname) -> the v2 ssh host
- public key for (hostname)
- ssh_known_hosts -> the current known hosts file. this
- is regenerated each time a new key is generated.
+ '''
+ The sshbase generator manages ssh host keys (both v1 and v2)
+ for hosts. It also manages the ssh_known_hosts file. It can
+ integrate host keys from other management domains and similarly
+ export its keys. The repository contains files in the following
+ formats:
+
+ ssh_host_key.H_(hostname) -> the v1 host private key for
+ (hostname)
+ ssh_host_key.pub.H_(hostname) -> the v1 host public key
+ for (hostname)
+ ssh_host_(dr)sa_key.H_(hostname) -> the v2 ssh host
+ private key for (hostname)
+ ssh_host_(dr)sa_key.pub.H_(hostname) -> the v2 ssh host
+ public key for (hostname)
+ ssh_known_hosts -> the current known hosts file. this
+ is regenerated each time a new key is generated.
'''
name = 'SSHbase'
__version__ = '$Id$'
@@ -54,7 +55,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
% (self.data))
self.logger.error(ioerr)
raise Bcfg2.Server.Plugin.PluginInitError
- self.Entries = {'ConfigFile':
+ self.Entries = {'Path':
{'/etc/ssh/ssh_known_hosts': self.build_skn,
'/etc/ssh/ssh_host_dsa_key': self.build_hk,
'/etc/ssh/ssh_host_rsa_key': self.build_hk,
@@ -122,7 +123,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
def HandlesEntry(self, entry, _):
'''Handle key entries dynamically'''
- return entry.tag == 'ConfigFile' and \
+ return entry.tag == 'Path' and \
([fpat for fpat in self.keypatterns
if entry.get('name').endswith(fpat)]
or entry.get('name').endswith('ssh_known_hosts'))
@@ -168,7 +169,10 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
for hostkey in hostkeys:
entry.text += "localhost,localhost.localdomain,127.0.0.1 %s" % (
self.entries[hostkey].data)
- permdata = {'owner':'root', 'group':'root', 'perms':'0644'}
+ permdata = {'owner':'root',
+ 'group':'root',
+ 'type':'file',
+ 'perms':'0644'}
[entry.attrib.__setitem__(key, permdata[key]) for key in permdata]
def build_hk(self, entry, metadata):
@@ -181,8 +185,10 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
self.logger.error("%s still not registered" % filename)
raise Bcfg2.Server.Plugin.PluginExecutionError
keydata = self.entries[filename].data
- permdata = {'owner':'root', 'group':'root'}
- permdata['perms'] = '0600'
+ permdata = {'owner':'root',
+ 'group':'root',
+ 'type':'file',
+ 'perms':'0600'}
if entry.get('name')[-4:] == '.pub':
permdata['perms'] = '0644'
[entry.attrib.__setitem__(key, permdata[key]) for key in permdata]
diff --git a/src/lib/Server/Plugins/Snapshots.py b/src/lib/Server/Plugins/Snapshots.py
index b71f085d9..0da9f6ffc 100644
--- a/src/lib/Server/Plugins/Snapshots.py
+++ b/src/lib/Server/Plugins/Snapshots.py
@@ -14,12 +14,11 @@ import threading
logger = logging.getLogger('Snapshots')
-ftypes = ['ConfigFile', 'SymLink', 'Directory']
-datafields = {'Package': ['version'],
+datafields = {
+ 'Package': ['version'],
+ 'Path': ['type'],
'Service': ['status'],
- 'ConfigFile': ['owner', 'group', 'perms'],
- 'Directory': ['owner', 'group', 'perms'],
- 'SymLink': ['to']}
+ }
def build_snap_ent(entry):
basefields = []
@@ -29,7 +28,7 @@ def build_snap_ent(entry):
state = dict([(key, unicode(entry.get(key))) for key in basefields])
desired.update([(key, unicode(entry.get(key))) for key in \
datafields[entry.tag]])
- if entry.tag == 'ConfigFile':
+ if (entry.tag == 'Path') and (entry.get('type') == 'file'):
if entry.text == None:
desired['contents'] = None
else:
@@ -48,7 +47,7 @@ def build_snap_ent(entry):
state.update([(key, unicode(entry.get('current_' + key, entry.get(key)))) \
for key in datafields[entry.tag]])
- if entry.tag == 'ConfigFile' and entry.get('exists', 'true') == 'false':
+ if entry.tag == 'Path' and entry.get('exists', 'true') == 'false':
state = None
return [desired, state]
@@ -92,16 +91,10 @@ class Snapshots(Bcfg2.Server.Plugin.Statistics,
for entry in state.find('.//Bad'):
data = [False, False, unicode(entry.get('name'))] \
+ build_snap_ent(entry)
- if entry.tag in ftypes:
- etag = 'Path'
- else:
- etag = entry.tag
+ etag = entry.tag
entries[etag][entry.get('name')] = data
for entry in state.find('.//Modified'):
- if entry.tag in ftypes:
- etag = 'Path'
- else:
- etag = entry.tag
+ etag = entry.tag
if entry.get('name') in entries[etag]:
data = [True, False, unicode(entry.get('name'))] + \
build_snap_ent(entry)
diff --git a/src/lib/Server/Reports/reports/models_new.py b/src/lib/Server/Reports/reports/models_new.py
index 01e34de55..40c7137a7 100644
--- a/src/lib/Server/Reports/reports/models_new.py
+++ b/src/lib/Server/Reports/reports/models_new.py
@@ -6,12 +6,12 @@ from time import strptime
KIND_CHOICES = (
#These are the kinds of config elements
- ('ConfigFile', 'ConfigFile'),
('Package', 'Package'),
+ ('Path', 'directory'),
+ ('Path', 'file'),
+ ('Path', 'permissions'),
+ ('Path', 'symlink'),
('Service', 'Service'),
- ('SymLink', 'SymLink'),
- ('Directory', 'Directory'),
- ('Permissions','Permissions'),
)
PING_CHOICES = (
#These are possible ping states
diff --git a/src/lib/Server/Reports/reports/models_old.py b/src/lib/Server/Reports/reports/models_old.py
index 575ed0921..9ff15485a 100644
--- a/src/lib/Server/Reports/reports/models_old.py
+++ b/src/lib/Server/Reports/reports/models_old.py
@@ -6,12 +6,12 @@ from time import strptime
KIND_CHOICES = (
#These are the kinds of config elements
- ('ConfigFile', 'ConfigFile'),
('Package', 'Package'),
+ ('Path', 'directory'),
+ ('Path', 'file'),
+ ('Path', 'permissions'),
+ ('Path', 'symlink'),
('Service', 'Service'),
- ('SymLink', 'SymLink'),
- ('Directory', 'Directory'),
- ('Permissions','Permissions'),
)
PING_CHOICES = (
#These are possible ping states