summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Account.py
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2011-04-05 14:32:29 -0500
committerSol Jerome <sol.jerome@gmail.com>2011-04-06 19:35:21 -0500
commit2d90970d7da08e3c89fe67f4ebf8d0c1cdafeb20 (patch)
tree32bd5e0d28bb6a154f630b6a4f91c55c95c936cc /src/lib/Server/Plugins/Account.py
parent9d8f65a64a5319f3e48dd43e2ea3a3ac4c051f9c (diff)
downloadbcfg2-2d90970d7da08e3c89fe67f4ebf8d0c1cdafeb20.tar.gz
bcfg2-2d90970d7da08e3c89fe67f4ebf8d0c1cdafeb20.tar.bz2
bcfg2-2d90970d7da08e3c89fe67f4ebf8d0c1cdafeb20.zip
Plugins: PY3K + PEP8 fixes
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib/Server/Plugins/Account.py')
-rw-r--r--src/lib/Server/Plugins/Account.py38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/lib/Server/Plugins/Account.py b/src/lib/Server/Plugins/Account.py
index e3ea58761..f67819b9d 100644
--- a/src/lib/Server/Plugins/Account.py
+++ b/src/lib/Server/Plugins/Account.py
@@ -3,6 +3,7 @@ __revision__ = '$Revision$'
import Bcfg2.Server.Plugin
+
class Account(Bcfg2.Server.Plugin.Plugin,
Bcfg2.Server.Plugin.Generator):
"""This module generates account config files,
@@ -21,13 +22,14 @@ class Account(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':{'/etc/passwd':self.from_yp_cb,
- '/etc/group':self.from_yp_cb,
- '/etc/security/limits.conf':self.gen_limits_cb,
- '/root/.ssh/authorized_keys':self.gen_root_keys_cb,
- '/etc/sudoers':self.gen_sudoers}}
+ self.Entries = {'ConfigFile': {'/etc/passwd': self.from_yp_cb,
+ '/etc/group': self.from_yp_cb,
+ '/etc/security/limits.conf': self.gen_limits_cb,
+ '/root/.ssh/authorized_keys': self.gen_root_keys_cb,
+ '/etc/sudoers': self.gen_sudoers}}
try:
- self.repository = Bcfg2.Server.Plugin.DirectoryBacked(self.data, self.core.fam)
+ self.repository = Bcfg2.Server.Plugin.DirectoryBacked(self.data,
+ self.core.fam)
except:
self.logger.error("Failed to load repos: %s, %s" % \
(self.data, "%s/ssh" % (self.data)))
@@ -38,9 +40,11 @@ class Account(Bcfg2.Server.Plugin.Plugin,
fname = entry.attrib['name'].split('/')[-1]
entry.text = self.repository.entries["static.%s" % (fname)].data
entry.text += self.repository.entries["dyn.%s" % (fname)].data
- perms = {'owner':'root', 'group':'root', 'perms':'0644'}
+ perms = {'owner': 'root',
+ 'group': 'root',
+ 'perms': '0644'}
[entry.attrib.__setitem__(key, value) for (key, value) in \
- perms.iteritems()]
+ list(perms.items())]
def gen_limits_cb(self, entry, metadata):
"""Build limits entries based on current ACLs."""
@@ -50,9 +54,11 @@ class Account(Bcfg2.Server.Plugin.Plugin,
self.repository.entries["useraccess"].data.split()]
users = [user for (user, host) in \
useraccess if host == metadata.hostname.split('.')[0]]
- perms = {'owner':'root', 'group':'root', 'perms':'0600'}
+ perms = {'owner': 'root',
+ 'group': 'root',
+ 'perms': '0600'}
[entry.attrib.__setitem__(key, value) for (key, value) in \
- perms.iteritems()]
+ list(perms.items())]
entry.text += "".join(["%s hard maxlogins 1024\n" % uname for uname in superusers + users])
if "*" not in users:
entry.text += "* hard maxlogins 0\n"
@@ -71,9 +77,11 @@ class Account(Bcfg2.Server.Plugin.Plugin,
entry.text = "".join([rdata["%s.key" % user].data for user \
in superusers if \
("%s.key" % user) in rdata])
- perms = {'owner':'root', 'group':'root', 'perms':'0600'}
+ perms = {'owner': 'root',
+ 'group': 'root',
+ 'perms': '0600'}
[entry.attrib.__setitem__(key, value) for (key, value) \
- in perms.iteritems()]
+ in list(perms.items())]
def gen_sudoers(self, entry, metadata):
"""Build root authorized keys file based on current ACLs."""
@@ -88,6 +96,8 @@ class Account(Bcfg2.Server.Plugin.Plugin,
entry.text = self.repository.entries['static.sudoers'].data
entry.text += "".join(["%s ALL=(ALL) ALL\n" % uname \
for uname in superusers])
- perms = {'owner':'root', 'group':'root', 'perms':'0440'}
+ perms = {'owner': 'root',
+ 'group': 'root',
+ 'perms': '0440'}
[entry.attrib.__setitem__(key, value) for (key, value) \
- in perms.iteritems()]
+ in list(perms.items())]