[PATCH] yum: make transaction results available to plugins

Xavier Toth txtoth at gmail.com
Mon Sep 1 16:02:55 UTC 2008


I have a number of rpms that install SELinux policy modules during the
post install and I want yum to exit if there is any problem. I've
written a plugin with a posttrans method that examines the result and
exits if there was any problem. If there is another way to do this I'd
be happy to hear about it.

On Mon, Sep 1, 2008 at 10:00 AM, Seth Vidal <skvidal at fedoraproject.org> wrote:
> On Mon, 2008-09-01 at 09:25 -0500, Xavier Toth wrote:
>> Put the result of the transaction in the TranactionData object so that
>> it is available to plugins.
>>
>
>
> What is this for? What's the use case?
>
> -sv
>
>
>> --- yum-3.2.19/yum/transactioninfo.py 2008-08-12 08:54:00.000000000 -0500
>> +++ yum-3.2.19.new/yum/transactioninfo.py     2008-08-31 10:00:22.000000000 -0500
>> @@ -63,7 +63,8 @@
>>          self.depremoved = []
>>          self.depinstalled = []
>>          self.depupdated = []
>> -
>> +        self.transaction_result = None
>> +
>>      def __len__(self):
>>          return len(self.pkgdict)
>>
>> @@ -459,6 +460,12 @@
>>          result.update(self.getNewRequires(name, flag, version))
>>          return result
>>
>> +    def getTransactionResult(self):
>> +        return self.transaction_result
>> +
>> +    def setTransactionResult(self, result):
>> +        self.transaction_result = result
>> +
>>  class ConditionalTransactionData(TransactionData):
>>      """A transaction data implementing conditional package addition"""
>>      def __init__(self):
>> --- yum-3.2.19/yum/__init__.py        2008-08-26 14:37:17.000000000 -0500
>> +++ yum-3.2.19.new/yum/__init__.py    2008-08-31 09:59:40.000000000 -0500
>> @@ -799,6 +799,8 @@
>>          else:
>>              raise Errors.YumBaseError, errors
>>
>> +        self.tsInfo.setTransactionResult(resultobject)
>> +
>>          if not self.conf.keepcache:
>>              self.cleanUsedHeadersPackages()
>
>
> --
> fedora-devel-list mailing list
> fedora-devel-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-devel-list
>




More information about the devel mailing list