Merge "Return 404 when delete non existing service" into release-0.1
This commit is contained in:
commit
808c09af4d
@ -16,6 +16,7 @@ from muranoapi import utils
|
||||
from muranoapi.db.services.systemservices import SystemServices
|
||||
from muranoapi.openstack.common import wsgi
|
||||
from muranoapi.openstack.common import log as logging
|
||||
from webob.exc import HTTPNotFound
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -52,8 +53,11 @@ class Controller(object):
|
||||
session_id = request.context.session
|
||||
delete = SystemServices.delete_service
|
||||
|
||||
delete(active_directory_id, 'activeDirectories', session_id,
|
||||
environment_id)
|
||||
try:
|
||||
delete(active_directory_id, 'activeDirectories', session_id,
|
||||
environment_id)
|
||||
except ValueError:
|
||||
raise HTTPNotFound()
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
@ -16,6 +16,7 @@ from muranoapi import utils
|
||||
from muranoapi.db.services.systemservices import SystemServices
|
||||
from muranoapi.openstack.common import wsgi
|
||||
from muranoapi.openstack.common import log as logging
|
||||
from webob.exc import HTTPNotFound
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -51,7 +52,10 @@ class Controller(object):
|
||||
session_id = request.context.session
|
||||
delete = SystemServices.delete_service
|
||||
|
||||
delete(app_farm_id, 'aspNetAppFarms', session_id, environment_id)
|
||||
try:
|
||||
delete(app_farm_id, 'aspNetAppFarms', session_id, environment_id)
|
||||
except ValueError:
|
||||
raise HTTPNotFound()
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
@ -16,6 +16,7 @@ from muranoapi import utils
|
||||
from muranoapi.db.services.systemservices import SystemServices
|
||||
from muranoapi.openstack.common import wsgi
|
||||
from muranoapi.openstack.common import log as logging
|
||||
from webob.exc import HTTPNotFound
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -51,7 +52,10 @@ class Controller(object):
|
||||
session_id = request.context.session
|
||||
delete = SystemServices.delete_service
|
||||
|
||||
delete(app_id, 'aspNetApps', session_id, environment_id)
|
||||
try:
|
||||
delete(app_id, 'aspNetApps', session_id, environment_id)
|
||||
except ValueError:
|
||||
raise HTTPNotFound()
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
@ -16,6 +16,7 @@ from muranoapi import utils
|
||||
from muranoapi.db.services.systemservices import SystemServices
|
||||
from muranoapi.openstack.common import wsgi
|
||||
from muranoapi.openstack.common import log as logging
|
||||
from webob.exc import HTTPNotFound
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -51,8 +52,11 @@ class Controller(object):
|
||||
session_id = request.context.session
|
||||
delete = SystemServices.delete_service
|
||||
|
||||
delete(web_server_farm_id, 'webServerFarms', session_id,
|
||||
environment_id)
|
||||
try:
|
||||
delete(web_server_farm_id, 'webServerFarms', session_id,
|
||||
environment_id)
|
||||
except ValueError:
|
||||
raise HTTPNotFound()
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
@ -16,6 +16,7 @@ from muranoapi import utils
|
||||
from muranoapi.db.services.systemservices import SystemServices
|
||||
from muranoapi.openstack.common import wsgi
|
||||
from muranoapi.openstack.common import log as logging
|
||||
from webob.exc import HTTPNotFound
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -51,7 +52,10 @@ class Controller(object):
|
||||
session_id = request.context.session
|
||||
delete = SystemServices.delete_service
|
||||
|
||||
delete(web_server_id, 'webServers', session_id, environment_id)
|
||||
try:
|
||||
delete(web_server_id, 'webServers', session_id, environment_id)
|
||||
except ValueError:
|
||||
raise HTTPNotFound()
|
||||
|
||||
|
||||
def create_resource():
|
||||
|
@ -289,12 +289,15 @@ class SystemServices(object):
|
||||
environment_id, session_id)
|
||||
|
||||
if not 'services' in env_description:
|
||||
raise ValueError('This environment does not have services')
|
||||
raise NameError('This environment does not have services')
|
||||
|
||||
services = []
|
||||
if service_type in env_description['services']:
|
||||
services = env_description['services'][service_type]
|
||||
|
||||
if service_id not in [srv['id'] for srv in services]:
|
||||
raise ValueError('Specified service does not exist')
|
||||
|
||||
services = [srv for srv in services if srv['id'] != service_id]
|
||||
env_description['services'][service_type] = services
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user