def checkin(pickledata): config = pickle.loads(bz2.decompress(base64.urlsafe_b64decode(pickledata))) r, message = read_host_config(SESSION, config) if r is not None: return message + 'checked in successful' else: return message + 'error checking in'
def checkin(pickledata): uncompressed = bz2.decompress(base64.urlsafe_b64decode(pickledata)) try: config = json.loads(uncompressed) except ValueError: config = pickle.loads(uncompressed) r, message = read_host_config(SESSION, config) if r is not None: return message + 'checked in successful' else: return message + 'error checking in'
def checkin(pickledata): uncompressed = bz2.decompress(base64.urlsafe_b64decode(pickledata)) try: config = json.loads(uncompressed) except ValueError: logging.info("Fell back to pickle") config = pickle.loads(uncompressed) r, message = read_host_config(SESSION, config) if r is not None: logging.info("Checkin succesful: %s" % message) return message + 'checked in successful' else: logging.error("Error during checkin: %s" % message) return message + 'error checking in'