forked from hystax/optscale
-
Notifications
You must be signed in to change notification settings - Fork 1
Sync 2024-11-29 #19
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
Merged
Merged
Sync 2024-11-29 #19
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f6ffa7f
OS-7946. Clean events in cleanmongo
nk-hystax 3c59be5
OS-7948. Cleanup package.json pnpm.overrides
ek-hystax c07d74e
OS-6174. Reset the expanded state when opening a new modal from an al…
ek-hystax cd9f69c
OS-7976. obsolete_snapshots + separate image resources for gcp
nk-hystax fdb6e24
OS-8016. Add the GCP service to the "Obsolete Snapshots" recommendation
ek-hystax 1213741
Pull request update/241126
stanfra f9cd6c7
OS-7977. obsolete_ips for gcp
nk-hystax 50be39f
OS-8020. Add the GCP service to the "Obsolete IPs" recommendation
ek-hystax dbae95e
OS-8022. Skip resource_id=None on updating last_used
nk-hystax c760412
Pull request update/241127
tm-hystax 74e593b
Pull request update/241128
tm-hystax 61300f6
Merge branch "Feature/email confirmation"
sd-hystax 88f66e5
Pull request update/241129
stanfra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
auth/auth_server/alembic/versions/76fd6db54f65_user_verified_column.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # pylint: disable=C0103 | ||
| """user verified column | ||
|
|
||
| Revision ID: 76fd6db54f65 | ||
| Revises: 245d4295bbd6 | ||
| Create Date: 2024-11-18 09:57:42.103381 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
| from sqlalchemy import update, Integer, and_, Boolean | ||
| from sqlalchemy.orm import Session | ||
| from sqlalchemy.sql import table, column | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = '76fd6db54f65' | ||
| down_revision = '245d4295bbd6' | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.add_column('user', sa.Column('verified', Boolean(), nullable=False)) | ||
| user_table = table( | ||
| 'user', | ||
| column('deleted_at', Integer()), | ||
| column('verified', Boolean()) | ||
| ) | ||
| bind = op.get_bind() | ||
| session = Session(bind=bind) | ||
| try: | ||
| upd_stmt = update(user_table).values(verified=True).where(and_( | ||
| user_table.c.verified.is_(False), | ||
| user_table.c.deleted_at == 0 | ||
| )) | ||
| session.execute(upd_stmt) | ||
| session.commit() | ||
| except Exception: | ||
| session.rollback() | ||
| raise | ||
| finally: | ||
| session.close() | ||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.drop_column('user', 'verified') | ||
| # ### end Alembic commands ### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| 'aws_cnr', | ||
| 'azure_cnr', | ||
| 'alibaba_cnr', | ||
| 'gcp_cnr', | ||
| 'nebius' | ||
| ] | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
diworker/diworker/migrations/2024111309000000_gcp_image_resource_type.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import logging | ||
| from pymongo import UpdateOne | ||
| from optscale_client.rest_api_client.client_v2 import Client as RestClient | ||
| from diworker.diworker.migrations.base import BaseMigration | ||
| """ | ||
| Change resource type from "Bucket" to "Image" for GCP images | ||
| """ | ||
| CHUNK_SIZE = 1000 | ||
| LOG = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class Migration(BaseMigration): | ||
| @property | ||
| def mongo_resources(self): | ||
| return self.db.resources | ||
|
|
||
| @property | ||
| def rest_cl(self): | ||
| if self._rest_cl is None: | ||
| self._rest_cl = RestClient( | ||
| url=self.config_cl.restapi_url(), | ||
| secret=self.config_cl.cluster_secret()) | ||
| return self._rest_cl | ||
|
|
||
| def get_cloud_accs(self): | ||
| cloud_accounts_ids = set() | ||
| _, organizations = self.rest_cl.organization_list({ | ||
| "with_connected_accounts": True, "is_demo": False}) | ||
| for org in organizations["organizations"]: | ||
| _, accounts = self.rest_cl.cloud_account_list( | ||
| org['id'], type="gcp_cnr") | ||
| for cloud_account in accounts["cloud_accounts"]: | ||
| if cloud_account["auto_import"]: | ||
| cloud_accounts_ids.add(cloud_account["id"]) | ||
| return cloud_accounts_ids | ||
|
|
||
| def upgrade(self): | ||
| cloud_accs = self.get_cloud_accs() | ||
| for i, cloud_acc_id in enumerate(list(cloud_accs)): | ||
| LOG.info("Starting processing for cloud account %s (%s/%s)" % ( | ||
| cloud_acc_id, i + 1, len(cloud_accs))) | ||
| self.mongo_resources.update_many({ | ||
| "cloud_account_id": cloud_acc_id, | ||
| "resource_type": "Bucket", | ||
| "name": {"$regex": "Storage(.*) Image(.*)"} | ||
| }, {"$set": {"resource_type": "Image"}}) | ||
|
|
||
| def downgrade(self): | ||
| pass |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.