Commit 51a592d9 by Kevin Falcone

Remove xqueue special migration checks

Easier to read with ?w=1 since 80% of this is delete and unindent
parent 4c58cad4
...@@ -55,6 +55,7 @@ supervisor_spec: ...@@ -55,6 +55,7 @@ supervisor_spec:
- service: xqueue - service: xqueue
python: python.xqueue python: python.xqueue
code: "{{ xqueue_code_dir | default(None) }}" code: "{{ xqueue_code_dir | default(None) }}"
env: "{{ xqueue_app_dir | default(none) }}/xqueue_env"
- service: ecommerce - service: ecommerce
python: python.ecommerce python: python.ecommerce
code: "{{ ecommerce_code_dir | default(None) }}" code: "{{ ecommerce_code_dir | default(None) }}"
......
...@@ -77,7 +77,7 @@ if __name__ == '__main__': ...@@ -77,7 +77,7 @@ if __name__ == '__main__':
migration_args.add_argument("--edxapp-python", migration_args.add_argument("--edxapp-python",
help="Path to python to use for executing migration check.") help="Path to python to use for executing migration check.")
migration_args.add_argument("--edxapp-env", migration_args.add_argument("--edxapp-env",
help="Location of the ecommerce environment file.") help="Location of the edxapp environment file.")
xq_migration_args = parser.add_argument_group("xqueue_migrations", xq_migration_args = parser.add_argument_group("xqueue_migrations",
"Args for running xqueue migration checks.") "Args for running xqueue migration checks.")
...@@ -85,6 +85,8 @@ if __name__ == '__main__': ...@@ -85,6 +85,8 @@ if __name__ == '__main__':
help="Location of the xqueue code.") help="Location of the xqueue code.")
xq_migration_args.add_argument("--xqueue-python", xq_migration_args.add_argument("--xqueue-python",
help="Path to python to use for executing migration check.") help="Path to python to use for executing migration check.")
migration_args.add_argument("--xqueue-env",
help="Location of the xqueue environment file.")
ecom_migration_args = parser.add_argument_group("ecommerce_migrations", ecom_migration_args = parser.add_argument_group("ecommerce_migrations",
"Args for running ecommerce migration checks.") "Args for running ecommerce migration checks.")
...@@ -217,37 +219,27 @@ if __name__ == '__main__': ...@@ -217,37 +219,27 @@ if __name__ == '__main__':
try: try:
for service in services_for_instance(instance_id): for service in services_for_instance(instance_id):
if service in MIGRATION_COMMANDS: if service in MIGRATION_COMMANDS:
# Do extra migration related stuff. services = {
if service == 'xqueue' and args.xqueue_code_dir: "lms": {'python': args.edxapp_python, 'env_file': args.edxapp_env, 'code_dir': args.edxapp_code_dir},
cmd = MIGRATION_COMMANDS[service].format(python=args.xqueue_python, "cms": {'python': args.edxapp_python, 'env_file': args.edxapp_env, 'code_dir': args.edxapp_code_dir},
code_dir=args.xqueue_code_dir) "ecommerce": {'python': args.ecommerce_python, 'env_file': args.ecommerce_env, 'code_dir': args.ecommerce_code_dir},
if os.path.exists(args.xqueue_code_dir): "credentials": {'python': args.credentials_python, 'env_file': args.credentials_env, 'code_dir': args.credentials_code_dir},
os.chdir(args.xqueue_code_dir) "discovery": {'python': args.discovery_python, 'env_file': args.discovery_env, 'code_dir': args.discovery_code_dir},
# Run migration check command. "insights": {'python': args.insights_python, 'env_file': args.insights_env, 'code_dir': args.insights_code_dir},
output = subprocess.check_output(cmd, shell=True) "analytics_api": {'python': args.analytics_api_python, 'env_file': args.analytics_api_env, 'code_dir': args.analytics_api_code_dir},
if 'Migrating' in output: "xqueue": {'python': args.xqueue_python, 'env_file': args.xqueue_env, 'code_dir': args.xqueue_code_dir},
raise Exception("Migrations have not been run for {}".format(service)) }
else:
services = {
"lms": {'python': args.edxapp_python, 'env_file': args.edxapp_env, 'code_dir': args.edxapp_code_dir},
"cms": {'python': args.edxapp_python, 'env_file': args.edxapp_env, 'code_dir': args.edxapp_code_dir},
"ecommerce": {'python': args.ecommerce_python, 'env_file': args.ecommerce_env, 'code_dir': args.ecommerce_code_dir},
"credentials": {'python': args.credentials_python, 'env_file': args.credentials_env, 'code_dir': args.credentials_code_dir},
"discovery": {'python': args.discovery_python, 'env_file': args.discovery_env, 'code_dir': args.discovery_code_dir},
"insights": {'python': args.insights_python, 'env_file': args.insights_env, 'code_dir': args.insights_code_dir},
"analytics_api": {'python': args.analytics_api_python, 'env_file': args.analytics_api_env, 'code_dir': args.analytics_api_code_dir}
}
if service in services and all(arg!=None for arg in services[service].values()) and service in MIGRATION_COMMANDS: if service in services and all(arg!=None for arg in services[service].values()) and service in MIGRATION_COMMANDS:
serv_vars = services[service] serv_vars = services[service]
cmd = MIGRATION_COMMANDS[service].format(**serv_vars) cmd = MIGRATION_COMMANDS[service].format(**serv_vars)
if os.path.exists(serv_vars['code_dir']): if os.path.exists(serv_vars['code_dir']):
os.chdir(serv_vars['code_dir']) os.chdir(serv_vars['code_dir'])
# Run migration check command. # Run migration check command.
output = subprocess.check_output(cmd, shell=True, ) output = subprocess.check_output(cmd, shell=True, )
if '[ ]' in output: if '[ ]' in output:
raise Exception("Migrations have not been run for {}".format(service)) raise Exception("Migrations have not been run for {}".format(service))
# Link to available service. # Link to available service.
......
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