Better IOError handling in client_set_for_tenant

Minor refactoring with nice error message on IOError as a side effect.

Change-Id: I2713abc21b15e1d5477c314f6d059a5f28246217