Re: RPMs Module - Verification Method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Milton Paiva Neto wrote:
First sorry for have sent the last mail twice, I had some problems with
the mail server.

Thanks Michael DeHaan and Phil for the help, the verification method is
working now :-) I also would like to thank Professor Chris for the help.

I had to use an asynchronous call to solve the socket time out problem.

This method should be added in the rpms module, after the inventory
method. I am sending the modified rpms.py file as an attachment.

-----------
    def verify(self, flatten=True):
        """
        Returns information of the verification of all installed packages.
        """
        import commands
        ts = rpm.TransactionSet()
        mi = ts.dbMatch()
        results = []
        for hdr in mi:
            checksum = commands.getoutput("rpm -V " + hdr['name'])
            if flatten:
                results.append("%s" % (checksum))
            else:
                results.append([checksum])
        return results
-----------

To call the method, just
#func <machine> call -a rpms verify

How the RPM api in python does not have any function for verification, I
had to use the external command. I think the rpm api in python is not
very complete.






------------------------------------------------------------------------

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

Commands.getoutput seems non-conventional, it seems you are using some of Func's internal modules in a way that it might not be meant to be used.

We bundle a copy of subprocess (since it's not around in Python 2.3) as sub_process

You can use that.

output = sub_process.call(["/usr/bin/rpm", "-V", name], shell=False).communicate()[0]

Approximately.

pydoc subprocess for all of the options.



_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux