(self)
return validate.success
Validate content.
Validate content.
Validate content .
def validate_local_data_file(self):
        """Validate content."""
        validate = Validate()
        old_data = self.data.read("old")

        if old_data is None:
            # new install.
            return True

        if old_data.get("hacs", {}).get("schema") is None:
            return True

        if old_data.get("hacs", {}).get("schema") == STORAGE_VERSION:
            # Newest version, no need to do anything.
            return

        current = old_data.get("hacs", {}).get("schema")

        for version in range(int(current), int(STORAGE_VERSION)):
            if current in MIGRATIONS:
                MIGRATIONS[current](old_data).migrate()
            else:
                validate.errors.append(f"Missing migration step for {version}")

        if validate.errors:
            for error in validate.errors:
                self.logger.critical(error)
        return validate.success
def validate_local_data_file ( self ) : validate = Validate ( ) old_data = self . data . read ( "old" ) if old_data is None : # new install. return True if old_data . get ( "hacs" , { } ) . get ( "schema" ) is None : return True if old_data . get ( "hacs" , { } ) . get ( "schema" ) == STORAGE_VERSION : # Newest version, no need to do anything. return current = old_data . get ( "hacs" , { } ) . get ( "schema" ) for version in range ( int ( current ) , int ( STORAGE_VERSION ) ) : if current in MIGRATIONS : MIGRATIONS [ current ] ( old_data ) . migrate ( ) else : validate . errors . append ( f"Missing migration step for {version}" ) if validate . errors : for error in validate . errors : self . logger . critical ( error ) return validate . success