From 9b7e81e78c70514aa123482610e274869b6ba137 Mon Sep 17 00:00:00 2001 From: Miroslav Los Date: Thu, 14 Nov 2019 17:36:44 +0100 Subject: Support python3 in all plugins Unify tox/requirements/setup.py requirement specifications. Use cloudify-common 5.0.5 release. For helm, use a dev cloudify-common build with better python3 code. Use PEP 508 URLs in requirements for the non-PyPI (github) release. Fix mixed indentation and trailing whitespace. Signed-off-by: Miroslav Los Issue-ID: CCSDK-1931 Change-Id: I607957d9e2c299121785f3f02420c6038966a200 --- dmaap/consulif/consulif.py | 7 +++- dmaap/dmaap.yaml | 2 +- dmaap/dmaapcontrollerif/dmaap_requests.py | 16 +++++---- dmaap/dmaapplugin/__init__.py | 3 +- dmaap/dmaapplugin/dr_bridge.py | 3 +- dmaap/dmaapplugin/dr_lifecycle.py | 15 +++++---- dmaap/dmaapplugin/dr_relationships.py | 3 +- dmaap/dmaapplugin/mr_lifecycle.py | 3 +- dmaap/pom.xml | 4 +-- dmaap/requirements.txt | 4 ++- dmaap/setup.py | 28 +++++++++++++--- dmaap/tests/test_dmaapcontrollerif.py | 17 ++++++---- dmaap/tests/test_dr_lifecycle.py | 17 ++++++---- dmaap/tests/test_mr_lifecycle.py | 17 ++++++---- dmaap/tox.ini | 8 +++-- dnsdesig/dns_types.yaml | 2 +- dnsdesig/dnsdesig/dns_plugin.py | 10 +++--- dnsdesig/pom.xml | 4 +-- dnsdesig/requirements.txt | 2 ++ dnsdesig/setup.py | 11 ++++--- dnsdesig/tests/test_plugin.py | 7 ++-- dnsdesig/tox.ini | 8 +++-- helm/dev-requirements.txt | 6 ---- helm/helm-type.yaml | 2 +- helm/plugin/tasks.py | 28 +++++++++------- helm/plugin/workflows.py | 2 +- helm/pom.xml | 4 +-- helm/requirements.txt | 17 ++++++++++ helm/setup.py | 13 ++++---- helm/tox.ini | 46 +++++++++++++++++++++++--- pgaas/pgaas/pgaas_plugin.py | 54 ++++++++++++++----------------- pgaas/pgaas_types.yaml | 2 +- pgaas/pom.xml | 4 +-- pgaas/requirements.txt | 2 ++ pgaas/setup.py | 11 ++++--- pgaas/tox.ini | 15 +++------ pom.xml | 2 +- sshkeyshare/pom.xml | 2 +- sshkeyshare/requirements.txt | 1 + sshkeyshare/setup.py | 10 +++--- sshkeyshare/sshkey_types.yaml | 2 +- sshkeyshare/tox.ini | 5 +-- 42 files changed, 262 insertions(+), 157 deletions(-) delete mode 100644 helm/dev-requirements.txt create mode 100644 helm/requirements.txt diff --git a/dmaap/consulif/consulif.py b/dmaap/consulif/consulif.py index 8033603..5c78b89 100644 --- a/dmaap/consulif/consulif.py +++ b/dmaap/consulif/consulif.py @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +19,11 @@ import consul import json -from urlparse import urlparse +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse + class ConsulHandle(object): ''' diff --git a/dmaap/dmaap.yaml b/dmaap/dmaap.yaml index 4a47a7f..a4fe9fb 100644 --- a/dmaap/dmaap.yaml +++ b/dmaap/dmaap.yaml @@ -25,7 +25,7 @@ plugins: dmaapplugin: executor: 'central_deployment_agent' package_name: dmaap - package_version: 1.3.5 + package_version: 1.4.0 node_types: diff --git a/dmaap/dmaapcontrollerif/dmaap_requests.py b/dmaap/dmaapcontrollerif/dmaap_requests.py index 231953a..0f02594 100644 --- a/dmaap/dmaapcontrollerif/dmaap_requests.py +++ b/dmaap/dmaapcontrollerif/dmaap_requests.py @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -287,14 +288,15 @@ class DMaaPControllerHandle(object): locations.raise_for_status() # pull out location names for VALID locations with matching dcae_layer - return map(lambda l: l["dcaeLocationName"], - filter(lambda i : (i['dcaeLayer'] == dcae_layer and i['status'] == 'VALID'), - locations.json())) + return [location["dcaeLocationName"] for location in locations.json() + if location['dcaeLayer'] == dcae_layer + and location['status'] == 'VALID'] def get_dcae_central_locations(self): ''' Get the list of location names known to the DMaaP bus controller - whose "dcaeLayer" property contains "central" (ignoring case) and whose status is "VALID". + whose "dcaeLayer" property contains "central" (ignoring case) + and whose status is "VALID". "dcaeLayer" contains "central" for central sites. ''' # Do these as a separate step so things like 404 get reported precisely @@ -302,7 +304,7 @@ class DMaaPControllerHandle(object): locations.raise_for_status() # pull out location names for VALID central locations - return map(lambda l: l["dcaeLocationName"], - filter(lambda i : ('central' in i['dcaeLayer'].lower() and i['status'] == 'VALID'), - locations.json())) + return [location["dcaeLocationName"] for location in locations.json() + if 'central' in location['dcaeLayer'].lower() + and location['status'] == 'VALID'] diff --git a/dmaap/dmaapplugin/__init__.py b/dmaap/dmaapplugin/__init__.py index 43da00e..faa331b 100644 --- a/dmaap/dmaapplugin/__init__.py +++ b/dmaap/dmaapplugin/__init__.py @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ from consulif.consulif import ConsulHandle from cloudify.exceptions import NonRecoverableError import os -os.environ["REQUESTS_CA_BUNDLE"]="/opt/onap/certs/cacert.pem" # This is to handle https request thru plugin +os.environ["REQUESTS_CA_BUNDLE"]="/opt/onap/certs/cacert.pem" # This is to handle https request thru plugin CONSUL_HOST = "consul" # Should always be a local consul agent on Cloudify Manager DBCL_KEY_NAME = "dmaap-plugin" # Consul key containing DMaaP data bus credentials diff --git a/dmaap/dmaapplugin/dr_bridge.py b/dmaap/dmaapplugin/dr_bridge.py index 25022bb..f4c5cdc 100644 --- a/dmaap/dmaapplugin/dr_bridge.py +++ b/dmaap/dmaapplugin/dr_bridge.py @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +21,7 @@ from cloudify import ctx from cloudify.decorators import operation from cloudify.exceptions import NonRecoverableError from dmaapplugin import DMAAP_API_URL, DMAAP_USER, DMAAP_PASS -from dmaaputils import random_string +from dmaapplugin.dmaaputils import random_string from dmaapcontrollerif.dmaap_requests import DMaaPControllerHandle # Set up a subscriber to a source feed diff --git a/dmaap/dmaapplugin/dr_lifecycle.py b/dmaap/dmaapplugin/dr_lifecycle.py index 718158a..4efeef5 100644 --- a/dmaap/dmaapplugin/dr_lifecycle.py +++ b/dmaap/dmaapplugin/dr_lifecycle.py @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +21,7 @@ from cloudify import ctx from cloudify.decorators import operation from cloudify.exceptions import NonRecoverableError from dmaapplugin import DMAAP_API_URL, DMAAP_USER, DMAAP_PASS, DMAAP_OWNER -from dmaaputils import random_string +from dmaapplugin.dmaaputils import random_string from dmaapcontrollerif.dmaap_requests import DMaaPControllerHandle # Lifecycle operations for DMaaP Data Router feeds @@ -47,19 +48,19 @@ def create_feed(**kwargs): feed_name = random_string(12) # Set defaults/placeholders for the optional properties for the feed - if "feed_version" in ctx.node.properties.keys(): + if "feed_version" in ctx.node.properties: feed_version = ctx.node.properties["feed_version"] else: feed_version = "0.0" - if "feed_description" in ctx.node.properties.keys(): + if "feed_description" in ctx.node.properties: feed_description = ctx.node.properties["feed_description"] else: feed_description = "No description provided" - if "aspr_classification" in ctx.node.properties.keys(): + if "aspr_classification" in ctx.node.properties: aspr_classification = ctx.node.properties["aspr_classification"] else: aspr_classification = "unclassified" - if "useExisting" in ctx.node.properties.keys(): + if "useExisting" in ctx.node.properties: useExisting = ctx.node.properties["useExisting"] else: useExisting = False @@ -98,10 +99,10 @@ def get_existing_feed(**kwargs): dmc = DMaaPControllerHandle(DMAAP_API_URL, DMAAP_USER, DMAAP_PASS, ctx.logger) ctx.logger.info("DMaaPControllerHandle() returned") feed_id_input = False - if "feed_id" in ctx.node.properties.keys(): + if "feed_id" in ctx.node.properties: feed_id_input = True f = dmc.get_feed_info(ctx.node.properties["feed_id"]) - elif "feed_name" in ctx.node.properties.keys(): + elif "feed_name" in ctx.node.properties: feed_name = ctx.node.properties["feed_name"] f = dmc.get_feed_info_by_name(feed_name) if f is None: diff --git a/dmaap/dmaapplugin/dr_relationships.py b/dmaap/dmaapplugin/dr_relationships.py index 4c955f2..bdb742d 100644 --- a/dmaap/dmaapplugin/dr_relationships.py +++ b/dmaap/dmaapplugin/dr_relationships.py @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +21,7 @@ from cloudify import ctx from cloudify.decorators import operation from cloudify.exceptions import NonRecoverableError from dmaapplugin import DMAAP_API_URL, DMAAP_USER, DMAAP_PASS, CONSUL_HOST -from dmaaputils import random_string +from dmaapplugin.dmaaputils import random_string from dmaapcontrollerif.dmaap_requests import DMaaPControllerHandle from consulif.consulif import ConsulHandle diff --git a/dmaap/dmaapplugin/mr_lifecycle.py b/dmaap/dmaapplugin/mr_lifecycle.py index ec674de..eb4e1ba 100644 --- a/dmaap/dmaapplugin/mr_lifecycle.py +++ b/dmaap/dmaapplugin/mr_lifecycle.py @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +21,7 @@ from cloudify import ctx from cloudify.decorators import operation from cloudify.exceptions import NonRecoverableError from dmaapplugin import DMAAP_API_URL, DMAAP_USER, DMAAP_PASS, DMAAP_OWNER -from dmaaputils import random_string +from dmaapplugin.dmaaputils import random_string from dmaapcontrollerif.dmaap_requests import DMaaPControllerHandle # Lifecycle operations for DMaaP Message Router topics diff --git a/dmaap/pom.xml b/dmaap/pom.xml index f49bb8c..95f0774 100644 --- a/dmaap/pom.xml +++ b/dmaap/pom.xml @@ -23,7 +23,7 @@ limitations under the License. org.onap.ccsdk.platform plugins - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT @@ -31,7 +31,7 @@ limitations under the License. dmaap dmaap - 1.0.1-SNAPSHOT + 1.4.0-SNAPSHOT http://maven.apache.org diff --git a/dmaap/requirements.txt b/dmaap/requirements.txt index ffdb97f..54ffbc4 100644 --- a/dmaap/requirements.txt +++ b/dmaap/requirements.txt @@ -1 +1,3 @@ -python-consul==0.7.0 +python-consul>=0.7.0 +requests +cloudify-common>=5.0.5 diff --git a/dmaap/setup.py b/dmaap/setup.py index c423d95..7a4c85c 100644 --- a/dmaap/setup.py +++ b/dmaap/setup.py @@ -1,8 +1,26 @@ +# ============LICENSE_START==================================================== +# ============================================================================= +# Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END====================================================== + from setuptools import setup, find_packages setup( name = "dmaap", - version = "1.3.5", + version = "1.4.0", packages=find_packages(), author = "AT&T", description = ("Cloudify plugin for creating DMaaP feeds and topics, and setting up publishers and subscribers."), @@ -10,7 +28,9 @@ setup( keywords = "", url = "", zip_safe=False, - install_requires = [ - "python-consul==0.7.0" - ] + install_requires=[ + 'python-consul>=0.7.0', + 'requests', + 'cloudify-common>=5.0.5', + ], ) diff --git a/dmaap/tests/test_dmaapcontrollerif.py b/dmaap/tests/test_dmaapcontrollerif.py index 0f6a5c0..6ca15ba 100644 --- a/dmaap/tests/test_dmaapcontrollerif.py +++ b/dmaap/tests/test_dmaapcontrollerif.py @@ -2,6 +2,7 @@ # org.onap.dcae # ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -52,13 +53,15 @@ def test_dmaapc (monkeypatch, mockconsul, mockdmaapbc): DMAAP_OWNER = config['owner'] properties = {'fqdn': 'a.x.example.com', 'openstack': _goodosv2 } - mock_ctx = MockCloudifyContext(node_id='test_node_id', node_name='test_node_name', properties=properties, - runtime_properties = { - "admin": { "user": "admin_user" }, - "user": { "user": "user_user" }, - "viewer": { "user": "viewer_user" } - } - ) + mock_ctx = MockCloudifyContext( + node_id='test_node_id', + node_name='test_node_name', + properties=properties, + runtime_properties = { + "admin": { "user": "admin_user" }, + "user": { "user": "user_user" }, + "viewer": { "user": "viewer_user" } + }) current_ctx.set(mock_ctx) diff --git a/dmaap/tests/test_dr_lifecycle.py b/dmaap/tests/test_dr_lifecycle.py index 925d575..d08e9db 100644 --- a/dmaap/tests/test_dr_lifecycle.py +++ b/dmaap/tests/test_dr_lifecycle.py @@ -2,6 +2,7 @@ # org.onap.dcae # ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -41,13 +42,15 @@ def test_create_feed(monkeypatch, mockconsul, mockdmaapbc): from dmaapplugin import dr_lifecycle properties = {'fqdn': 'a.x.example.com', 'openstack': _goodosv2, 'feed_id': 'test_feed_id' } - mock_ctx = MockCloudifyContext(node_id='test_node_id', node_name='test_node_name', properties=properties, - runtime_properties = { - "admin": { "user": "admin_user" }, - "user": { "user": "user_user" }, - "viewer": { "user": "viewer_user" } - } - ) + mock_ctx = MockCloudifyContext( + node_id='test_node_id', + node_name='test_node_name', + properties=properties, + runtime_properties = { + "admin": { "user": "admin_user" }, + "user": { "user": "user_user" }, + "viewer": { "user": "viewer_user" } + }) current_ctx.set(mock_ctx) diff --git a/dmaap/tests/test_mr_lifecycle.py b/dmaap/tests/test_mr_lifecycle.py index b2ee713..593c091 100644 --- a/dmaap/tests/test_mr_lifecycle.py +++ b/dmaap/tests/test_mr_lifecycle.py @@ -2,6 +2,7 @@ # org.onap.dcae # ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,13 +41,15 @@ def test_create_topic(monkeypatch, mockconsul, mockdmaapbc): import dmaapplugin from dmaapplugin import mr_lifecycle properties = {'fqdn': 'a.x.example.com', 'openstack': _goodosv2, 'fqtn': 'test_fqtn' } - mock_ctx = MockCloudifyContext(node_id='test_node_id', node_name='test_node_name', properties=properties, - runtime_properties = { - "admin": { "user": "admin_user" }, - "user": { "user": "user_user" }, - "viewer": { "user": "viewer_user" } - } - ) + mock_ctx = MockCloudifyContext( + node_id='test_node_id', + node_name='test_node_name', + properties=properties, + runtime_properties = { + "admin": { "user": "admin_user" }, + "user": { "user": "user_user" }, + "viewer": { "user": "viewer_user" } + }) current_ctx.set(mock_ctx) diff --git a/dmaap/tox.ini b/dmaap/tox.ini index 15a07f2..020413f 100644 --- a/dmaap/tox.ini +++ b/dmaap/tox.ini @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,14 +18,15 @@ # ============LICENSE_END====================================================== [tox] -envlist = py27 +envlist = py27,py36,py37 +skip_missing_interpreters = true + [testenv] deps= - requests - cloudify==3.4 pytest coverage pytest-cov + -r requirements.txt setenv = PYTHONPATH={toxinidir} commands= diff --git a/dnsdesig/dns_types.yaml b/dnsdesig/dns_types.yaml index f07a8f7..c158317 100644 --- a/dnsdesig/dns_types.yaml +++ b/dnsdesig/dns_types.yaml @@ -24,7 +24,7 @@ plugins: dns_designate: executor: central_deployment_agent package_name: dnsdesig - package_version: 1.0.0 + package_version: 1.1.0 node_types: ccsdk.nodes.dns.arecord: diff --git a/dnsdesig/dnsdesig/dns_plugin.py b/dnsdesig/dnsdesig/dns_plugin.py index d46468d..e1fe850 100644 --- a/dnsdesig/dnsdesig/dns_plugin.py +++ b/dnsdesig/dnsdesig/dns_plugin.py @@ -2,13 +2,14 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +18,6 @@ # ============LICENSE_END====================================================== import requests -from urlparse import urlparse from cloudify import ctx from cloudify.decorators import operation from cloudify.exceptions import NonRecoverableError, RecoverableError @@ -34,8 +34,8 @@ def _get_auth_info(openstack): (tok, gbls, urls) = _get_auth_info_v2(openstack) else: (tok, gbls, urls) = _get_auth_info_v3(openstack) - if len(urls.keys()) == 1: - reg = urls.keys()[0] + if len(urls) == 1: + reg = list(urls)[0] else: reg = openstack['region'] if reg in urls and 'dns' in urls[reg]: diff --git a/dnsdesig/pom.xml b/dnsdesig/pom.xml index fdf5395..f978ad7 100644 --- a/dnsdesig/pom.xml +++ b/dnsdesig/pom.xml @@ -23,7 +23,7 @@ limitations under the License. org.onap.ccsdk.platform plugins - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT @@ -31,7 +31,7 @@ limitations under the License. dnsdesig dnsdesig - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT http://maven.apache.org diff --git a/dnsdesig/requirements.txt b/dnsdesig/requirements.txt index e69de29..abbe5e5 100644 --- a/dnsdesig/requirements.txt +++ b/dnsdesig/requirements.txt @@ -0,0 +1,2 @@ +requests +cloudify-common>=5.0.5 diff --git a/dnsdesig/setup.py b/dnsdesig/setup.py index 35578ce..d34d362 100644 --- a/dnsdesig/setup.py +++ b/dnsdesig/setup.py @@ -2,13 +2,14 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,7 +22,7 @@ from setuptools import setup, find_packages setup( name='dnsdesig', - version='1.0.1', + version='1.1.0', packages=find_packages(), author='AT&T', description=('Cloudify plugin for creating DNS entries using Designate.'), @@ -31,5 +32,7 @@ setup( zip_safe=False, package_data={'':['LICENSE.txt']}, install_requires=[ - ] + 'requests', + 'cloudify-common>=5.0.5', + ], ) diff --git a/dnsdesig/tests/test_plugin.py b/dnsdesig/tests/test_plugin.py index 78b3483..80e68ec 100644 --- a/dnsdesig/tests/test_plugin.py +++ b/dnsdesig/tests/test_plugin.py @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -189,9 +190,9 @@ _answers = [ 'publicURL': 'https://example.com/dns', 'region': 'r' }, - { - 'publicURL': 'https://example.com/otherregions' - } + { + 'publicURL': 'https://example.com/otherregions' + } ] } ] diff --git a/dnsdesig/tox.ini b/dnsdesig/tox.ini index 0b0f114..dd74ebb 100644 --- a/dnsdesig/tox.ini +++ b/dnsdesig/tox.ini @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,14 +18,15 @@ # ============LICENSE_END====================================================== [tox] -envlist = py27 +envlist = py27,py36,py37 +skip_missing_interpreters = true + [testenv] deps= - requests - cloudify==3.4 pytest coverage pytest-cov + -r requirements.txt setenv= PYTHONPATH={toxinidir} commands= diff --git a/helm/dev-requirements.txt b/helm/dev-requirements.txt deleted file mode 100644 index 48bc5ba..0000000 --- a/helm/dev-requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -pyyaml==3.12 - --e git+https://github.com/cloudify-cosmo/cloudify-dsl-parser@4.1.1-build#egg=cloudify-dsl-parser==4.1.1 --e git+https://github.com/cloudify-cosmo/cloudify-rest-client@4.1.1-build#egg=cloudify-rest-client==4.1.1 --e git+https://github.com/cloudify-cosmo/cloudify-plugins-common@4.1.1-build#egg=cloudify-plugins-common==4.1.1 -nose diff --git a/helm/helm-type.yaml b/helm/helm-type.yaml index 37c22d4..d491688 100644 --- a/helm/helm-type.yaml +++ b/helm/helm-type.yaml @@ -19,7 +19,7 @@ plugins: helm-plugin: executor: central_deployment_agent package_name: helm - package_version: 4.0.2 + package_version: 4.1.0 node_types: diff --git a/helm/plugin/tasks.py b/helm/plugin/tasks.py index be59472..535f14e 100644 --- a/helm/plugin/tasks.py +++ b/helm/plugin/tasks.py @@ -1,6 +1,7 @@ # ============LICENSE_START========================================== # =================================================================== # Copyright (c) 2018 AT&T +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +16,6 @@ # limitations under the License. # ============LICENSE_END============================================ -from cloudify.decorators import operation import shutil import errno import sys @@ -25,17 +25,21 @@ import os import re import getpass import subprocess -from cloudify import ctx -from cloudify.exceptions import OperationRetry -from cloudify_rest_client.exceptions import CloudifyClientError -import pip import json import base64 import yaml -import urllib2 -from cloudify.decorators import operation +try: + from urllib.request import Request, urlopen +except ImportError: + from urllib2 import Request, urlopen + +from cloudify import ctx from cloudify import exceptions +from cloudify.decorators import operation +from cloudify.exceptions import OperationRetry from cloudify.exceptions import NonRecoverableError +from cloudify_rest_client.exceptions import CloudifyClientError + def debug_log_mask_credentials(_command_str): debug_str = _command_str @@ -186,18 +190,18 @@ def pop_config_info(url, config_file, f_format, repo_user, repo_user_passwd): head, auth = head.rsplit('//', 1) url = head + '//' + end username, password = auth.rsplit(':', 1) - request = urllib2.Request(url) + request = Request(url) base64string = base64.encodestring( '%s:%s' % (username, password)).replace('\n', '') request.add_header("Authorization", "Basic %s" % base64string) - response = urllib2.urlopen(request) + response = urlopen(request) elif repo_user != '' and repo_user_passwd != '': - request = urllib2.Request(url) + request = Request(url) base64string = base64.b64encode('%s:%s' % (repo_user, repo_user_passwd)) request.add_header("Authorization", "Basic %s" % base64string) - response = urllib2.urlopen(request) + response = urlopen(request) else: - response = urllib2.urlopen(url) + response = urlopen(url) config_obj = {} if f_format == 'json': diff --git a/helm/plugin/workflows.py b/helm/plugin/workflows.py index be1db8d..fddebe0 100644 --- a/helm/plugin/workflows.py +++ b/helm/plugin/workflows.py @@ -1,6 +1,7 @@ # ============LICENSE_START========================================== # =================================================================== # Copyright (c) 2018 AT&T +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +19,6 @@ from cloudify.decorators import workflow from cloudify.workflows import ctx from cloudify.exceptions import NonRecoverableError -import urllib2 import json import yaml import base64 diff --git a/helm/pom.xml b/helm/pom.xml index 81df0e8..399b49a 100644 --- a/helm/pom.xml +++ b/helm/pom.xml @@ -23,7 +23,7 @@ limitations under the License. org.onap.ccsdk.platform plugins - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT @@ -31,7 +31,7 @@ limitations under the License. helm helm - 1.0.1-SNAPSHOT + 4.1.0-SNAPSHOT http://maven.apache.org diff --git a/helm/requirements.txt b/helm/requirements.txt new file mode 100644 index 0000000..038951f --- /dev/null +++ b/helm/requirements.txt @@ -0,0 +1,17 @@ +pyyaml>=3.12 +#cloudify-common>=5.0.5 +# The released version of cloudify-common has limited python3 support. +# +# This build linked from github is more complete in this regard, and +# has at least the tests written for pgaas passing. The other plugins +# do not seem to have tests that exercise the unconverted parts. +# +# The build was created from a WIP branch, but only parts of the branch +# were merged for release 5.0.5. +# +# It means that while this plugin is ready for python3, all the plugins +# will need to wait for a python3-supporting release of cloudify. +# When such a version is released, the single requirement should suffice. +# The install_requires in setup.py may also be uncommented then. +cloudify-common>=5.0.5; python_version<"3" +cloudify-common @ git+https://github.com/cloudify-cosmo/cloudify-common@cy-1374-python3#egg=cloudify-common==5.0.5; python_version>="3" diff --git a/helm/setup.py b/helm/setup.py index a0b17ef..ff84d0d 100644 --- a/helm/setup.py +++ b/helm/setup.py @@ -1,6 +1,7 @@ # ============LICENSE_START========================================== # =================================================================== # Copyright (c) 2018 AT&T +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +25,7 @@ setup( # Do not use underscores in the plugin name. name='helm', - version='4.0.2', + version='4.1.0', author='Nicolas Hu(AT&T)', author_email='jh245g@att.com', description='This plugin will install/uninstall/upgrade/rollback helm ' @@ -36,12 +37,12 @@ setup( license='LICENSE', zip_safe=False, install_requires=[ - # Necessary dependency for developing plugins, do not remove! 'pyyaml>=3.12', - "cloudify-plugins-common>=4.1.1" + # The package specified by requirements would be replaced with 5.0.5.1+ + # when this package is installed. That currently breaks on python3. + #'cloudify-common>=5.0.5', ], test_requires=[ - "cloudify-dsl-parser>=4.1.1" - "nose" - ] + 'nose', + ], ) diff --git a/helm/tox.ini b/helm/tox.ini index 31e033e..7eb438d 100644 --- a/helm/tox.ini +++ b/helm/tox.ini @@ -1,6 +1,24 @@ -# content of: tox.ini , put in same dir as setup.py +# ============LICENSE_START==================================================== +# ============================================================================= +# Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END====================================================== + [tox] -envlist=flake8,py27 +envlist = flake8,py27,py36,py37 +skip_missing_interpreters = true [testenv:py27] deps = @@ -9,8 +27,28 @@ deps = nose-cov mock testfixtures - -rdev-requirements.txt + nose + -r requirements.txt + +[testenv:py36] +deps = + coverage + nose-cov + mock + testfixtures + nose + -r requirements.txt + +[testenv:py37] +deps = + coverage + nose-cov + mock + testfixtures + nose + -r requirements.txt +[testenv] passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY # commands=nosetests --with-cov --cov-report term-missing --cov plugin plugin/tests @@ -22,5 +60,5 @@ ignore=E302,F401,E501,E712,F811,F841,E127,E128.W291 [testenv:flake8] deps = flake8 - -rdev-requirements.txt + -r requirements.txt commands=flake8 plugin diff --git a/pgaas/pgaas/pgaas_plugin.py b/pgaas/pgaas/pgaas_plugin.py index b1625c5..a73407c 100644 --- a/pgaas/pgaas/pgaas_plugin.py +++ b/pgaas/pgaas/pgaas_plugin.py @@ -2,6 +2,7 @@ # ============LICENSE_START==================================================== # ============================================================================= # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,22 +23,6 @@ PostgreSQL plugin to manage passwords from __future__ import print_function import sys -USING_PYTHON2 = sys.version_info[0] < 3 - -# pylint: disable=wrong-import-position -# pylint: disable=wrong-import-order -# pylint: disable=import-error -from cloudify import ctx -from cloudify.decorators import operation -from cloudify.exceptions import NonRecoverableError -from cloudify.exceptions import RecoverableError - -# pylint: disable=wildcard-import -if USING_PYTHON2: - from logginginterface import debug, info, warn, error -else: - from .logginginterface import debug, info, warn, error - import os import re import json @@ -45,20 +30,31 @@ import hashlib import socket import traceback import base64 -if USING_PYTHON2: - import urllib -else: - import urllib.request - import urllib.parse - import urllib.error +import binascii import collections +try: + from urllib.parse import quote +except ImportError: + from urllib import quote + +from cloudify import ctx +from cloudify.decorators import operation +from cloudify.exceptions import NonRecoverableError +from cloudify.exceptions import RecoverableError + +try: + import psycopg2 +except ImportError: + # FIXME: any users of this plugin installing its dependencies in nonstandard + # directories should set up PYTHONPATH accordingly, outside the program code + SYSPATH = sys.path + sys.path = list(SYSPATH) + sys.path.append('/usr/lib64/python2.7/site-packages') + import psycopg2 + sys.path = SYSPATH +from pgaas.logginginterface import debug, info, warn, error -SYSPATH = sys.path -sys.path = list(SYSPATH) -sys.path.append('/usr/lib64/python2.7/site-packages') -import psycopg2 -sys.path = SYSPATH """ To set up a cluster: @@ -185,8 +181,7 @@ def safestr(s): """ returns a safely printable version of the string """ - # pylint: disable=no-member - return urllib.quote(str(s), '') if USING_PYTHON2 else urllib.parse.quote(str(s), '') + return quote(str(s), '') def raiseRecoverableError(msg): """ @@ -739,7 +734,6 @@ def update_database(refctx, **kwargs): with open(hostPortDbname, "a") as fp: with open("/dev/urandom", "rb") as rp: b = rp.read(16) - import binascii print(binascii.hexlify(b).decode('utf-8'), file=fp) appended = True if not appended: diff --git a/pgaas/pgaas_types.yaml b/pgaas/pgaas_types.yaml index 60a8fa7..951fbd5 100644 --- a/pgaas/pgaas_types.yaml +++ b/pgaas/pgaas_types.yaml @@ -5,7 +5,7 @@ plugins: pgaas: executor: central_deployment_agent package_name: pgaas - package_version: 1.1.0 + package_version: 1.2.0 node_types: dcae.nodes.pgaas.cluster: diff --git a/pgaas/pom.xml b/pgaas/pom.xml index 6db8454..9946840 100644 --- a/pgaas/pom.xml +++ b/pgaas/pom.xml @@ -23,7 +23,7 @@ limitations under the License. org.onap.ccsdk.platform plugins - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT @@ -31,7 +31,7 @@ limitations under the License. pgaas pgaas - 1.0.1-SNAPSHOT + 1.2.0-SNAPSHOT http://maven.apache.org diff --git a/pgaas/requirements.txt b/pgaas/requirements.txt index e69de29..83a931a 100644 --- a/pgaas/requirements.txt +++ b/pgaas/requirements.txt @@ -0,0 +1,2 @@ +psycopg2-binary +cloudify-common>=5.0.5 diff --git a/pgaas/setup.py b/pgaas/setup.py index 5454a37..55a6596 100644 --- a/pgaas/setup.py +++ b/pgaas/setup.py @@ -2,13 +2,14 @@ # ============LICENSE_START==================================================== # ============================================================================= # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +21,7 @@ from setuptools import setup, find_packages setup( name="pgaas", - version="1.1.0", + version="1.2.0", packages=find_packages(), author="AT&T", description=("Cloudify plugin for pgaas/pgaas."), @@ -29,5 +30,7 @@ setup( url="https://onap.org", zip_safe=False, install_requires=[ - ] + 'psycopg2-binary', + 'cloudify-common>=5.0.5', + ], ) diff --git a/pgaas/tox.ini b/pgaas/tox.ini index 4a2f99e..d6956bb 100644 --- a/pgaas/tox.ini +++ b/pgaas/tox.ini @@ -2,6 +2,7 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,21 +18,15 @@ # ============LICENSE_END====================================================== [tox] -envlist = py27 -# The PGaaS plugin uses several Cloudify mock libraries, one of which -# is not compatible with Python3. -# Until we get an updated version of that Cloudify mock libraries, -# we will have to leave out py3X from the tox tests. -# We cannot use py37 yet because Jenkins returns: -# InterpreterNotFound: python3.7 -#envlist = py27,py36 +envlist = py27,py36,py37 +skip_missing_interpreters = true + [testenv] deps= pytest - cloudify==4.2 - requests coverage pytest-cov + -r requirements.txt setenv= PYTHONPATH={toxinidir} commands=pytest --junitxml xunit-results.xml --cov --cov-report=xml diff --git a/pom.xml b/pom.xml index e484d52..09c7c65 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ limitations under the License. org.onap.ccsdk.platform plugins ccsdk-platform-plugins - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT http://maven.apache.org pom diff --git a/sshkeyshare/pom.xml b/sshkeyshare/pom.xml index 759d57c..a852401 100644 --- a/sshkeyshare/pom.xml +++ b/sshkeyshare/pom.xml @@ -31,7 +31,7 @@ limitations under the License. sshkeyshare sshkeyshare - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT http://maven.apache.org diff --git a/sshkeyshare/requirements.txt b/sshkeyshare/requirements.txt index e69de29..833d57a 100644 --- a/sshkeyshare/requirements.txt +++ b/sshkeyshare/requirements.txt @@ -0,0 +1 @@ +cloudify-common>=5.0.5 diff --git a/sshkeyshare/setup.py b/sshkeyshare/setup.py index 56371ff..d8ee3db 100644 --- a/sshkeyshare/setup.py +++ b/sshkeyshare/setup.py @@ -2,13 +2,14 @@ # org.onap.ccsdk # ============================================================================= # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,7 +22,7 @@ from setuptools import setup, find_packages setup( name='sshkeyshare', - version='1.0.0', + version='1.1.0', packages=find_packages(), author='AT&T', description=('Cloudify plugin for creating ssh keypairs on the fly.'), @@ -31,5 +32,6 @@ setup( zip_safe=False, package_data={'':['LICENSE.txt']}, install_requires=[ - ] + 'cloudify-common>=5.0.5', + ], ) diff --git a/sshkeyshare/sshkey_types.yaml b/sshkeyshare/sshkey_types.yaml index c8e8b06..1e456d5 100644 --- a/sshkeyshare/sshkey_types.yaml +++ b/sshkeyshare/sshkey_types.yaml @@ -6,7 +6,7 @@ plugins: ssh_keyshare: executor: central_deployment_agent package_name: sshkeyshare - package_version: 1.0.0 + package_version: 1.1.0 node_types: ccsdk.nodes.ssh.keypair: derived_from: cloudify.nodes.Root diff --git a/sshkeyshare/tox.ini b/sshkeyshare/tox.ini index e2aff1e..f49fe9f 100644 --- a/sshkeyshare/tox.ini +++ b/sshkeyshare/tox.ini @@ -1,6 +1,7 @@ # ============LICENSE_START==================================================== # ============================================================================= # Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2020 Pantheon.tech. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,15 +17,15 @@ # ============LICENSE_END====================================================== [tox] -envlist = py27 +envlist = py27,py36,py37 skip_missing_interpreters = true [testenv] deps= - cloudify==3.4 pytest coverage pytest-cov + -r requirements.txt setenv= PYTHONPATH={toxinidir} commands= -- cgit 1.2.3-korg