pypxe / PyPXE

Pure Python PXE (DHCP-(Proxy)/TFTP/HTTP/NBD) Server
MIT License
547 stars 125 forks source link

pypxe/dhcp.py: avoid exception when leases have no options #127

Closed jforissier closed 8 years ago

jforissier commented 8 years ago

Fixes the following crash:

Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 763, in run self.__target(_self.args, *_self.__kwargs) File "pypxe/dhcp.py", line 355, in listen self.dhcp_offer(message) File "pypxe/dhcp.py", line 293, in dhcp_offer options_response = self.craft_options(2, client_mac) # DHCPOFFER File "pypxe/dhcp.py", line 269, in craft_options if 93 in self.leases[client_mac]['options'] and not self.force_file_name: KeyError: 'options'

Signed-off-by: Jerome Forissier jerome.forissier@linaro.org

jforissier commented 8 years ago

Supersedes https://github.com/psychomario/PyPXE/pull/124.