Bugfix: URL required

If --config_type is http and url is not passed in --config_location, show error and exit
This commit is contained in:
jpattWPC 2023-10-15 12:10:25 -05:00
parent 59f11ffdeb
commit 2d20f1a414
2 changed files with 6 additions and 1 deletions

View File

@ -54,6 +54,8 @@ No command line options are required for default behavior. The following command
HTTP basic authentication password (default: None) HTTP basic authentication password (default: None)
--ignore_ssl HTTPS ignore SSL certificate errors (default: False) --ignore_ssl HTTPS ignore SSL certificate errors (default: False)
If `--config_type http` is selected, pass the URL in the `--config_location` parameter
## Windows Installation ## Windows Installation
You **MUST** install virt-viewer prior to using PVE VDI client, you may download it from the [official Virtual Machine Manager](https://virt-manager.org/download.html) site. You **MUST** install virt-viewer prior to using PVE VDI client, you may download it from the [official Virtual Machine Manager](https://virt-manager.org/download.html) site.

View File

@ -81,6 +81,9 @@ def loadconfig(config_location = None, config_type='file', config_username = Non
win_popup_button(f'Unable to read configuration file:\n{e!r}', 'OK') win_popup_button(f'Unable to read configuration file:\n{e!r}', 'OK')
return False return False
elif config_type == 'http': elif config_type == 'http':
if not config_location:
win_popup_button('--config_type http defined, yet no URL provided in --config_location parameter!', 'OK')
return False
try: try:
if config_username and config_password: if config_username and config_password:
r = requests.get(url=config_location, auth=(config_username, config_password), verify = ssl_verify) r = requests.get(url=config_location, auth=(config_username, config_password), verify = ssl_verify)
@ -91,7 +94,7 @@ def loadconfig(config_location = None, config_type='file', config_username = Non
win_popup_button(f"Unable to read configuration from URL!\n{e}", "OK") win_popup_button(f"Unable to read configuration from URL!\n{e}", "OK")
return False return False
if not 'General' in config: if not 'General' in config:
win_popup_button(f'Unable to read supplied configuration:\nNo `General` section defined!', 'OK') win_popup_button('Unable to read supplied configuration:\nNo `General` section defined!', 'OK')
return False return False
else: else:
if 'title' in config['General']: if 'title' in config['General']: