Commit 0304d9f7 by John Eskew

Add optional devstack param to whitelabel setup mgmt cmd.

parent fbdb6d1f
...@@ -19,6 +19,7 @@ class Command(BaseCommand): ...@@ -19,6 +19,7 @@ class Command(BaseCommand):
""" """
dns_name = None dns_name = None
theme_path = None theme_path = None
configuration_filename = None
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument( parser.add_argument(
...@@ -35,6 +36,12 @@ class Command(BaseCommand): ...@@ -35,6 +36,12 @@ class Command(BaseCommand):
required=True required=True
) )
parser.add_argument(
"--devstack",
action='store_true',
help="Use devstack config, otherwise sandbox config is assumed",
)
def find(self, pattern, path): def find(self, pattern, path):
""" """
Matches the given pattern in given path and returns the list of matching files. Matches the given pattern in given path and returns the list of matching files.
...@@ -51,7 +58,7 @@ class Command(BaseCommand): ...@@ -51,7 +58,7 @@ class Command(BaseCommand):
Reads the json files from theme directory and returns the site partner data in JSON format. Reads the json files from theme directory and returns the site partner data in JSON format.
""" """
site_data = {} site_data = {}
for config_file in self.find('sandbox_configuration.json', self.theme_path): for config_file in self.find(self.configuration_filename, self.theme_path):
logger.info("Reading file from {file_name}".format(file_name=config_file)) logger.info("Reading file from {file_name}".format(file_name=config_file))
configuration_data = json.loads( configuration_data = json.loads(
json.dumps( json.dumps(
...@@ -71,9 +78,16 @@ class Command(BaseCommand): ...@@ -71,9 +78,16 @@ class Command(BaseCommand):
""" """
Creates sites and partners. Creates sites and partners.
""" """
if options['devstack']:
configuration_prefix = 'devstack'
else:
configuration_prefix = 'sandbox'
self.configuration_filename = '{}_configuration.json'.format(configuration_prefix)
self.dns_name = options['dns_name'] self.dns_name = options['dns_name']
self.theme_path = options['theme_path'] self.theme_path = options['theme_path']
logger.info("Using %s configuration...", configuration_prefix)
logger.info("DNS name: '{dns_name}'".format(dns_name=self.dns_name)) logger.info("DNS name: '{dns_name}'".format(dns_name=self.dns_name))
logger.info("Theme path: '{theme_path}'".format(theme_path=self.theme_path)) logger.info("Theme path: '{theme_path}'".format(theme_path=self.theme_path))
......
{
"discovery_configuration":{
"site_domain": "discovery-dummy-{dns_name}.example.com",
"site_partner": "dummy",
"partner_data": {
"name": "dummy",
"oidc_key": "key-dummy",
"studio_url": "https://studio-dummy-{dns_name}.example.com",
"oidc_secret": "secret-{dns_name}",
"oidc_url_root": "https://dummy-{dns_name}.example.com/oauth2",
"courses_api_url": "https://dummy-{dns_name}.example.com/api/courses/v1/",
"ecommerce_api_url": "https://ecommerce-dummy-{dns_name}.example.com/",
"organizations_api_url": "https://dummy-{dns_name}.example.com/api/organizations/v0/"
}
}
}
...@@ -78,6 +78,18 @@ class CreateSitesAndPartnersTests(TestCase): ...@@ -78,6 +78,18 @@ class CreateSitesAndPartnersTests(TestCase):
"--theme-path", self.theme_path, "--theme-path", self.theme_path,
) )
def test_create_devstack_site_and_partner(self):
"""
Verify that command creates sites and Partners for devstack
"""
call_command(
"create_sites_and_partners",
"--dns-name", self.dns_name,
"--theme-path", self.theme_path,
"--devstack"
)
self._assert_site_and_partner_are_valid()
def test_create_site_and_partner(self): def test_create_site_and_partner(self):
""" """
Verify that command creates sites and Partners Verify that command creates sites and Partners
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment