def _buildvar()

in src/es_pii_tool/redacters/snapshot.py [0:0]


    def _buildvar(self, client: 'Elasticsearch', index: str, phase: str):
        """Populate :py:attr:`var` with the values we need to start with"""
        self.var.client = client
        self.var.index = index
        self.var.phase = phase
        self._get_mapped_vars(phase)
        self.var.og_name = strip_index_name(index)  # Removes prefixes and suffixes
        now = datetime.now()
        self.var.redaction_target = (
            f'redacted-{now.strftime("%Y%m%d%H%M%S")}-{self.var.og_name}'
        )
        self.var.new_snap_name = f'{self.var.redaction_target}-snap'
        # Check if the old index has been redacted before and has a version number
        self.var.ver = get_inc_version(index)
        # The mount name contains a version at the end in case we need to redact
        # the index again. The version allows us to use a similar naming scheme
        # without redundancy
        self.var.mount_name = (
            f'{self.var.prefix}redacted-{self.var.og_name}---v{self.var.ver + 1:03}'
        )
        logger.debug('mount_name = %s', self.var.mount_name)