Summary
If a SALClient has previously connected to server (i.e. during initialization), connecting to a new server is not possible if the original server required authentication.
Steps to reproduce
If host requires authentication:
sc = SALClient(host)
sc.host = new_host
What is the current bug behavior?
SALClient prompts for username and password (irrespective of whether new_host requires authentication.
What is the expected correct behavior?
No prompt, SALClient should simply connect to new host.
Possible fixes
This occurs because after a host has been set during initialization, SALClient.auth_required has a value determined by this host. When SALClient.host is called a GET request is made (to the new host), and before it is sent SALClient requests credentials because it thinks it has to authenticate (which is true of GET requests made to the original host but not the new one). This can be fixed by simply setting auth_required = False when host is set. If this is done, auth_required can be removed from __init__.
Summary
If a
SALClienthas previously connected to server (i.e. during initialization), connecting to a new server is not possible if the original server required authentication.Steps to reproduce
If
hostrequires authentication:What is the current bug behavior?
SALClientprompts for username and password (irrespective of whethernew_hostrequires authentication.What is the expected correct behavior?
No prompt,
SALClientshould simply connect to new host.Possible fixes
This occurs because after a host has been set during initialization,
SALClient.auth_requiredhas a value determined by this host. WhenSALClient.hostis called a GET request is made (to the new host), and before it is sentSALClientrequests credentials because it thinks it has to authenticate (which is true of GET requests made to the original host but not the new one). This can be fixed by simply settingauth_required = Falsewhenhostis set. If this is done,auth_requiredcan be removed from__init__.