Remove Policy.endpoint_id reference
Change-Id: I52741ed30b97b062b701293759cdf4279fda3a0c
This commit is contained in:
@@ -22,16 +22,12 @@ class Policy(base.Resource):
|
|||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
* id: a uuid that identifies the policy
|
* id: a uuid that identifies the policy
|
||||||
* endpoint_id: references the endpoint the policy applies to
|
|
||||||
* blob: a policy document (blob)
|
* blob: a policy document (blob)
|
||||||
* type: the mime type of the policy blob
|
* type: the mime type of the policy blob
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def update(self, endpoint=None, blob=None, type=None):
|
def update(self, blob=None, type=None):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'endpoint_id': (base.getid(endpoint)
|
|
||||||
if endpoint is not None
|
|
||||||
else self.endpoint_id),
|
|
||||||
'blob': blob if blob is not None else self.blob,
|
'blob': blob if blob is not None else self.blob,
|
||||||
'type': type if type is not None else self.type,
|
'type': type if type is not None else self.type,
|
||||||
}
|
}
|
||||||
@@ -51,9 +47,8 @@ class PolicyManager(base.CrudManager):
|
|||||||
collection_key = 'policies'
|
collection_key = 'policies'
|
||||||
key = 'policy'
|
key = 'policy'
|
||||||
|
|
||||||
def create(self, endpoint, blob, type='application/json'):
|
def create(self, blob, type='application/json'):
|
||||||
return super(PolicyManager, self).create(
|
return super(PolicyManager, self).create(
|
||||||
endpoint_id=base.getid(endpoint),
|
|
||||||
blob=blob,
|
blob=blob,
|
||||||
type=type)
|
type=type)
|
||||||
|
|
||||||
@@ -61,14 +56,12 @@ class PolicyManager(base.CrudManager):
|
|||||||
return super(PolicyManager, self).get(
|
return super(PolicyManager, self).get(
|
||||||
policy_id=base.getid(policy))
|
policy_id=base.getid(policy))
|
||||||
|
|
||||||
def list(self, endpoint=None):
|
def list(self):
|
||||||
return super(PolicyManager, self).list(
|
return super(PolicyManager, self).list()
|
||||||
endpoint_id=base.getid(endpoint))
|
|
||||||
|
|
||||||
def update(self, entity, endpoint=None, blob=None, type=None):
|
def update(self, entity, blob=None, type=None):
|
||||||
return super(PolicyManager, self).update(
|
return super(PolicyManager, self).update(
|
||||||
policy_id=base.getid(entity),
|
policy_id=base.getid(entity),
|
||||||
endpoint_id=base.getid(endpoint),
|
|
||||||
blob=blob,
|
blob=blob,
|
||||||
type=type)
|
type=type)
|
||||||
|
|
||||||
|
@@ -15,7 +15,6 @@ class PolicyTests(utils.TestCase, utils.CrudTests):
|
|||||||
|
|
||||||
def new_ref(self, **kwargs):
|
def new_ref(self, **kwargs):
|
||||||
kwargs = super(PolicyTests, self).new_ref(**kwargs)
|
kwargs = super(PolicyTests, self).new_ref(**kwargs)
|
||||||
kwargs.setdefault('endpoint_id', uuid.uuid4().hex)
|
|
||||||
kwargs.setdefault('type', uuid.uuid4().hex)
|
kwargs.setdefault('type', uuid.uuid4().hex)
|
||||||
kwargs.setdefault('blob', uuid.uuid4().hex)
|
kwargs.setdefault('blob', uuid.uuid4().hex)
|
||||||
return kwargs
|
return kwargs
|
||||||
|
Reference in New Issue
Block a user