Mini Shell
3
?��e� � @ sl d dl mZ d dlmZmZmZmZmZmZm Z m
Z
d dlmZ ee
�ZG dd� de�ZG dd� de�ZdS ) � )�
parse_nfs_url)�CDRomSource� HDDSource� NFSSource�
HTTPSource�HTTPSSource� FTPSource�
FileSource� HMCSource)�get_module_loggerc @ s e Zd ZdS )�PayloadSourceTypeUnrecognizedN)�__name__�
__module__�__qualname__� r r �/usr/lib64/python3.6/factory.pyr s r c @ sx e Zd Zedd� �Zedd� �Zedd� �Zedd� �Zed d
� �Z edd� �Z
ed
d� �Zedd� �Zedd� �Z
dS )�
SourceFactoryc C s | j |�rt� S | j|�r4t|�\}}}t|||�S | j|�r�|jdd�d }|jd�}|d }d}t|�dkrz|d }nt|�dkr�|d }t||�S | j |�r�t
|�S | j|�r�t|�S | j
|�r�t|�S | j|�r�t|�S | j|�� r�t� S tdj|���dS ) z%Parse cmdline string to source class.�:� r � � � zCan't find source type for {}N)�is_cdromr �is_nfsr r �is_harddrive�split�lenr �is_httpr �is_httpsr �is_ftpr �is_filer �is_hmcr
r �format)�cls�cmdlineZnfs_optionsZserver�pathZurlZ url_partsZdevicer r r �parse_repo_cmdline_string! s4
z'SourceFactory.parse_repo_cmdline_stringc C s
| j d�S )z5Is this cmdline parameter cdrom based payload source?Zcdrom)�
startswith)r$ r r r r H s zSourceFactory.is_cdromc C s
| j d�S )z3Is this cmdline parameter hdd based payload source?zhd:)r'