+ # Initialize XML-RPC client
+ attempts = 0
+ while True:
+ try:
+ plc = PLCAPI(config.plc_api_uri, config.cacert, auth=session)
+ data = plc.GetSlivers()
+ instance = ConfFiles(args.noscripts)
+ instance.run_once(data)
+ return 0
+ except Exception as exc:
+ logger.log_exc("Could not receive GetSlivers() from PLC")
+ attempts += 1
+ if attempts >= args.max_attempts:
+ return 1
+ logger.log("Waiting for {}s before trying again".format(args.period))
+ time.sleep(args.period)