From b5570bd202463ca669cf56cdabd774cf1a5c3585 Mon Sep 17 00:00:00 2001 From: Ahmad Musa Date: Thu, 14 Sep 2023 11:53:16 +0300 Subject: [PATCH] RND-1274-Fix-Py311-Compat --- CHANGELOG.txt | 1 + fabric_plugin/__version__.py | 2 +- fabric_plugin/_compat.py | 1 + fabric_plugin/tasks.py | 12 +++++++++++- plugin.yaml | 2 +- plugin_1_4.yaml | 12 ++++++------ v2_plugin.yaml | 10 +++++----- 7 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1d8d827..e765dc2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,4 @@ +2.0.21: fix tasks to be compatible with py311. 2.0.20: Added Py311 wagon. 2.0.19: Fix issue that prevented user provided SSH port from being used. 2.0.18: add __version__.py file in fabric_plugin folder. diff --git a/fabric_plugin/__version__.py b/fabric_plugin/__version__.py index 4972227..098cf62 100644 --- a/fabric_plugin/__version__.py +++ b/fabric_plugin/__version__.py @@ -1 +1 @@ -version = '2.0.20' +version = '2.0.21' diff --git a/fabric_plugin/_compat.py b/fabric_plugin/_compat.py index df416bd..fd1004e 100644 --- a/fabric_plugin/_compat.py +++ b/fabric_plugin/_compat.py @@ -18,6 +18,7 @@ import sys PY2 = sys.version_info[0] == 2 +PY311 = sys.version_info[0] == 3 and sys.version_info[1] == 11 if PY2: diff --git a/fabric_plugin/tasks.py b/fabric_plugin/tasks.py index 461c636..155b91b 100644 --- a/fabric_plugin/tasks.py +++ b/fabric_plugin/tasks.py @@ -57,10 +57,20 @@ from cloudify.utils import CFY_EXEC_TEMPDIR_ENVVAR as ENV_CFY_EXEC_TEMPDIR from fabric_plugin import exec_env -from fabric_plugin._compat import exec_, StringIO +from fabric_plugin._compat import exec_, StringIO, PY311 from cloudify.proxy.client import ScriptException +# fix inspect compatiblity +import inspect +try: + # in python 3.11 getargspec was removed in favor of getfullargspec + if PY311: + from inspect import getfullargspec + inspect.getargspec = getfullargspec +except ImportError: + pass + ILLEGAL_CTX_OPERATION_ERROR = RuntimeError('ctx may only abort or return once') DEFAULT_BASE_SUBDIR = 'cloudify-ctx' diff --git a/plugin.yaml b/plugin.yaml index 6153943..da07617 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -5,4 +5,4 @@ plugins: fabric: executor: central_deployment_agent package_name: cloudify-fabric-plugin - package_version: '2.0.20' + package_version: '2.0.21' diff --git a/plugin_1_4.yaml b/plugin_1_4.yaml index a03d49e..891bb31 100644 --- a/plugin_1_4.yaml +++ b/plugin_1_4.yaml @@ -1,18 +1,18 @@ ################################################################################## -# Cloudify Fabric built in types and plugins definitions. +# Cloudify Fabric built in types and plugins definitions. ################################################################################## plugins: fabric: executor: central_deployment_agent package_name: cloudify-fabric-plugin - package_version: '2.0.20' + package_version: '2.0.21' blueprint_labels: - obj-type: - values: + obj-type: + values: - fabric labels: - obj-type: - values: + obj-type: + values: - fabric diff --git a/v2_plugin.yaml b/v2_plugin.yaml index cc9a32a..891bb31 100644 --- a/v2_plugin.yaml +++ b/v2_plugin.yaml @@ -5,14 +5,14 @@ plugins: fabric: executor: central_deployment_agent package_name: cloudify-fabric-plugin - package_version: '2.0.20' + package_version: '2.0.21' blueprint_labels: - obj-type: - values: + obj-type: + values: - fabric labels: - obj-type: - values: + obj-type: + values: - fabric