summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-01 12:44:25 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-01 12:44:25 -0400
commita1510cf749295fe10760dabd0a5ecc4e2fc8a725 (patch)
treeb81456bcb778360450ea5d86235cdbbf3009ba4f
parent3ea3d3b103855ca46a1e1557b0017820bbc4e800 (diff)
downloadbcfg2-a1510cf749295fe10760dabd0a5ecc4e2fc8a725.tar.gz
bcfg2-a1510cf749295fe10760dabd0a5ecc4e2fc8a725.tar.bz2
bcfg2-a1510cf749295fe10760dabd0a5ecc4e2fc8a725.zip
made path to Packages cache configurable
-rw-r--r--doc/server/plugins/generators/packages.txt72
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/__init__.py39
2 files changed, 71 insertions, 40 deletions
diff --git a/doc/server/plugins/generators/packages.txt b/doc/server/plugins/generators/packages.txt
index fc2e30980..43db251b0 100644
--- a/doc/server/plugins/generators/packages.txt
+++ b/doc/server/plugins/generators/packages.txt
@@ -695,38 +695,52 @@ Configuration
``bcfg2.conf`` contains miscellaneous configuration options for the
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.
+"off" for False. For historical reasons, ``resolver`` and
+``metadata`` also accept "enabled" and "disabled".
It understands the following directives:
[packages] section
------------------
-* ``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). If ``metadata`` is disabled, it's implied that ``resolver``
- is also disabled. 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
- default.
-* ``gpg_keypath``: The path on the client RPM GPG keys will be copied
- to before they are imported on the client. Default is
- "/etc/pki/rpm-gpg".
-* ``version``: Set the version attribute used when binding
- Packages. Default is ``auto``.
++-------------+------------------------------------------------------+----------+-----------------------------+
+| Name | Description | Values | Default |
++=============+======================================================+==========+=============================+
+| resolver | Enable dependency resolution | Boolean | True |
++-------------+------------------------------------------------------+----------+-----------------------------+
+| metadata | Enable metadata processing. Disabling ``metadata`` | Boolean | True |
+| | implies disabling ``resolver`` as well. | | |
++-------------+------------------------------------------------------+----------+-----------------------------+
+| yum_config | The path at which to generate Yum configs. | String | /etc/yum.repos.d/bcfg2.repo |
++-------------+------------------------------------------------------+----------+-----------------------------+
+| apt_config | The path at which to generate APT configs. | String | /etc/apt/sources.d/bcfg2 |
++-------------+------------------------------------------------------+----------+-----------------------------+
+| gpg_keypath | The path on the client RPM GPG keys will be copied | String | /etc/pki/rpm-gpg |
+| | to before they are imported on the client. | | |
++-------------+------------------------------------------------------+----------+-----------------------------+
+| version | Set the version attribute used when binding Packages | any|auto | auto |
++-------------+------------------------------------------------------+----------+-----------------------------+
+| cache | Path where Packages will store its cache | String | <repo>/Packages/cache |
++-------------+------------------------------------------------------+----------+-----------------------------+
+| keycache | Path where Packages will cache downloaded GPG keys | String | <repo>/Packages/keys |
++-------------+------------------------------------------------------+----------+-----------------------------+
+
[packages:yum] section
----------------------
-* ``use_yum_libraries``: Whether or not to use the :ref:`native yum
- library support <native-yum-libraries>`. Default is ``0`` (false).
-* ``helper``: Path to ``bcfg2-yum-helper``. By default, Bcfg2 looks
- first in ``$PATH`` and then in ``/usr/sbin/bcfg2-yum-helper`` for
- the helper.
++-------------------+----------------------------------------------------------+---------+-----------+
+| Name | Description | Values | Default |
++===================+==========================================================+=========+===========+
+| use_yum_libraries | Whether or not to use the | Boolean | False |
+| | :ref:`native yum library support <native-yum-libraries>` | | |
++-------------------+----------------------------------------------------------+---------+-----------+
+| helper | Path to ``bcfg2-yum-helper`` | String | See below |
++-------------------+----------------------------------------------------------+---------+-----------+
+
+To find ``bcfg2-yum-helper`` if none is specified, Bcfg2 looks first
+in ``$PATH`` and then in ``/usr/sbin/bcfg2-yum-helper`` for the
+helper.
All other options in the ``[packages:yum]`` section will be passed
along verbatim to the Yum configuration if you are using the native
@@ -735,7 +749,13 @@ Yum library support.
[packages:pulp] section
-----------------------
-* ``username`` and ``password``: The username and password of a Pulp
- user that will be used to register new clients and bind them to
- repositories. Membership in the default ``consumer-users`` role is
- sufficient.
++----------+-----------------------------------------------------+--------+---------+
+| Name | Description | Values | Default |
++==========+=====================================================+========+=========+
+| username | The username of a Pulp user that will be used to | String | None |
+| | register new clients and bind them to repositories. | | |
++----------+-----------------------------------------------------+--------+---------+
+| password | The password of the Pulp user | String | None |
++----------+-----------------------------------------------------+--------+---------+
+
+The user should be a member of the default ``consumer-users`` role.
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
index 3e46ec67c..e76f648d0 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py
@@ -11,6 +11,9 @@ from Bcfg2.Bcfg2Py3k import ConfigParser, urlopen
from Bcfg2.Server.Plugins.Packages import Collection
from Bcfg2.Server.Plugins.Packages.PackagesSources import PackagesSources
+yum_config_default = "/etc/yum.repos.d/bcfg2.repo"
+apt_config_default = "/etc/apt/sources.d/bcfg2"
+
class Packages(Bcfg2.Server.Plugin.Plugin,
Bcfg2.Server.Plugin.StructureValidator,
Bcfg2.Server.Plugin.Generator,
@@ -29,8 +32,12 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
Bcfg2.Server.Plugin.ClientRunHooks.__init__(self)
self.sentinels = set()
- self.cachepath = os.path.join(self.data, 'cache')
- self.keypath = os.path.join(self.data, 'keys')
+ self.cachepath = \
+ self.core.setup.cfp.get("packages", "cache",
+ default=os.path.join(self.data, 'cache'))
+ self.keypath = \
+ self.core.setup.cfp.get("packages", "keycache",
+ default=os.path.join(self.data, 'keys'))
if not os.path.exists(self.keypath):
# create key directory if needed
os.makedirs(self.keypath)
@@ -96,12 +103,14 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
default="auto"))
entry.set('type', collection.ptype)
elif entry.tag == 'Path':
- if (entry.get("name") == self.core.setup.cfp.get("packages",
- "yum_config",
- default="") or
- entry.get("name") == self.core.setup.cfp.get("packages",
- "apt_config",
- default="")):
+ if (entry.get("name") == \
+ self.core.setup.cfp.get("packages",
+ "yum_config",
+ default=yum_config_default) or
+ entry.get("name") == \
+ self.core.setup.cfp.get("packages",
+ "apt_config",
+ default=apt_config_default)):
self.create_config(entry, metadata)
def HandlesEntry(self, entry, metadata):
@@ -115,12 +124,14 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
return True
elif entry.tag == 'Path':
# managed entries for yum/apt configs
- if (entry.get("name") == self.core.setup.cfp.get("packages",
- "yum_config",
- default="") or
- entry.get("name") == self.core.setup.cfp.get("packages",
- "apt_config",
- default="")):
+ if (entry.get("name") == \
+ self.core.setup.cfp.get("packages",
+ "yum_config",
+ default=yum_config_default) or
+ entry.get("name") == \
+ self.core.setup.cfp.get("packages",
+ "apt_config",
+ default=apt_config_default)):
return True
return False