-
Notifications
You must be signed in to change notification settings - Fork 0
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
Prt 40 periodic full system reconcile process #568
Prt 40 periodic full system reconcile process #568
Conversation
Add docstring to Role + MANGAER_ROLE constant blacken models/shared_drive.py Change SharedDrive.drive_id max_length (32 => 25; 19 is largest value) Add SharedDrive.is_deleted Add SharedDriveRecord.get_itbill_key_remote()
|
||
|
||
def load_shared_drives_from_csv(file_path): | ||
def load_shared_drives(google_drive_states): |
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.
Notable change: load_shared_drives management command is now loading from the MSCA endpoint and not a CSV file
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.
excellent!
shared_drive=shared_drive) | ||
shared_drive=shared_drive, | ||
defaults={ | ||
"datetime_created": dt.datetime.now(dt.timezone.utc), |
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.
@mikeseibel Please confirm datetime_created
is meant to refer to the creation of the SharedDriveRecord
object.
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.
yup!
try: | ||
defaults["quota_limit"] = a.quota_limit | ||
except ValueError: | ||
"Drive has no quota set. Probably in invalid org unit." |
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.
The expectation is this will get "fixed" during reconciliation, but it's a little awkward prior to our cutover when the majority of the share drives are in an OU with no quota
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.
what should the placeholder for those cases be?
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.
I'd have to confer with Ken on that to see if there's a quota currently being enforced.
I'm aware of 3 OUs
- the default UW one, where most drives are
- one that follows a different naming scheme but appears to be compatible with a new "XXXGB" OU
- the one for drives pending deletion
endorsement/dao/shared_drive.py
Outdated
def __init__(self, *args, **kwargs): | ||
columns = kwargs.get('columns', []) | ||
row = kwargs.get('row', []) | ||
def get_subscription(sdr: SharedDriveRecord): |
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.
@mikeseibel this method prompted the PR as I think it's getting dangerously close to code you're writing and I'd really rather only write it once 😆
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.
feel free to junk whats there. i just added it quick and dirty to import ken's early csv.
def reconcile_existing_drives( | ||
self, drives, id_GoogleDriveState, subsidized_quota | ||
): | ||
# helper functions that probably need to be moved to a DAO file |
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.
Ignore this function - I quickly put some stubs together but it's not even remotely complete
endorsement/models/shared_drive.py
Outdated
org_unit_name = models.CharField(max_length=64, null=True) | ||
org_unit_name = models.CharField( | ||
max_length=64, null=True | ||
) # TODO: shouldn't this be non-NULL? |
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.
OK to make this not-nullable?
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.
sure!
drive_id = models.SlugField(max_length=32) | ||
|
||
# NOTE: maximum observed is 19 characters (2024-05-16) | ||
drive_id = models.SlugField(max_length=25) |
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.
Reduced from 32 => 25 so that the new method get_itbill_key_remote()
would never return a value <= length rquired by ITBillSubscription
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.
seems fine... i didn't look too hard and felt like some fudge didn't hurt
""" | ||
# if changing be sure this does not exceed the max_length of | ||
# ITBillSubscription.key_remote | ||
key_remote = f"prt_sd_{self.shared_drive.drive_id}" |
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.
I couldn't find any notes where we agreed on a prefix with the ITBill team. Do you have anything?
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.
I don't think they had any suggestion for key_remote aside from uniqueness since it's for our use. i think they suggested subscription name be something like GSD_<drive_id>
update page title with tab name, aria label for selects
itbill form in modal, notify template
remove js smoke
…g subscription state
itbill secrets for test.provision deploy
…to PRT-40-periodic-full-system-reconcile-process
endorsement/models/shared_drive.py
Outdated
org_unit_name = models.CharField(max_length=64, null=True) | ||
org_unit_name = models.CharField( | ||
max_length=64, null=True | ||
) # TODO: shouldn't this be non-NULL? |
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.
sure!
drive_id = models.SlugField(max_length=32) | ||
|
||
# NOTE: maximum observed is 19 characters (2024-05-16) | ||
drive_id = models.SlugField(max_length=25) |
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.
seems fine... i didn't look too hard and felt like some fudge didn't hurt
""" | ||
# if changing be sure this does not exceed the max_length of | ||
# ITBillSubscription.key_remote | ||
key_remote = f"prt_sd_{self.shared_drive.drive_id}" |
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.
I don't think they had any suggestion for key_remote aside from uniqueness since it's for our use. i think they suggested subscription name be something like GSD_<drive_id>
|
||
|
||
def load_shared_drives_from_csv(file_path): | ||
def load_shared_drives(google_drive_states): |
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.
excellent!
shared_drive=shared_drive) | ||
shared_drive=shared_drive, | ||
defaults={ | ||
"datetime_created": dt.datetime.now(dt.timezone.utc), |
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.
yup!
try: | ||
defaults["quota_limit"] = a.quota_limit | ||
except ValueError: | ||
"Drive has no quota set. Probably in invalid org unit." |
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.
what should the placeholder for those cases be?
endorsement/dao/shared_drive.py
Outdated
def __init__(self, *args, **kwargs): | ||
columns = kwargs.get('columns', []) | ||
row = kwargs.get('row', []) | ||
def get_subscription(sdr: SharedDriveRecord): |
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.
feel free to junk whats there. i just added it quick and dirty to import ken's early csv.
Not a real PR yet - just trying to make sure we don't code the same things in different ways...