summaryrefslogtreecommitdiffstats
path: root/helm
diff options
context:
space:
mode:
authorMiroslav Los <miroslav.los@pantheon.tech>2019-11-14 17:36:44 +0100
committerMiroslav Los <miroslav.los@pantheon.tech>2020-02-14 17:34:04 +0100
commit9b7e81e78c70514aa123482610e274869b6ba137 (patch)
treee2e44b515d518825db9240a5e4a8fe2efe0b3126 /helm
parent4daa9d9a30306cfa6d25999cdc992d886fa405a8 (diff)
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 <miroslav.los@pantheon.tech> Issue-ID: CCSDK-1931 Change-Id: I607957d9e2c299121785f3f02420c6038966a200
Diffstat (limited to 'helm')
-rw-r--r--helm/dev-requirements.txt6
-rw-r--r--helm/helm-type.yaml2
-rw-r--r--helm/plugin/tasks.py28
-rw-r--r--helm/plugin/workflows.py2
-rw-r--r--helm/pom.xml4
-rw-r--r--helm/requirements.txt17
-rw-r--r--helm/setup.py13
-rw-r--r--helm/tox.ini46
8 files changed, 86 insertions, 32 deletions
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.
<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>helm</artifactId>
<name>helm</name>
- <version>1.0.1-SNAPSHOT</version>
+ <version>4.1.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<properties>
<!-- name from the setup.py file -->
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