commit b4d39cfda44f8c43cb582710a262ee850064ef98 Author: Radek Novacek rnovacek@redhat.com Date: Wed Sep 7 09:10:22 2011 +0200
Prevent failure when server not implements /status/ command
subscriptionmanager.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) --- diff --git a/subscriptionmanager.py b/subscriptionmanager.py index 1ccc3aa..34c756c 100644 --- a/subscriptionmanager.py +++ b/subscriptionmanager.py @@ -53,8 +53,12 @@ class SubscriptionManager: """ Connect to the subscription-manager. """ self.connection = rhsm_connection.UEPConnection( cert_file=self.cert_file, key_file=self.key_file) - if not self.connection.ping()['result']: - self.logger.error("Unable to connect to the server") + try: + if not self.connection.ping()['result']: + self.logger.error("Unable to obtain status from server, UEPConnection is likely not usable.") + except Exception, e: + self.logger.warn("Unable to obtain status from server, UEPConnection is likely not usable:") + self.logger.exception(e)
def sendVirtGuests(self, domains): """ Update consumer facts with UUIDs of virtual guests. """