[Yum-devel] pre, post jobs continued
seth vidal
skvidal at phy.duke.edu
Sun Jul 11 15:45:09 UTC 2004
On Sun, 2004-07-11 at 18:35 +1000, Menno Smits wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> I've been talking with Seth Vidal about doing a general class to handle
> pre and post processing jobs (as per
> https://lists.dulug.duke.edu/pipermail/yum-devel/2004-June/000188.html).
>
> I've been thinking about the XML file to be used to configure instances
> of this class and have come up with the following example based on usage
> cases and discussions on this list.
>
> - ---< snip >-------------------------------------------------------
> <matches>
> ~ <match>
> ~ <state>pretrans</state>
> ~ <conditions>
> ~ <condition>
> ~ <type>pkg</type>
> ~ <arg name="name">glibc</arg>
> ~ <arg name="state">remove</arg>
> ~ </condition>
> ~ </conditions>
> ~ <actions>
> ~ <action>
> ~ <type>confirm</type>
> ~ <arg name="msg">
> ~ Are you sure you wish to remove glibc?
> ~ </arg>
> ~ </action>
> ~ </actions>
> ~ </match>
> ~ <match>
> ~ <state>postpkgtrans</state>
> ~ <conditions>
> ~ <condition>
> ~ <type>pkg</type>
> ~ <arg name="name">bar*</arg>
> ~ </condition>
> ~ </conditions>
> ~ <actions>
> ~ <action>
> ~ <type>exec</type>
> ~ <arg>/etc/init.d/bar start</arg>
> ~ </action>
> ~ </actions>
> ~ </match>
> ~ <match>
> ~ <state>postdepresolve</state>
> ~ <conditions>
> ~ <condition>
> ~ <type>numpkgs</type>
> ~ <arg name="op">gt</arg>
> ~ <arg name="value">100</arg>
> ~ </condition>
> ~ </conditions>
> ~ <actions>
> ~ <action>
> ~ <type>confirm</type>
> ~ <arg>More than 100 packages are going to
> ~ be modified. Confirm?
> ~ </arg>
> ~ </action>
> ~ </actions>
> ~ </match>
> </matches>
> - ---< snip >-------------------------------------------------------
>
> Each <match> section has a state, one or more conditions and one or more
> actions associated with it. The state must match and all conditions must
> be true in order for the actions to be run (logical AND). Each condition
> type and action type (specified between the <type> tags) corresponds to
> a Python function which is called as required. The arguments specified
> by the <arg> tags are passed to the conditions/action function.
>
> More to come but I thought I'd get some comments at this stage. Feedback
> anyone?
It's a little verbose. The syntax isn't bad but if it is going to be
this verbose it might be useful to have some small script to generate
common options like confirmation-check or run-shell-command so people
can build this easily.
I think it would probably also be useful to have a jobs.d directory for
running these so you can just pile a bunch into a dir and have all of
them processed.
what do you think?
-sv
More information about the Yum-devel
mailing list