Ticket #645 (closed enhancement: worksforme)

Opened 14 years ago

Last modified 14 years ago

Default attributes for Package elements

Reported by: [email protected] Owned by: desai
Priority: major Milestone: Bcfg2 1.0.0 Release
Component: bcfg2-server Version: 1.0
Keywords: patch Cc:


The recent addition of version="any" support for the SYSV/Blast/APT drivers has made package management a bit easier in some cases. However, it still requires a list of packages in Pkgmgr files, just to specify each package's version and type; which seems a little silly, since they're all the same. The attached patch allows specfying something like:

<PackageList priority="0" type="deb">
   <Group name="lenny">
      <PackageDefault version="any"/>

Which means that for all clients in group "lenny", <Package> elements default to the attributes in the <PackageDefault> element above, if an explicit <Package> element for a specific package doesn't exist.

It also allows for specifying a match="regex" attribute, which makes the <PackageDefault> element only apply to packages that match that particular regex. This can be useful, for example, on Solaris boxes that use both SYSV and Blast packages. Providing <PackageDefault> entries for both package types could look something like this:

<PackageList priority="0" type="sysv">
   <Group name="sun-solaris">
      <PackageDefault version="any"/>

(or possibly match="SUNW.*"), and in a diferent Pkgmgr file:

<PackageList priority="1" type="blast">
   <Group name="sun-solaris">
      <PackageDefault match="CSW.*" version="any"/>

Which would default to blast packages for package names beginning with CSW, and sysv packages otherwise.

I'm unsure of the elegance of part of this implementation (it probably breaks if a <PackageDefault> element is given a name, or if two <PackageDefault> elements are in one Pkgmgr file), but I wasn't sure what to do better. It should be trivial to make this work with Rules, or any other PrioDir-derived plugin.

This patch is also against (with a few other local patches). I don't know how difficult it is to port it to newer versions, but is it possible to work this into the 1.0 release?

I'll be posting about this on the bcfg-dev list shortly, for perhaps a wider discussion on the interface of this.


bcfg2- (5.1 KB) - added by [email protected] 14 years ago.
Support for <PackageDefault?> tags in

Change History

Changed 14 years ago by [email protected]

Support for <PackageDefault?> tags in

comment:1 Changed 14 years ago by desai

  • Status changed from new to closed
  • Resolution set to worksforme

I *think* this problem is now worked around in a different way in the Packages plugin. Does using that work for you?

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.