summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/ACL.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Bzr.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Deps.py10
-rw-r--r--src/lib/Bcfg2/Server/Plugins/FileProbes.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/GroupPatterns.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Ldap.py34
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Metadata.py14
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Yum.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/__init__.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Pkgmgr.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Probes.py4
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Svn.py2
13 files changed, 45 insertions, 41 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/ACL.py b/src/lib/Bcfg2/Server/Plugins/ACL.py
index 3de3f767c..f059eb4f1 100644
--- a/src/lib/Bcfg2/Server/Plugins/ACL.py
+++ b/src/lib/Bcfg2/Server/Plugins/ACL.py
@@ -30,7 +30,7 @@ def rmi_names_equal(first, second):
return False
for i in range(len(first_parts)):
if (first_parts[i] != second_parts[i] and first_parts[i] != '*' and
- second_parts[i] != '*'):
+ second_parts[i] != '*'):
return False
return True
@@ -75,7 +75,7 @@ class IPACLFile(Bcfg2.Server.Plugin.XMLFileBacked):
return self.actions["Defer"]
for entry in self.entries:
if (ip_matches(address, entry) and
- rmi_names_equal(entry.get("method"), rmi)):
+ rmi_names_equal(entry.get("method"), rmi)):
self.debug_log("ACL: %s requests %s: Found matching IP ACL, "
"%s" % (address, rmi, entry.tag.lower()))
return self.actions[entry.tag]
diff --git a/src/lib/Bcfg2/Server/Plugins/Bzr.py b/src/lib/Bcfg2/Server/Plugins/Bzr.py
index f91cc1943..886584477 100644
--- a/src/lib/Bcfg2/Server/Plugins/Bzr.py
+++ b/src/lib/Bcfg2/Server/Plugins/Bzr.py
@@ -23,7 +23,7 @@ class Bzr(Bcfg2.Server.Plugin.Version):
working_tree = WorkingTree.open(Bcfg2.Options.setup.vcs_root)
revision = str(working_tree.branch.revno())
if (working_tree.has_changes(working_tree.basis_tree()) or
- working_tree.unknowns()):
+ working_tree.unknowns()):
revision += "+"
except errors.NotBranchError:
msg = "Failed to read Bazaar branch"
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
index eea0a3456..5b32a91c0 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
@@ -690,7 +690,7 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
rv = []
for ent in self.entries.values():
if (isinstance(ent, handler_type) and
- (not ent.__specific__ or ent.specific.matches(metadata))):
+ (not ent.__specific__ or ent.specific.matches(metadata))):
rv.append(ent)
return rv
diff --git a/src/lib/Bcfg2/Server/Plugins/Deps.py b/src/lib/Bcfg2/Server/Plugins/Deps.py
index fa821aad3..a4fe7aa91 100644
--- a/src/lib/Bcfg2/Server/Plugins/Deps.py
+++ b/src/lib/Bcfg2/Server/Plugins/Deps.py
@@ -33,7 +33,7 @@ class Deps(Bcfg2.Server.Plugin.PrioDir,
if tag.startswith('Bound'):
tag = tag[5:]
if ((tag, entry.get('name')) not in entries
- and not isinstance(entry, lxml.etree._Comment)):
+ and not isinstance(entry, lxml.etree._Comment)):
entries.append((tag, entry.get('name')))
entries.sort()
entries = tuple(entries)
@@ -74,10 +74,10 @@ class Deps(Bcfg2.Server.Plugin.PrioDir,
prio = [int(m[0].priority) for m in matching]
if prio.count(max(prio)) > 1:
raise PluginExecutionError(
- "Deps: Found conflicting dependencies with same "
- "priority for %s:%s for %s: %s" %
- (entry.tag, entry.get("name"),
- metadata.hostname, [m[0].name for m in matching]))
+ "Deps: Found conflicting dependencies with same "
+ "priority for %s:%s for %s: %s" %
+ (entry.tag, entry.get("name"),
+ metadata.hostname, [m[0].name for m in matching]))
index = prio.index(max(prio))
matching = [matching[index]]
if not matching:
diff --git a/src/lib/Bcfg2/Server/Plugins/FileProbes.py b/src/lib/Bcfg2/Server/Plugins/FileProbes.py
index 51eb6e09a..3d0336c36 100644
--- a/src/lib/Bcfg2/Server/Plugins/FileProbes.py
+++ b/src/lib/Bcfg2/Server/Plugins/FileProbes.py
@@ -87,7 +87,7 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin,
# for which update is false; we can't possibly do
# anything with the data we get from such a probe
if (entry.get('update', 'false').lower() == "false" and
- not cfg.has_generator(entry, metadata)):
+ not cfg.has_generator(entry, metadata)):
continue
self.entries[metadata.hostname][path] = entry
probe = lxml.etree.Element('probe', name=path,
diff --git a/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py b/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py
index 90cbd083d..767ae6254 100644
--- a/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py
+++ b/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py
@@ -77,7 +77,7 @@ class PatternFile(Bcfg2.Server.Plugin.XMLFileBacked):
def Index(self):
Bcfg2.Server.Plugin.XMLFileBacked.Index(self)
if (self.core and
- self.core.metadata_cache_mode in ['cautious', 'aggressive']):
+ self.core.metadata_cache_mode in ['cautious', 'aggressive']):
self.core.metadata_cache.expire()
self.patterns = []
for entry in self.xdata.xpath('//GroupPattern'):
diff --git a/src/lib/Bcfg2/Server/Plugins/Ldap.py b/src/lib/Bcfg2/Server/Plugins/Ldap.py
index 6fc89b4f3..2be27c6d7 100644
--- a/src/lib/Bcfg2/Server/Plugins/Ldap.py
+++ b/src/lib/Bcfg2/Server/Plugins/Ldap.py
@@ -73,7 +73,7 @@ class Ldap(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Connector):
Bcfg2.Server.Plugin.Connector.__init__(self)
self.config = ConfigFile(self.data + "/config.py")
- def debug_log(self, message, flag = None):
+ def debug_log(self, message, flag=None):
if (flag is None) and self.debug_flag or flag:
self.logger.error(message)
@@ -82,37 +82,39 @@ class Ldap(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Connector):
try:
data = {}
self.debug_log("LdapPlugin debug: found queries " +
- str(LDAP_QUERIES))
+ str(LDAP_QUERIES))
for QueryClass in LDAP_QUERIES:
query = QueryClass()
if query.is_applicable(metadata):
self.debug_log("LdapPlugin debug: processing query '" +
- query.name + "'")
+ query.name + "'")
data[query.name] = query.get_result(metadata)
else:
self.debug_log("LdapPlugin debug: query '" + query.name +
- "' not applicable to host '" + metadata.hostname + "'")
+ "' not applicable to host '" +
+ metadata.hostname + "'")
return data
except Exception:
if hasattr(query, "name"):
logger.error("LdapPlugin error: " +
- "Exception during processing of query named '" +
- str(query.name) +
- "', query results will be empty" +
- " and may cause bind failures")
+ "Exception during processing of query named '" +
+ str(query.name) +
+ "', query results will be empty" +
+ " and may cause bind failures")
for line in traceback.format_exception(sys.exc_info()[0],
sys.exc_info()[1],
sys.exc_info()[2]):
logger.error("LdapPlugin error: " +
- line.replace("\n", ""))
+ line.replace("\n", ""))
return {}
+
class LdapConnection(object):
"""
Connection to an LDAP server.
"""
- def __init__(self, host = "localhost", port = 389,
- binddn = None, bindpw = None):
+ def __init__(self, host="localhost", port=389,
+ binddn=None, bindpw=None):
self.host = host
self.port = port
self.binddn = binddn
@@ -133,8 +135,8 @@ class LdapConnection(object):
for attempt in range(RETRY_COUNT + 1):
if attempt >= 1:
logger.error("LdapPlugin error: " +
- "LDAP server down (retry " + str(attempt) + "/" +
- str(RETRY_COUNT) + ")")
+ "LDAP server down (retry " + str(attempt) + "/" +
+ str(RETRY_COUNT) + ")")
try:
if not self.conn:
self.init_conn()
@@ -154,6 +156,7 @@ class LdapConnection(object):
def url(self):
return "ldap://" + self.host + ":" + str(self.port)
+
class LdapQuery(object):
"""
Query referencing an LdapConnection and providing several
@@ -210,9 +213,10 @@ class LdapQuery(object):
return self.result
else:
logger.error("LdapPlugin error: " +
- "No valid connection defined for query " + str(self))
+ "No valid connection defined for query " + str(self))
return None
+
class LdapSubQuery(LdapQuery):
"""
SubQueries are meant for internal use only and are not added
@@ -243,5 +247,5 @@ class LdapSubQuery(LdapQuery):
return self.process_result(metadata, **kwargs)
else:
logger.error("LdapPlugin error: " +
- "No valid connection defined for query " + str(self))
+ "No valid connection defined for query " + str(self))
return None
diff --git a/src/lib/Bcfg2/Server/Plugins/Metadata.py b/src/lib/Bcfg2/Server/Plugins/Metadata.py
index db104b27e..073424c90 100644
--- a/src/lib/Bcfg2/Server/Plugins/Metadata.py
+++ b/src/lib/Bcfg2/Server/Plugins/Metadata.py
@@ -520,7 +520,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
self.handlers = dict()
self.groups_xml = self._handle_file("groups.xml")
if (self._use_db and
- os.path.exists(os.path.join(self.data, "clients.xml"))):
+ os.path.exists(os.path.join(self.data, "clients.xml"))):
self.logger.warning("Metadata: database enabled but clients.xml "
"found, parsing in compatibility mode")
self.clients_xml = self._handle_file("clients.xml")
@@ -614,7 +614,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
elif alias:
for child in node:
if (child.tag == "Alias" and
- child.attrib["name"] == name):
+ child.attrib["name"] == name):
return node
return None
@@ -816,7 +816,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
if client.get('secure', 'false').lower() == 'true':
self.secure.append(clname)
if (client.get('location', 'fixed') == 'floating' or
- client.get('floating', 'false').lower() == 'true'):
+ client.get('floating', 'false').lower() == 'true'):
self.floating.append(clname)
if 'password' in client.attrib:
self.passwords[clname] = client.get('password')
@@ -1103,7 +1103,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
for p in self.group_membership[grpname]):
newgroups.add(grpname)
if (grpname in self.groups and
- self.groups[grpname].category):
+ self.groups[grpname].category):
categories[self.groups[grpname].category] = grpname
groups.update(newgroups)
for grpname, predicates in self.negated_groups.items():
@@ -1112,7 +1112,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
if any(p(client, groups, categories) for p in predicates):
removegroups.add(grpname)
if (grpname in self.groups and
- self.groups[grpname].category):
+ self.groups[grpname].category):
del categories[self.groups[grpname].category]
groups.difference_update(removegroups)
return (groups, categories)
@@ -1406,7 +1406,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
# next we validate the address
if (id_method != 'uuid' and
- not self.validate_client_address(client, address)):
+ not self.validate_client_address(client, address)):
return False
if id_method == 'cert' and auth_type != 'cert+password':
@@ -1555,7 +1555,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
for group in egroups:
for parent in group.findall('Group'):
if (parent.get('name') not in gseen and
- include_group(parent.get('name'))):
+ include_group(parent.get('name'))):
rv.append(gfmt % (parent.get('name'),
parent.get('name')))
gseen.append(parent.get("name"))
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
index 5f66cb8a0..b98d3f419 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
@@ -575,7 +575,7 @@ class YumCollection(Collection):
# each pulp source can only have one arch, so we don't
# have to check the arch in url_map
if (source.pulp_id and
- source.pulp_id not in consumer['repoids']):
+ source.pulp_id not in consumer['repoids']):
try:
consumerapi.bind(self.metadata.hostname,
source.pulp_id)
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
index 56285705a..4c685d427 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
@@ -342,7 +342,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
:type collection: Bcfg2.Server.Plugins.Packages.Collection.Collection
"""
if (not Bcfg2.Options.setup.packages_metadata or
- not Bcfg2.Options.setup.packages_resolver):
+ not Bcfg2.Options.setup.packages_resolver):
# Config requests no resolver. Note that disabling
# metadata implies disabling the resolver.
for struct in structures:
@@ -494,7 +494,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
if localfile not in keyfiles:
keyfiles.append(localfile)
if ((force_update and key not in keys) or
- not os.path.exists(localfile)):
+ not os.path.exists(localfile)):
self.logger.info("Packages: Downloading and parsing %s" %
key)
try:
diff --git a/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py b/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py
index c85bc7d41..c7d8986ed 100644
--- a/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py
+++ b/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py
@@ -97,7 +97,7 @@ class PNode(object):
self.contents['Package'] = FuzzyDict()
for pkg in data.findall('./Package'):
if ('name' in pkg.attrib and
- pkg.get('name') not in pdict['Package']):
+ pkg.get('name') not in pdict['Package']):
pdict['Package'].add(pkg.get('name'))
if pkg.get('name') is not None:
self.contents['Package'][pkg.get('name')] = {}
@@ -123,7 +123,7 @@ class PNode(object):
pkg.set('url', '%s/%s' % (pkg.get('uri'),
pkg.get('file')))
if (pkg.get('type') in self.splitters and
- pkg.get('file') is not None):
+ pkg.get('file') is not None):
mdata = \
self.splitters[pkg.get('type')].match(pkg.get('file'))
if not mdata:
diff --git a/src/lib/Bcfg2/Server/Plugins/Probes.py b/src/lib/Bcfg2/Server/Plugins/Probes.py
index 560546c70..568d1b3a0 100644
--- a/src/lib/Bcfg2/Server/Plugins/Probes.py
+++ b/src/lib/Bcfg2/Server/Plugins/Probes.py
@@ -357,7 +357,7 @@ class ProbeSet(Bcfg2.Server.Plugin.EntrySet):
def HandleEvent(self, event):
""" handle events on everything but probed.xml """
if (event.filename != self.path and
- not event.filename.endswith("probed.xml")):
+ not event.filename.endswith("probed.xml")):
return self.handle_event(event)
def get_probe_data(self, metadata):
@@ -384,7 +384,7 @@ class ProbeSet(Bcfg2.Server.Plugin.EntrySet):
probe.set('name', os.path.basename(name))
probe.set('source', self.plugin_name)
if (metadata.version_info and
- metadata.version_info > (1, 3, 1, '', 0)):
+ metadata.version_info > (1, 3, 1, '', 0)):
try:
probe.text = entry.data.decode('utf-8')
except AttributeError:
diff --git a/src/lib/Bcfg2/Server/Plugins/Svn.py b/src/lib/Bcfg2/Server/Plugins/Svn.py
index 679e38ff9..6266e9fd2 100644
--- a/src/lib/Bcfg2/Server/Plugins/Svn.py
+++ b/src/lib/Bcfg2/Server/Plugins/Svn.py
@@ -60,7 +60,7 @@ class Svn(Bcfg2.Server.Plugin.Version):
self.ssl_server_trust_prompt
if (Bcfg2.Options.setup.svn_user and
- Bcfg2.Options.setup.svn_password):
+ Bcfg2.Options.setup.svn_password):
self.client.callback_get_login = self.get_login
self.logger.debug("Svn: Initialized svn plugin with SVN directory %s" %