in ad-joining/register-computer/main.py [0:0]
def __read_ad_password():
if "AD_PASSWORD" in os.environ:
# Cleartext password provided (useful for testing).
return os.environ["AD_PASSWORD"]
else:
# Read password from Secret Manager
# Use new settings naming schema first but swallow any configuration exceptions
# Try deprecated settings naming schema second but bubble up any exceptions
try:
return __read_secret_manager(
__read_setting_secret_manager_project(True),
__read_required_setting("SM_NAME_ADPASSWORD"),
__read_setting("SM_VERSION_ADPASSWORD"))
except ConfigurationException:
logging.warn("Could not read SM_*_ADPASSWORD settings, falling back to deprecated settings SECRET_PROJECT_ID, SECRET_NAME and SECRET_VERSION")
# One or more settings were not found retry with old configuration names
return __read_secret_manager(
__read_setting_secret_manager_project(True),
__read_required_setting("SECRET_NAME"),
__read_setting("SECRET_VERSION"))