diff options
-rw-r--r-- | doc/server/plugins/generators/packages.txt | 18 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Packages/__init__.py | 20 |
2 files changed, 29 insertions, 9 deletions
diff --git a/doc/server/plugins/generators/packages.txt b/doc/server/plugins/generators/packages.txt index b566b6fbb..701195ba9 100644 --- a/doc/server/plugins/generators/packages.txt +++ b/doc/server/plugins/generators/packages.txt @@ -130,12 +130,12 @@ Dependency resolution can be disabled by adding this to ``Packages/packages.conf`` in the ``global`` section:: [global] - resolver=disabled + resolver=0 All metadata processing can be disabled as well:: [global] - metadata=disabled + metadata=0 Blacklisting faulty dependencies -------------------------------- @@ -638,13 +638,21 @@ packages.conf ============= ``packages.conf`` contains miscellaneous configuration options for the -Packages plugin. It understands the following directives: +Packages plugin. Any booleans in the config file accept the values +"1", "yes", "true", and "on" for True, and "0", "no", "false", and +"off" for False + +It understands the following directives: [global] section ---------------- -* ``resolver``: Disable dependency resolution. Default is "enabled". -* ``metadata``: Disable metadata processing. Default is "enabled". +* ``resolver``: Enable dependency resolution. Default is ``1`` + (true). For historical reasons, this also accepts "enabled" and + "disabled". +* ``metadata``: Enable metadata processing. Default is ``1`` + (true). For historical reasons, this also accepts "enabled" and + "disabled". * ``yum_config``: The path at which to generate Yum configs. No default. * ``apt_config``: The path at which to generate APT configs. No diff --git a/src/lib/Server/Plugins/Packages/__init__.py b/src/lib/Server/Plugins/Packages/__init__.py index daa20404c..29f4cacd9 100644 --- a/src/lib/Server/Plugins/Packages/__init__.py +++ b/src/lib/Server/Plugins/Packages/__init__.py @@ -47,13 +47,25 @@ class Packages(Bcfg2.Server.Plugin.Plugin, @property def disableResolver(self): - return self.config.get("global", "resolver", - default="enabled").lower() == "disabled" + try: + return not self.config.getboolean("global", "resolver") + except ValueError: + # for historical reasons we also accept "enabled" and + # "disabled", which are not handled according to the + # Python docs but appear to be handled properly by + # ConfigParser in at least some versions + return self.config.get("global", "resolver", + default="enabled").lower() == "disabled" @property def disableMetaData(self): - return self.config.get("global", "metadata", - default="enabled").lower() == "disabled" + try: + return not self.config.getboolean("global", "resolver") + except ValueError: + # for historical reasons we also accept "enabled" and + # "disabled" + return self.config.get("global", "metadata", + default="enabled").lower() == "disabled" def create_config(self, entry, metadata): """ create yum/apt config for the specified host """ |