-
Notifications
You must be signed in to change notification settings - Fork 2
Create inactive databases by deleting their licenses #3001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,23 +122,34 @@ def _create_and_get_vumark_target_id( | |
| ) | ||
|
|
||
|
|
||
| def _fetch_inactive_database_details( | ||
| def _create_and_get_inactive_database_details( | ||
| driver: "WebDriver", | ||
| email_address: str, | ||
| password: str, | ||
| license_name: str, | ||
| database_name: str, | ||
| ) -> "DatabaseDict": | ||
| """Fetch details for an existing inactive database.""" | ||
| """Create a cloud database, get its details, then delete the license to | ||
| make it inactive. | ||
| """ | ||
| vws_web_tools.log_in( | ||
| driver=driver, | ||
| email_address=email_address, | ||
| password=password, | ||
| ) | ||
| vws_web_tools.wait_for_logged_in(driver=driver) | ||
| return vws_web_tools.get_database_details( | ||
| vws_web_tools.create_license(driver=driver, license_name=license_name) | ||
| vws_web_tools.create_cloud_database( | ||
| driver=driver, | ||
| database_name=database_name, | ||
| license_name=license_name, | ||
| ) | ||
| database_details = vws_web_tools.get_database_details( | ||
| driver=driver, | ||
| database_name=database_name, | ||
| ) | ||
| vws_web_tools.delete_license(driver=driver, license_name=license_name) | ||
| return database_details | ||
|
|
||
|
|
||
| def _create_vuforia_resource_names() -> tuple[str, str, str, str]: | ||
|
|
@@ -159,16 +170,18 @@ def main() -> None: | |
| email_address = os.environ["VWS_EMAIL_ADDRESS"] | ||
| password = os.environ["VWS_PASSWORD"] | ||
| new_secrets_dir = Path(os.environ["NEW_SECRETS_DIR"]).expanduser() | ||
| inactive_database_name = os.environ[ | ||
| "INACTIVE_VUFORIA_TARGET_MANAGER_DATABASE_NAME" | ||
| ] | ||
| new_secrets_dir.mkdir(exist_ok=True) | ||
|
|
||
| time = datetime.datetime.now(tz=datetime.UTC).strftime( | ||
| format="%Y-%m-%d-%H-%M-%S", | ||
| ) | ||
| inactive_driver = vws_web_tools.create_chrome_driver() | ||
| inactive_database_details = _fetch_inactive_database_details( | ||
| inactive_database_details = _create_and_get_inactive_database_details( | ||
| driver=inactive_driver, | ||
| email_address=email_address, | ||
| password=password, | ||
| database_name=inactive_database_name, | ||
| license_name=f"my-inactive-license-{time}", | ||
| database_name=f"my-inactive-database-{time}", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inactive database shared across files, not per-file as intendedMedium Severity The PR states "Each secrets file now gets its own freshly-created inactive database" and "Updated Additional Locations (1) |
||
| ) | ||
| inactive_driver.quit() | ||
|
|
||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New function duplicates existing database creation logic
Low Severity
_create_and_get_inactive_database_detailsduplicates the entire body of_create_and_get_database_details(login, wait, create license, create database, get details), adding only a singledelete_licensecall at the end. The inactive variant could instead delegate to the existing function and then perform the license deletion, avoiding the duplicated logic.Additional Locations (1)
admin/create_secrets_files.py#L25-L54