Download

class linuxiso.download.Download(conf=None)[source]

Bases: object

Class manage download and verify iso.

Parameters:conf (dict) – Configuration

You need to provide configuration with all info of iso managed.

The typical use is:
  • chose a config that containt all info about iso
  • list iso managed
  • get the status of one or all iso (status_all)
  • do operation on iso like download, download_all, remove or remove_all
>>> download = Download(conf)
>>> download.list()
>>> download.status("debian-9.6.0-strech-amd64-netinst.iso")
>>> download.download("debian-9.6.0-strech-amd64-netinst.iso")
download(iso)[source]

Download one iso

Parameters:iso (str) – Name of iso used
>>> download.download("debian-9.6.0-strech-amd64-netinst.iso")
download_all()[source]

Download all iso

>>> download.download_all()
list()[source]

Get list of iso managed.

Returns:List of iso managed
Return type:list
>>> download.list()
[
    "centos-7-x86-amd64-desktop.iso",
    "debian-10-buster-amd64-netinst-testing.iso",
    "debian-9.6.0-strech-amd64-netinst.iso",
    "kde-18.3-destop-kde.iso",
    "linuxmint-18.2-Sonya-amd64-desktop-cinnamon.iso",
    "raspbian-9-strech-lite.img",
    "ubuntu-16.04.4-LTS-Xenial_Xerus-amd64-desktop-live.iso",
    "ubuntu-16.04.4-LTS-Xenial_Xerus-amd64-server.iso",
    "ubuntu-17.10.1-Artful_Aardvark-amd64-server.iso"
]
remove(iso)[source]

Remove one iso

Parameters:iso (str) – Name of iso used
>>> download.remove("debian-9.6.0-strech-amd64-netinst.iso")
remove_all()[source]

Remove all iso

>>> download.remove_all()
status(iso)[source]

Get one iso status.

Parameters:iso (str) – Name of iso used
Returns:Status of the iso
Return type:dict
Test :
  • if the url to download the iso exist
  • if the iso already downloaded
  • if the checksum is good (if the iso is download)
>>> download.status("debian-9.6.0-strech-amd64-netinst.iso")
{
    "is_downloaded": true,
    "is_hash_valid": true,
    "is_url_exist": true
}
status_all()[source]

Get all iso status.

Returns:status of all iso managed
Return type:dict

Test if the url to download exist, if the iso already downloaded and if the checksum is good

>>> download.status_all()