ozwillo: rename check_call() to run_command() (#18785)

This commit is contained in:
Benjamin Dauvergne 2017-09-19 16:47:25 +02:00
parent d90b1ab48a
commit 4d1aafbed4
1 changed files with 8 additions and 8 deletions

View File

@ -36,7 +36,7 @@ from .models import OzwilloInstance
logger = logging.getLogger(__name__)
def check_call(args):
def run_command(args):
try:
process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except OSError as e:
@ -152,7 +152,7 @@ def ozwillo_deploy_thread(data):
# Load user portal template
logger.debug(u'ozwillo: loading combo template')
check_call([
run_command([
'sudo', '-u', 'combo',
'combo-manage', 'tenant_command', 'import_site',
'/etc/hobo/ozwillo/import-site-template.json',
@ -161,7 +161,7 @@ def ozwillo_deploy_thread(data):
# Load agent portal template
logger.debug(u'ozwillo: loading combo agent template')
check_call([
run_command([
'sudo', '-u', 'combo',
'combo-manage', 'tenant_command', 'import_site',
'/etc/hobo/ozwillo/import-site-agents.json',
@ -171,7 +171,7 @@ def ozwillo_deploy_thread(data):
# Configure OIDC Ozwillo authentication
logger.debug(u'ozwillo: configuring OIDC ozwillo authentication')
domain_name = 'connexion-%s.%s' % (instance_name, settings.OZWILLO_ENV_DOMAIN)
if check_call([
if run_command([
'sudo', '-u', 'authentic-multitenant',
'authentic2-multitenant-manage', 'tenant_command', 'oidc-register-issuer',
'-d', domain_name,
@ -189,7 +189,7 @@ def ozwillo_deploy_thread(data):
# creation of the admin user depends upon the creation of provider
logger.debug(u'ozwillo: creating admin user')
create_user_script = os.path.dirname(__file__) + '/scripts/create_user_ozwillo.py'
check_call([
run_command([
'sudo', '-u', 'authentic-multitenant',
'authentic2-multitenant-manage', 'tenant_command', 'runscript', '-d', domain_name,
create_user_script, user['email_address'], user['id'], user['name']
@ -197,7 +197,7 @@ def ozwillo_deploy_thread(data):
# Load passerelle template
logger.debug(u'ozwillo: loading passerelle template')
check_call([
run_command([
'sudo', '-u', 'passerelle',
'passerelle-manage', 'tenant_command', 'import_site',
'/etc/hobo/ozwillo/import-site-passerelle.json',
@ -283,13 +283,13 @@ def ozwillo_destroy_thread(instance):
tenant = '%s%s.%s' % (infos[0], instance_slug, settings.OZWILLO_ENV_DOMAIN)
check_call([
run_command([
'sudo', '-u', service_user, infos[1],
'delete_tenant', '--force-drop', tenant
])
tenant = '%s%s.%s' % (wcs[0], instance_slug, settings.OZWILLO_ENV_DOMAIN)
check_call([
run_command([
'sudo', '-u', 'wcs',
wcs[1], '-f', '/etc/wcs/wcs-au-quotidien.cfg',
'delete_tenant', '--force-drop', tenant