def __init__(self, image_path, sign_id, img_config_block, img_config_parser, parsegen_config): import cfgparser.auto_gen_obj_config as agoc import parsegen.config.auto_gen_obj_config as pgagoc from parsegen.config.parser import ParsegenCfgParser assert isinstance(image_path, str) assert isinstance(sign_id, str) assert isinstance(img_config_parser, ConfigParser) assert isinstance(parsegen_config, ParsegenCfgParser) # Public attributes self.config_parser = img_config_parser self.parsegen_config_parser = parsegen_config self.config = self.config_parser.config_data self.parsegen_config = self.parsegen_config_parser.config_data self.src_image = ImagePath(image_path) self.dest_image = DestImagePath() self.image_under_operation = self.src_image.image_path self.name = self.src_image.image_name self.sign_id = sign_id self.status = ImageStatus() self.chipset = self.config_parser.chipset self.encdec = None self.status.overall.state = StatusInfo.ERROR self.validation_root_cert_hash = None self.authority = None # Properties obtained from the config file self.pil_split = img_config_block.pil_split self.post_process_commands = img_config_block.post_process_commands self.general_properties_overrides = img_config_block.general_properties_overrides # Properties to be looked up in the config file self.image_type = pgagoc.Cfg_Image_Type() self.general_properties = agoc.Cfg_General_Properties() self.signing_attributes = self.general_properties # Populate the properties from the config file self._populate_image_type(img_config_block.image_type) self._populate_general_properties() # If a cert_config is specified for a certain image, use that instead if img_config_block.cert_config is not None: self.cert_config = img_config_block.cert_config # If not, just use the selected_cert_config from general properties else: self.cert_config = self.general_properties.selected_cert_config # Define data_provisioner base path for image self.data_prov_basepath = self.config.data_provisioning.base_path # Perform any validations self._validate_properties()
def __init__(self, image_path, sign_id, img_config_block, img_config_parser): import cfgparser.auto_gen_obj_config as agoc assert isinstance(image_path, str) assert isinstance(sign_id, str) assert isinstance(img_config_parser, ConfigParser) # Public attributes self.config_parser = img_config_parser self.config = img_config_parser.config_data self.src_image = ImagePath(image_path) self.dest_image = DestImagePath() self.image_under_operation = self.src_image.image_path self.name = self.src_image.image_name self.sign_id = sign_id self.status = ImageStatus() self.chipset = img_config_parser.chipset self.encryption = self.config.encryption self.encdec = None self.status.overall.state = StatusInfo.ERROR # Properties obtained from the config file self.pil_split = img_config_block.pil_split self.post_process_commands = img_config_block.post_process_commands self.general_properties_overrides = img_config_block.general_properties_overrides self.signing_attributes_overrides = img_config_block.signing_attributes_overrides # Properties to be looked up in the config file self.image_type = agoc.Cfg_Image_Type() self.cert_config = agoc.Cfg_Cert_Config() self.general_properties = agoc.Cfg_General_Properties() self.signing_attributes = agoc.Cfg_Default_Attributes() # Populate the properties from the config file self._populate_image_type(img_config_parser, img_config_block.image_type) self._populate_cert_config(img_config_parser, img_config_block.cert_config) self._populate_general_properties(img_config_parser) self._populate_signing_attributes(img_config_parser) # Perform any validations self._validate_properties()