From b3e7a9fbcbf52ac095ca424f3f17610bf1e8df88 Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Fri, 19 Jun 2020 14:30:10 -0700 Subject: [VVP] Enhance VSP contributor logic Issue-ID: VVP-423 Signed-off-by: stark, steven Change-Id: I6175185d862ef70056fec24e16942a347d37ab94 --- onap-client/onap_client/sdc/vsp.py | 26 +++++++++++--------------- onap-client/setup.py | 2 +- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/onap-client/onap_client/sdc/vsp.py b/onap-client/onap_client/sdc/vsp.py index c958978..cd478e1 100644 --- a/onap-client/onap_client/sdc/vsp.py +++ b/onap-client/onap_client/sdc/vsp.py @@ -141,21 +141,17 @@ class VSP(Resource): ).response_data.get("results", []) requestor_id = self.oc.sdc.vsp.catalog_resources["MODIFY_VSP_OWNER"].get("headers").get("USER_ID") - for contributer in self.contributers: - if ( - not user_exists(contributer, vsp_permissions, permission="Contributor") - and contributer != requestor_id - ): - self.oc.sdc.vsp.add_vsp_contributer( - user_id=contributer, software_product_id=self.software_product_id - ) - - if self.owner: - requestor_id = self.oc.sdc.vsp.catalog_resources["MODIFY_VSP_OWNER"].get("headers").get("USER_ID") - if ( - user_exists(requestor_id, vsp_permissions, permission="Owner") - and self.owner != requestor_id - ): + if user_exists(requestor_id, vsp_permissions, permission="Owner"): + for contributer in self.contributers: + if ( + not user_exists(contributer, vsp_permissions, permission="Contributor") + and contributer != requestor_id + ): + self.oc.sdc.vsp.add_vsp_contributer( + user_id=contributer, software_product_id=self.software_product_id + ) + + if self.owner and self.owner != requestor_id: self.oc.sdc.vsp.modify_vsp_owner( user_id=self.owner, software_product_id=self.software_product_id ) diff --git a/onap-client/setup.py b/onap-client/setup.py index 6f16e46..bf1caaa 100644 --- a/onap-client/setup.py +++ b/onap-client/setup.py @@ -47,7 +47,7 @@ for file in os.listdir("etc/payloads"): setuptools.setup( name="onap-client", - version="0.7.0", + version="0.7.1", author="Steven Stark", author_email="steven.stark@att.com", description="Python API wrapper for ONAP applications", -- cgit 1.2.3-korg