Please raise CredentialsFileError when file doesn't exist at load() in Credentials class

Bug #434311 reported by Marco Rodrigues
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lazr.restfulclient
Triaged
Low
Unassigned

Bug Description

Hi!

I'm fixing bug 414055 in Apport and I found that load() function at Credentials class don't raise an exception error when file doesn't exist. It should raise CredentialsFileError not only when version doesn't match, but also if file doesn't exists.

After that, I could do some try..except..finally to check if credentials file is corrupted or doesn't exist and ask user to generate a new one.

Thank you.

description: updated
Revision history for this message
Marco Rodrigues (gothicx) wrote :

I think it also should raise CredentialsFileError at load() if consumer and access_token variables are broken for some reason (someone or some software could remove the consumer_key line from credentials file), like save() function currently does.

This will help to catch only one exception from load() function and not the ones from ConfigParser (MissingSectionHeaderError, NoOptionError).

Thanks

affects: launchpadlib → lazr.restfulclient
Changed in lazr.restfulclient:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Robert Collins (lifeless) wrote :

This is possibly irrelevant with the keyring api changes?

Changed in lazr.restfulclient:
importance: Medium → Low
Revision history for this message
Benji York (benji) wrote :

I think this bug is still relevant. Credentials files are still used
when the keyring isn't available or doesn't have the creds.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.