We're updating the issue view to help you get more done. 

[BB-1363] Add a management command to create or update site configuration

Description

This PR adds a new custom management command to create or update the site configuration (`SiteConfiguration` model) for LMS and Studio.

*Dependencies*: None

*Screenshots*: None

*Sandbox URL*: TBD - sandbox is being provisioned.

*Merge deadline*: None

*Testing instructions*:

1. Check out the source branch of the PR.
1. Run the management command with the `--help` flag to check its usage - `python manage.py lms create_or_update_site_configuration --help`.
1. Test the management command by passing the value for the required argument `--site-id`.
1. If there is no `SiteConfiguration` instance for the `Site` corresponding to the given site ID, a new instance is created and the provided values are set in it.
1. The optional site configuration parameters can be provided using the `e` argument (`-extra-vars` is equivalent) in the format `KEY=VALUE` where `KEY` is any valid JavaScript string and `VALUE` is any valid JavaScript literal. The whole `KEY=VALUE` value has to be quoted to prevent the shell from interpreting the any special characters in the `VALUE`. Some examples are:

  • `ENABLE_COMBINED_LOGIN_REGISTRATION=true`

  • `'a="A"'`

  • `'a="A B C"'`

  • `'a=[1, 2, 3]'`

  • `'a=["a", "b", "c"]'`

  • `'a={"A": 1}'`
    1. If the optional site configuration parameters are not provided, the site configuration instance is created if it doesn't exist already and left unmodified if it already exists.
    1. The site configuration instance can be enabled or disabled by passing either the `--enabled` or `--disabled` flag. Passing one of these flags without passing any site configuration parameters will result in the behavior mentioned in the previous point and in addition will set the `enabled` field to `True` or `False` based on the flag passed.
    1. A YAML file containing the parameters can also be passed as a value to the `-e` argument by prefixing it with the `@` character, for example, `-e @path/to/file.yml` and the parameters are read from the file in that case.
    1. A combination of inline parameters and the YAML file can be provided and the parameters provided later in the command will override the ones provided earlier if there is a conflict.

*Author notes and concerns*:
None.

*Reviewers*

  • [ ] @giovannicimolin

  • [ ] edX reviewer[s] TBD

Status

Assignee

Unassigned

Reporter

Open Source Pull Request Bot

Labels

Contributor Name

Guruprasad Lakshmi Narayanan

Repo

edx/edx-platform

PR Number

20,804

Customer

Course

None

OSCM Assignee

None

Github Latest Action

issue_comment: created

Github Latest Action by edX

Yes

Github PR Last Updated At

Jul 29, 2019, 8:59 PM

Github PR Last Updated By

natabene

Impacted Users (OSPR)

None

Impacted Environments (OSPR)

None

Feature Control (OSPR)

None

Priority

Unset