[Libosinfo] Getting None back from get_install_script()

Christophe Fergeau cfergeau at redhat.com
Thu Sep 19 07:00:41 UTC 2013


Hey,

On Wed, Sep 18, 2013 at 04:22:47PM -0500, Loranz Steve wrote:
> Hello,
> 
> I might be misreading the code, but my current understanding of the API
> leads me to believe the following example should behave differently. I'm
> using the python bindings and going through the following steps to try
> and get an instance of InstallScript:
> 
> 
> ---------
> 
> >>> from gi.repository import Libosinfo as osinfo
> >>> loader = osinfo.Loader()
> >>> loader.process_path("/usr/share/libosinfo/db")
> >>> db = loader.get_db()
> >>> osid = 'http://microsoft.com/win/2k8r2'
> >>> osid in db.unique_values_for_property_in_os("id")
> True
> >>> print db.get_install_script(osid)
> None
> >>> fid = 'http://fedoraproject.org/fedora/18'
> >>> fid in db.unique_values_for_property_in_os("id")
> True
> >>> print db.get_install_script(fid)
> None
> 
> ---------
> 
> 
> Am I using get_install_script() incorrectly?

Most libosinfo objects have an associated id, install scripts are such
objects. db.get_install_script(osid) will look up an install script whose
id is osid, but install script ids are not OS ids.
What you want to do is:
os = db.get_os(osid)
install_scripts = os.get_install_script_list()

Hope that helps,

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20130919/365e37cb/attachment.sig>


More information about the Libosinfo mailing list