Uploaded image for project: 'Open Source Pull Requests'
  1. OSPR-3650

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

    Details

    • Type: Pull Request Review
    • Status: Awaiting Prioritization
    • Priority: Unset
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Labels:
    • Contributor Name:
      Guruprasad Lakshmi Narayanan
    • Repo:
      edx/edx-platform
    • PR Number:
      20,804
    • Customer:
    • Sprint:
    • Github Latest Action:
      issue_comment: created
    • Github Latest Action by edX:
      Yes
    • Github PR Last Updated By:
      feanil

      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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ospr-bot Open Source Pull Request Bot
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Github PR Last Updated At: