diff options
Diffstat (limited to 'pgaas')
-rw-r--r-- | pgaas/pgaas/pgaas_plugin.py | 54 | ||||
-rw-r--r-- | pgaas/pgaas_types.yaml | 2 | ||||
-rw-r--r-- | pgaas/pom.xml | 4 | ||||
-rw-r--r-- | pgaas/requirements.txt | 2 | ||||
-rw-r--r-- | pgaas/setup.py | 11 | ||||
-rw-r--r-- | pgaas/tox.ini | 15 |
6 files changed, 41 insertions, 47 deletions
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. <parent> <groupId>org.onap.ccsdk.platform</groupId> <artifactId>plugins</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> </parent> <!--- CHANGE THE FOLLOWING 3 OBJECTS for your own repo --> @@ -31,7 +31,7 @@ limitations under the License. <artifactId>pgaas</artifactId> <name>pgaas</name> - <version>1.0.1-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> <url>http://maven.apache.org</url> <properties> <!-- name from the setup.py file --> 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 |