<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_ports(self):
 """ Sets the `ports` attribute to the set of valid port values set in the configuration. """

        ports = set()

        for port in self.configured_ports:
            try:
                ports.add(int(port))
            except ValueError:
                logger.error("Invalid port value: %s", port)
                continue

        self.ports = ports