blob: 4771da21ee4226f70f8f629595ee9da98cd20920 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
from .. import errors
def check_resource(f):
def wrapped(self, resource_id=None, *args, **kwargs):
if resource_id is None:
if kwargs.get('container'):
resource_id = kwargs.pop('container')
elif kwargs.get('image'):
resource_id = kwargs.pop('image')
if not resource_id:
raise errors.NullResource(
'image or container param is undefined'
)
return f(self, resource_id, *args, **kwargs)
return wrapped
|