From a751399fb77aaeee0312a9ee381257408b317da8 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 21 Sep 2012 07:59:01 -0400 Subject: Packages: deprecated magic groups, disabled by default --- doc/server/plugins/generators/packages.txt | 90 ++++++++++++----------- src/lib/Bcfg2/Server/Plugins/Packages/Source.py | 2 +- src/lib/Bcfg2/Server/Plugins/Packages/__init__.py | 10 ++- 3 files changed, 57 insertions(+), 45 deletions(-) diff --git a/doc/server/plugins/generators/packages.txt b/doc/server/plugins/generators/packages.txt index e97742ca7..0315354a8 100644 --- a/doc/server/plugins/generators/packages.txt +++ b/doc/server/plugins/generators/packages.txt @@ -15,21 +15,52 @@ information, Packages delegates control of package version information to the underlying package manager, installing the latest version available through those channels. +Limiting sources to groups +========================== + +``Packages/sources.xml`` processes ```` and ```` tags +just like Bundles. In addition to any groups or clients specified +that way, clients must +be a member of the appropriate architecture group as specified in a +Source stanza. In total, in order for a source to be associated with +a client, the client must be in one of the magic groups (debian, +ubuntu, or nexenta), any explicit groups or clients specified in +``sources.xml``, and any specified architecture groups. + +Memberships in architecture groups is needed so that Packages can map +software sources to clients. There is no other way to handle this than +to impose membership in the appropriate architecture group. + +When multiple sources are specified, clients are associated with each +source to which they apply (based on group memberships, as described +above). Packages and dependencies are resolved from all applicable +sources. + +.. note:: To recap, a client needs to be a member of the + **Architecture** group and any other groups defined in your + ``Packages/sources.xml`` file in order for the client to be + associated to the proper sources. If you are using + :ref:`server-plugins-generators-packages-magic-groups`, then + a client must also be a member of the appropriate OS group. + .. _server-plugins-generators-packages-magic-groups: "Magic Groups" ============== -Packages is the only plugin that uses "magic groups". Most plugins -operate based on client group memberships, without any concern for the -particular names chosen for groups by the user. The Packages plugin is -the sole exception to this rule. Packages needs to "know" two -different sorts of facts about clients. The first is the basic -OS/distro of the client, enabling classes of sources. The second is -the architecture of the client, enabling sources for a given -architecture. In addition to these magic groups, each source may also -specify non-magic groups to limit the source's applicability to group -member clients. +.. note:: Magic groups are deprecated in 1.3.0 and will be removed in + a future release. They are disabled by default. + +Packages has the ability to use a feature known as "magic groups"; it +is the only plugin to use that feature. Most plugins operate based on +client group memberships, without any concern for the particular names +chosen for groups by the user. The Packages plugin is the sole +exception to this rule. Packages needs to "know" two different sorts +of facts about clients. The first is the basic OS/distro of the +client, enabling classes of sources. The second is the architecture of +the client, enabling sources for a given architecture. In addition to +these magic groups, each source may also specify non-magic groups to +limit the source's applicability to group member clients. +--------+----------+--------------+ | Source | OS Group | Architecture | @@ -51,41 +82,14 @@ member clients. | Yum | yum | | +--------+----------+--------------+ -.. note:: +Magic OS groups are disabled by default in Bcfg2 1.3 and greater. If +you require magic groups, you can enable them by setting +``magic_groups`` to ``1`` in the ``[packages]`` section of +``bcfg2.conf``. - .. versionadded:: 1.2.0 +Magic groups will be removed in a future release. - Magic OS groups can be disabled in Bcfg2 1.2 and greater by setting - ``magic_groups`` to ``0`` in ``Packages/packages.conf``. This may - give you greater flexibility in determining which source types to - use for which OSes. Magic architecture groups cannot be disabled. - - -Limiting sources to groups -========================== - -``Packages/sources.xml`` processes ```` and ```` tags -just like Bundles. In addition to any groups or clients specified -that way, clients must -be a member of the appropriate architecture group as specified in a -Source stanza. In total, in order for a source to be associated with -a client, the client must be in one of the magic groups (debian, -ubuntu, or nexenta), any explicit groups or clients specified in -``sources.xml``, and any specified architecture groups. - -Memberships in architecture groups is needed so that Packages can map -software sources to clients. There is no other way to handle this than -to impose membership in the appropriate architecture group. - -When multiple sources are specified, clients are associated with each -source to which they apply (based on group memberships, as described -above). Packages and dependencies are resolved from all applicable -sources. - -.. note:: To recap, a client needs to be a member of the **OS Group**, - **Architecture** group, and any other groups defined in your - ``Packages/sources.xml`` file in order for the client to be - associated to the proper sources. +Magic architecture groups cannot be disabled. Setup ===== diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py index ee81b9031..26f3ab92f 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py @@ -727,7 +727,7 @@ class Source(Bcfg2.Server.Plugin.Debuggable): return False if not self.setup.cfp.getboolean("packages", "magic_groups", - default=True): + default=False): return True else: for group in self.basegroups: diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py index e5b53cb26..fd6369619 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/__init__.py @@ -60,6 +60,14 @@ class Packages(Bcfg2.Server.Plugin.Plugin, # create key directory if needed os.makedirs(self.keypath) + # warn about deprecated magic groups + if self.core.setup.cfp.getboolean("packages", "magic_groups", + default=False): + self.logger.warning("Packages: Magic groups are deprecated and " + "will be removed in a future release") + self.logger.warning("You can disable magic groups by setting " + "magic_groups=0 in [packages] in bcfg2.conf") + #: The #: :class:`Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources` #: object used to generate @@ -215,7 +223,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin, """ if entry.tag == 'Package': if self.core.setup.cfp.getboolean("packages", "magic_groups", - default=True): + default=False): collection = self._get_collection(metadata) if collection.magic_groups_match(): return True -- cgit v1.2.3-1-g7c22