Skip to content
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

Update demo data hook to copy media files #3441

Merged
merged 20 commits into from
Jul 31, 2022

Conversation

SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat commented Jul 31, 2022

Existing script for installing demo dataset does not copy across media files!

This PR started with an initially simple goal - to copy these media files across.

However to gain access to the canonical location of the MEDIA_ROOT directory, we needed some extra code to provide that information to external scripts!

This ended up leading to a significant refactor of the "settings.py" file

Documentation

Required some updates (and improvements) to the documentation, inventree/inventree-docs#342

@SchrodingersGat SchrodingersGat added the setup Relates to the InvenTree setup / installation process label Jul 31, 2022
@SchrodingersGat SchrodingersGat added this to the 0.8.0 milestone Jul 31, 2022
@SchrodingersGat SchrodingersGat requested a review from matmair July 31, 2022 07:23
@SchrodingersGat SchrodingersGat added the breaking Indicates a major update or change which breaks compatibility label Jul 31, 2022
Copy link
Member

@matmair matmair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SchrodingersGat not sure if i am miss understanding something but a bunch of config.yaml names seem to be renamed. This PR is highly breaking configs of that is the case.

InvenTree/InvenTree/config.py Show resolved Hide resolved
Comment on lines 203 to 204
with open(secret_key_file, 'r') as f:
key_data = f.read().strip()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
with open(secret_key_file, 'r') as f:
key_data = f.read().strip()
key_data=secret_key_file.read_text().strip()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed in d17e3dc

'workers': background_workers,
'timeout': 90,
'workers': int(get_setting('INVENTREE_BACKGROUND_WORKERS', 'background.workers', 4)),
'timeout': int(get_setting('INVENTREE_BACKGROUND_TIMEOUT', 'background.timeout', 4)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: the old default was 90; why the change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because "whoops". Fixed in 2492811. Thanks!

@@ -856,8 +718,8 @@ def _is_true(x):
SOCIALACCOUNT_STORE_TOKENS = True

# settings for allauth
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = get_setting('INVENTREE_LOGIN_CONFIRM_DAYS', CONFIG.get('login_confirm_days', 3))
ACCOUNT_LOGIN_ATTEMPTS_LIMIT = get_setting('INVENTREE_LOGIN_ATTEMPTS', CONFIG.get('login_attempts', 5))
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = get_setting('INVENTREE_LOGIN_CONFIRM_DAYS', 'login.confirm_days', 3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: is this a breaking change in the config file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed now thanks for pointing out.

@@ -877,8 +739,8 @@ def _is_true(x):
ACCOUNT_ADAPTER = 'InvenTree.forms.CustomAccountAdapter'

# login settings
REMOTE_LOGIN = get_setting('INVENTREE_REMOTE_LOGIN', CONFIG.get('remote_login', False))
REMOTE_LOGIN_HEADER = get_setting('INVENTREE_REMOTE_LOGIN_HEADER', CONFIG.get('remote_login_header', 'REMOTE_USER'))
REMOTE_LOGIN = get_boolean_setting('INVENTREE_REMOTE_LOGIN', 'remote_login.enabled', False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: new config path?

REMOTE_LOGIN = get_setting('INVENTREE_REMOTE_LOGIN', CONFIG.get('remote_login', False))
REMOTE_LOGIN_HEADER = get_setting('INVENTREE_REMOTE_LOGIN_HEADER', CONFIG.get('remote_login_header', 'REMOTE_USER'))
REMOTE_LOGIN = get_boolean_setting('INVENTREE_REMOTE_LOGIN', 'remote_login.enabled', False)
REMOTE_LOGIN_HEADER = get_setting('INVENTREE_REMOTE_LOGIN_HEADER', 'remote_login.header', 'REMOTE_USER')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deto

@@ -932,7 +795,7 @@ def _is_true(x):
sentry_sdk.set_tag(f'inventree_{key}', val)

# In-database error logging
IGNORRED_ERRORS = [
IGNORED_ERRORS = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: gotta love the typos - that is how you recognize me being in a code base

CONFIG.get('customize', {}),
{}
)
CUSTOMIZE = CONFIG.get('customize', {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: is the env variable removed here? Seems breaking

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f41af88

@SchrodingersGat
Copy link
Member Author

@SchrodingersGat not sure if i am miss understanding something but a bunch of config.yaml names seem to be renamed. This PR is highly breaking configs of that is the case.

I have reverted these now, the only changes for config.yaml should only be for newly supported variables.

@SchrodingersGat SchrodingersGat requested a review from matmair July 31, 2022 12:15
@SchrodingersGat SchrodingersGat removed the breaking Indicates a major update or change which breaks compatibility label Jul 31, 2022
@matmair
Copy link
Member

matmair commented Jul 31, 2022

@SchrodingersGat should be good to go

@SchrodingersGat SchrodingersGat merged commit e9b0f02 into inventree:master Jul 31, 2022
@SchrodingersGat SchrodingersGat deleted the demo-media-files branch July 31, 2022 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
setup Relates to the InvenTree setup / installation process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants