Rework Perforce repository info checks for SSL support and compatibility.
Review Request #11029 — Created May 19, 2020 and updated
When Perforce looks up repository information, it fails to account for
SSL variations for repositories (those with a
prevents some types of repositories from being found if performing a
scan based on paths, rather than a direct name lookup.
Now, the computed repository information factors in "Broker encryption"
and "Server encryption" fields, and uses those to include
ssl:-prefixed repository paths in the list of paths to check. These
are chosen as a priority over non-SSL paths.
As part of this, the logic for computing this information has been
reordered and cleaned up. We now look up (and bail early on) the easy
stuff, and save the more expensive stuff (hostname alias resolution) to
The hostname alias resolution has also been simplified. If there's an
issue looking up aliases, we no longer bail early from building up a
list of hostname candidates. Instead, we only avoid adding aliases to
the list. This is mostly useful for unit tests, but also helps keep the
list of possible Perforce repositories consistent even when alias
Unit tests passed.
Tested with a local server deployment. Verified it was adding
prefixes as possibilities when seeing
Broker encryption: encrypted
Server encryption: encryptedfields in
This needs a period.
While theoretically a hair less efficient, I this this would read a lot more cleanly as:
server_address = p4_info.get('Broker address') encryption_state = p4_info.get('Broker encryption') if not server_address: server_address = p4_info.get('Server address') encryption_state = p4_info.get('Server encryption') if not server_address: return None use_ssl = (encryption_state == 'encrypted')