in rpi-image-builder/aws-iot-fleet-provisioning/provisioning_handler.py [0:0]
def __init__(self, file_path, device_serial):
"""Initializes the provisioning handler
Arguments:
file_path {string} -- path to your configuration file
"""
#Logging
logging.basicConfig(level=logging.ERROR)
self.logger = logging.getLogger(__name__)
#Load configuration settings from config.ini
config = Config(file_path)
self.config_parameters = config.get_section('SETTINGS')
self.secure_cert_path = self.config_parameters['SECURE_CERT_PATH']
self.iot_endpoint = self.config_parameters['IOT_ENDPOINT']
self.template_name = self.config_parameters['PRODUCTION_TEMPLATE']
self.rotation_template = self.config_parameters['CERT_ROTATION_TEMPLATE']
self.claim_cert = self.config_parameters['CLAIM_CERT']
self.secure_key = self.config_parameters['SECURE_KEY']
self.root_cert = self.config_parameters['ROOT_CERT']
self.unique_id = device_serial
# ------------------------------------------------------------------------------
# -- PROVISIONING HOOKS EXAMPLE --
# Provisioning Hooks are a powerful feature for fleet provisioning. Most of the
# heavy lifting is performed within the cloud lambda. However, you can send
# device attributes to be validated by the lambda. An example is shown in the line
# below (.hasValidAccount could be checked in the cloud against a database).
# Alternatively, a serial number, geo-location, or any attribute could be sent.
#
# -- Note: This attribute is passed up as part of the register_thing method and
# will be validated in your lambda's event data.
# ------------------------------------------------------------------------------
self.primary_MQTTClient = None
self.test_MQTTClient = None
self.callback_returned = False
self.message_payload = {}
self.isRotation = False