summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2014-10-22 07:58:01 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2014-10-22 13:11:55 -0500
commita3998969ec25acf20d5e42a1166e001288ca7b0e (patch)
tree5122b0bbbb383646a448587334c59b5867a7cec7
parent474462ff24e8f29d715ee80ee0c07acb16eb1dab (diff)
downloadbcfg2-a3998969ec25acf20d5e42a1166e001288ca7b0e.tar.gz
bcfg2-a3998969ec25acf20d5e42a1166e001288ca7b0e.tar.bz2
bcfg2-a3998969ec25acf20d5e42a1166e001288ca7b0e.zip
fixed some places where plugin loading should fail silently
-rw-r--r--src/lib/Bcfg2/Options/Actions.py8
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/__init__.py1
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Svn.py18
3 files changed, 19 insertions, 8 deletions
diff --git a/src/lib/Bcfg2/Options/Actions.py b/src/lib/Bcfg2/Options/Actions.py
index 2916cc194..854e6039d 100644
--- a/src/lib/Bcfg2/Options/Actions.py
+++ b/src/lib/Bcfg2/Options/Actions.py
@@ -113,9 +113,12 @@ class ComponentAction(FinalizableAction):
try:
return getattr(__import__(module, fromlist=[name]), name)
except (AttributeError, ImportError):
+ msg = "Failed to load %s from %s: %s" % (name, module,
+ sys.exc_info()[1])
if not self.fail_silently:
- print("Failed to load %s from %s: %s" %
- (name, module, sys.exc_info()[1]))
+ print(msg)
+ else:
+ _debug(msg)
return None
def _load_component(self, name):
@@ -181,3 +184,4 @@ class PluginsAction(ComponentAction):
""" :class:`Bcfg2.Options.ComponentAction` subclass for loading
Bcfg2 server plugins. """
bases = ['Bcfg2.Server.Plugins']
+ fail_silently = True
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
index d11ac60fe..cb533f4f1 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
@@ -33,6 +33,7 @@ class PackagesBackendAction(Bcfg2.Options.ComponentAction):
""" ComponentAction to load Packages backends """
bases = ['Bcfg2.Server.Plugins.Packages']
module = True
+ fail_silently = True
class OnDemandDict(MutableMapping):
diff --git a/src/lib/Bcfg2/Server/Plugins/Svn.py b/src/lib/Bcfg2/Server/Plugins/Svn.py
index b752650f0..2ca518e53 100644
--- a/src/lib/Bcfg2/Server/Plugins/Svn.py
+++ b/src/lib/Bcfg2/Server/Plugins/Svn.py
@@ -18,12 +18,6 @@ class Svn(Bcfg2.Server.Plugin.Version):
"""Svn is a version plugin for dealing with Bcfg2 repos."""
options = Bcfg2.Server.Plugin.Version.options + [
Bcfg2.Options.Option(
- cf=("svn", "conflict_resolution"), dest="svn_conflict_resolution",
- type=lambda v: v.replace("-", "_"),
- choices=dir(pysvn.wc_conflict_choice), # pylint: disable=E1101
- default=pysvn.wc_conflict_choice.postpone, # pylint: disable=E1101
- help="SVN conflict resolution method"),
- Bcfg2.Options.Option(
cf=("svn", "user"), dest="svn_user", help="SVN username"),
Bcfg2.Options.Option(
cf=("svn", "password"), dest="svn_password", help="SVN password"),
@@ -31,6 +25,18 @@ class Svn(Bcfg2.Server.Plugin.Version):
cf=("svn", "always_trust"), dest="svn_trust_ssl",
help="Always trust SSL certs from SVN server")]
+ if HAS_SVN:
+ options.append(
+ Bcfg2.Options.Option(
+ cf=("svn", "conflict_resolution"),
+ dest="svn_conflict_resolution",
+ type=lambda v: v.replace("-", "_"),
+ # pylint: disable=E1101
+ choices=dir(pysvn.wc_conflict_choice),
+ default=pysvn.wc_conflict_choice.postpone,
+ # pylint: enable=E1101
+ help="SVN conflict resolution method"))
+
__author__ = 'bcfg-dev@mcs.anl.gov'
__vcs_metadata_path__ = ".svn"
if HAS_SVN: