From b3fbb3a67e7f78648dff1ff335b9b3bffafd09a4 Mon Sep 17 00:00:00 2001 From: Ahmad Musa <53178237+ahmadiesa-abu@users.noreply.github.com> Date: Mon, 4 Dec 2023 10:56:05 +0200 Subject: [PATCH] skip-update-if-external (#264) * skip-update-if-external * add requirements --------- Co-authored-by: EarthmanT --- .gitignore | 5 + CHANGELOG.txt | 2 + Makefile | 13 ++ cloudify_vsphere/__version__.py | 2 +- constraints.txt | 8 - extra-packaging-instructions.sh | 4 - plugin.yaml | 2 +- plugin_1_4.yaml | 2 +- plugin_1_5.yaml | 2 +- python311.patch | 71 --------- requirements-3.6.in | 6 + requirements-3.6.txt | 244 ++++++++++++++++++++++++++++++ requirements.in | 7 + requirements.txt | 235 ++++++++++++++++++++++++++++ setup.py | 43 ++++-- tox.ini | 2 +- v2_plugin.yaml | 2 +- vsphere_server_plugin/server.py | 4 + vsphere_storage_plugin/storage.py | 5 + 19 files changed, 556 insertions(+), 103 deletions(-) create mode 100644 Makefile delete mode 100644 constraints.txt delete mode 100644 python311.patch create mode 100644 requirements-3.6.in create mode 100644 requirements-3.6.txt create mode 100644 requirements.in create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index ccbc2d28..9bcc1e8a 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,8 @@ cloudify_vsphere_plugin.egg-info/ *.vmdk *.qcow2 *.wgn + +fusion-agent +fusion-common +fusion-manager +cloudify-utilities-plugins-sdk diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f0068ad3..77da1a5d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,5 @@ +2.20.12: + - Skip update on external resources. 2.20.11: - adjust python 3.11 patch. 2.20.10: diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..1d095fb2 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +download: +ifeq (,$(wildcard ./fusion-agent)) + git clone https://${GH_USER}:${GITHUB_PASSWORD}@eos2git.cec.lab.emc.com/ISG-Edge/fusion-agent.git && cd './fusion-agent' && git checkout rel/magicp1-2.0.0 && cd .. +endif +ifeq (,$(wildcard ./fusion-common)) + git clone https://${GH_USER}:${GITHUB_PASSWORD}@eos2git.cec.lab.emc.com/ISG-Edge/fusion-common.git && cd './fusion-common' && git checkout rel/magicp1-2.0.0 && cd .. +endif +ifeq (,$(wildcard ./fusion-manager)) + git clone https://${GH_USER}:${GITHUB_PASSWORD}@eos2git.cec.lab.emc.com/ISG-Edge/fusion-manager.git && cd './fusion-manager' && git checkout rel/magicp1-2.0.0 && cd .. +endif +ifeq (,$(wildcard ./cloudify-utilities-plugins-sdk)) + git clone https://github.com/cloudify-incubator/cloudify-utilities-plugins-sdk.git && cd './cloudify-utilities-plugins-sdk' && git checkout fusion && cd .. +endif \ No newline at end of file diff --git a/cloudify_vsphere/__version__.py b/cloudify_vsphere/__version__.py index a71c6498..75cdd707 100644 --- a/cloudify_vsphere/__version__.py +++ b/cloudify_vsphere/__version__.py @@ -1 +1 @@ -version = '2.20.11' +version = '2.20.12' diff --git a/constraints.txt b/constraints.txt deleted file mode 100644 index a07439a1..00000000 --- a/constraints.txt +++ /dev/null @@ -1,8 +0,0 @@ -netaddr==0.7.19 -pyvmomi==6.7.3 -pyyaml>=6.0 -rsa==4.5 -cryptography==3.2.1 -decorator>=4.4.2 -urllib3===1.24.3 -smmap<3.0.5,>=3.0.1 \ No newline at end of file diff --git a/extra-packaging-instructions.sh b/extra-packaging-instructions.sh index 31067a93..e69de29b 100644 --- a/extra-packaging-instructions.sh +++ b/extra-packaging-instructions.sh @@ -1,4 +0,0 @@ -if [[ $PY311 == 1 ]] -then - git apply python311.patch -fi \ No newline at end of file diff --git a/plugin.yaml b/plugin.yaml index ed9df265..ccdc7d69 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -6,7 +6,7 @@ plugins: vsphere: executor: central_deployment_agent package_name: cloudify-vsphere-plugin - package_version: '2.20.11' + package_version: '2.20.12' data_types: diff --git a/plugin_1_4.yaml b/plugin_1_4.yaml index c7a19228..e8220768 100755 --- a/plugin_1_4.yaml +++ b/plugin_1_4.yaml @@ -6,7 +6,7 @@ plugins: vsphere: executor: central_deployment_agent package_name: cloudify-vsphere-plugin - package_version: '2.20.11' + package_version: '2.20.12' data_types: diff --git a/plugin_1_5.yaml b/plugin_1_5.yaml index c8a83349..4e6eee57 100644 --- a/plugin_1_5.yaml +++ b/plugin_1_5.yaml @@ -6,7 +6,7 @@ plugins: vsphere: executor: central_deployment_agent package_name: cloudify-vsphere-plugin - package_version: '2.20.11' + package_version: '2.20.12' properties_description: | Manage vSphere resources. properties: diff --git a/python311.patch b/python311.patch deleted file mode 100644 index b4acc978..00000000 --- a/python311.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff --git a/constraints.txt b/constraints.txt -index a07439a..ed5e78b 100644 ---- a/constraints.txt -+++ b/constraints.txt -@@ -1,8 +1,6 @@ --netaddr==0.7.19 - pyvmomi==6.7.3 - pyyaml>=6.0 - rsa==4.5 --cryptography==3.2.1 -+cryptography>=41.0.4 - decorator>=4.4.2 --urllib3===1.24.3 - smmap<3.0.5,>=3.0.1 -\ No newline at end of file -diff --git a/dev-requirements.txt b/dev-requirements.txt -index e69de29..9bf8b21 100644 ---- a/dev-requirements.txt -+++ b/dev-requirements.txt -@@ -0,0 +1,2 @@ -+-e fusion-common -+-e cloudify-utilities-plugins-sdk -diff --git a/setup.py b/setup.py -index 8deafd4..25a7527 100755 ---- a/setup.py -+++ b/setup.py -@@ -15,7 +15,7 @@ - import os - import re - import pathlib --from setuptools import setup -+from setuptools import setup, find_packages - - - def get_version(): -@@ -31,31 +31,15 @@ setup( - zip_safe=True, - name='cloudify-vsphere-plugin', - version=get_version(), -- packages=[ -- 'vsphere_plugin_common', -- 'vsphere_plugin_common.clients', -- 'vsphere_server_plugin', -- 'vsphere_network_plugin', -- 'vsphere_storage_plugin', -- 'cloudify_vsphere', -- 'cloudify_vsphere.cluster', -- 'cloudify_vsphere.contentlibrary', -- 'cloudify_vsphere.datacenter', -- 'cloudify_vsphere.datastore', -- 'cloudify_vsphere.devices', -- 'cloudify_vsphere.hypervisor_host', -- 'cloudify_vsphere.resource_pool', -- 'cloudify_vsphere.vm_folder', -- 'cloudify_vsphere.ovf', -- ], -+ packages=find_packages(), - license='LICENSE', - description='Cloudify plugin for vSphere infrastructure.', - install_requires=[ -- "cloudify-common>=4.5", -+ "fusion-common", - "pyvmomi>=6.7.3,<8.0.0", - "netaddr>=0.7.19", -- "cloudify-utilities-plugins-sdk>=0.0.61", -+ "cloudify-utilities-plugins-sdk>=0.0.129", - "requests", -- 'deepdiff==3.3.0' -+ 'deepdiff==5.7.0' - ] - ) diff --git a/requirements-3.6.in b/requirements-3.6.in new file mode 100644 index 00000000..2603a9b0 --- /dev/null +++ b/requirements-3.6.in @@ -0,0 +1,6 @@ +netaddr==0.7.19 +pyvmomi==6.7.3 +pyyaml>=6.0 +rsa==4.5 +cryptography==40.0.2 +smmap<3.0.5,>=3.0.1 diff --git a/requirements-3.6.txt b/requirements-3.6.txt new file mode 100644 index 00000000..a0d928ac --- /dev/null +++ b/requirements-3.6.txt @@ -0,0 +1,244 @@ +# +# This file is autogenerated by pip-compile with python 3.6 +# To update, run: +# +# pip-compile --no-emit-index-url --output-file=requirements-3.6.txt requirements-3.6.in setup.py +# +adal==1.2.7 + # via msrestazure +aiohttp==3.7.4.post0 + # via cloudify-common +async-timeout==3.0.1 + # via aiohttp +attrs==22.2.0 + # via aiohttp +azure-common==1.1.28 + # via azure-mgmt-containerservice +azure-core==1.24.2 + # via + # azure-identity + # azure-mgmt-core + # msrest +azure-identity==1.10.0 + # via cloudify-utilities-plugins-sdk +azure-mgmt-containerservice==17.0.0 + # via cloudify-utilities-plugins-sdk +azure-mgmt-core==1.3.2 + # via azure-mgmt-containerservice +bcrypt==4.0.1 + # via paramiko +boto3==1.23.10 + # via cloudify-utilities-plugins-sdk +botocore==1.26.10 + # via + # boto3 + # s3transfer +bottle==0.12.19 + # via cloudify-common +cachetools==4.2.4 + # via google-auth +certifi==2023.11.17 + # via + # kubernetes + # msrest + # requests +cffi==1.15.1 + # via + # cryptography + # pynacl +chardet==4.0.0 + # via aiohttp +charset-normalizer==2.0.12 + # via requests +cloudify-common==6.4.2.0 + # via + # cloudify-utilities-plugins-sdk + # cloudify-vsphere-plugin (setup.py) +cloudify-utilities-plugins-sdk==0.0.130 + # via cloudify-vsphere-plugin (setup.py) +cryptography==40.0.2 + # via + # -r requirements-3.6.in + # adal + # azure-identity + # msal + # paramiko + # pyjwt +deepdiff==3.3.0 + # via cloudify-vsphere-plugin (setup.py) +fasteners==0.17.3 + # via cloudify-common +gitdb==4.0.8 + # via + # cloudify-utilities-plugins-sdk + # gitpython +gitpython==3.1.18 + # via cloudify-utilities-plugins-sdk +google-auth==2.15.0 + # via + # cloudify-utilities-plugins-sdk + # kubernetes +idna==3.6 + # via + # idna-ssl + # requests + # yarl +idna-ssl==1.1.0 + # via aiohttp +importlib-metadata==4.8.3 + # via jsonpickle +isodate==0.6.1 + # via msrest +jinja2==2.11.3 + # via + # cloudify-common + # cloudify-utilities-plugins-sdk +jmespath==0.10.0 + # via + # boto3 + # botocore +jsonpickle==2.2.0 + # via deepdiff +kubernetes==v26.1.0 + # via cloudify-utilities-plugins-sdk +markupsafe==2.0.1 + # via jinja2 +msal==1.25.0 + # via + # azure-identity + # msal-extensions +msal-extensions==1.0.0 + # via azure-identity +msrest==0.7.1 + # via + # azure-mgmt-containerservice + # msrestazure +msrestazure==0.6.4 + # via cloudify-utilities-plugins-sdk +multidict==5.2.0 + # via + # aiohttp + # yarl +netaddr==0.7.19 + # via + # -r requirements-3.6.in + # cloudify-vsphere-plugin (setup.py) +oauthlib==3.2.2 + # via requests-oauthlib +packaging==21.3 + # via cloudify-utilities-plugins-sdk +paramiko==3.3.1 + # via cloudify-utilities-plugins-sdk +pika==1.1.0 + # via cloudify-common +pkginfo==1.9.6 + # via wagon +portalocker==2.7.0 + # via msal-extensions +proxy_tools==0.1.0 + # via cloudify-common +psutil==5.9.6 + # via cloudify-utilities-plugins-sdk +pyasn1==0.5.1 + # via + # pyasn1-modules + # rsa +pyasn1-modules==0.3.0 + # via google-auth +pycdlib==1.14.0 + # via cloudify-utilities-plugins-sdk +pycparser==2.21 + # via cffi +pyjwt[crypto]==2.4.0 + # via + # adal + # msal +pynacl==1.5.0 + # via paramiko +pyparsing==3.0.7 + # via packaging +python-dateutil==2.8.2 + # via + # adal + # botocore + # kubernetes +pytz==2021.3 + # via cloudify-common +pyvmomi==6.7.3 + # via + # -r requirements-3.6.in + # cloudify-vsphere-plugin (setup.py) +pyyaml==6.0.1 + # via + # -r requirements-3.6.in + # cloudify-utilities-plugins-sdk + # kubernetes +requests==2.27.1 + # via + # adal + # azure-core + # cloudify-common + # cloudify-utilities-plugins-sdk + # cloudify-vsphere-plugin (setup.py) + # kubernetes + # msal + # msrest + # pyvmomi + # requests-oauthlib + # requests-toolbelt +requests-oauthlib==1.3.1 + # via + # kubernetes + # msrest +requests_toolbelt==0.9.1 + # via cloudify-common +retrying==1.3.3 + # via cloudify-common +rsa==4.5 + # via + # -r requirements-3.6.in + # google-auth +s3transfer==0.5.2 + # via boto3 +six==1.16.0 + # via + # azure-core + # azure-identity + # google-auth + # isodate + # kubernetes + # msrestazure + # python-dateutil + # pyvmomi + # retrying +smmap==3.0.4 + # via + # -r requirements-3.6.in + # gitdb +typing-extensions==4.1.1 + # via + # aiohttp + # azure-core + # gitpython + # importlib-metadata + # yarl +urllib3==1.26.18 + # via + # botocore + # kubernetes + # requests +wagon==1.0.1 + # via cloudify-common +websocket-client==1.3.1 + # via kubernetes +wheel==0.37.1 + # via wagon +xmltodict==0.13.0 + # via cloudify-utilities-plugins-sdk +yarl==1.7.2 + # via aiohttp +zipp==3.6.0 + # via importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/requirements.in b/requirements.in new file mode 100644 index 00000000..2878770a --- /dev/null +++ b/requirements.in @@ -0,0 +1,7 @@ +pyvmomi==6.7.3 +pyyaml>=6.0 +rsa==4.5 +cryptography>=41.0.4 +smmap<3.0.5,>=3.0.1 +-e fusion-common +-e cloudify-utilities-plugins-sdk diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..df0f60be --- /dev/null +++ b/requirements.txt @@ -0,0 +1,235 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --no-emit-index-url --output-file=requirements.txt requirements.in setup.py +# +-e cloudify-utilities-plugins-sdk + # via + # -r requirements.in + # cloudify-vsphere-plugin (setup.py) +-e fusion-common + # via + # -r requirements.in + # cloudify-utilities-plugins-sdk + # cloudify-vsphere-plugin (setup.py) +adal==1.2.7 + # via msrestazure +aiohttp==3.9.1 + # via fusion-common +aiosignal==1.3.1 + # via aiohttp +attrs==23.1.0 + # via aiohttp +azure-common==1.1.28 + # via azure-mgmt-containerservice +azure-core==1.29.5 + # via + # azure-identity + # azure-mgmt-core + # msrest +azure-identity==1.15.0 + # via cloudify-utilities-plugins-sdk +azure-mgmt-containerservice==17.0.0 + # via cloudify-utilities-plugins-sdk +azure-mgmt-core==1.4.0 + # via azure-mgmt-containerservice +bcrypt==4.1.1 + # via paramiko +boto3==1.33.6 + # via cloudify-utilities-plugins-sdk +botocore==1.33.6 + # via + # boto3 + # s3transfer +bottle==0.12.25 + # via fusion-common +cachetools==5.3.2 + # via google-auth +certifi==2023.11.17 + # via + # kubernetes + # msrest + # requests +cffi==1.16.0 + # via + # cryptography + # pynacl +charset-normalizer==3.3.2 + # via requests +cryptography==41.0.7 + # via + # -r requirements.in + # adal + # azure-identity + # msal + # paramiko + # pyjwt +deepdiff==5.7.0 + # via cloudify-vsphere-plugin (setup.py) +distro==1.8.0 + # via fusion-common +fasteners==0.19 + # via fusion-common +frozenlist==1.4.0 + # via + # aiohttp + # aiosignal +gitdb==4.0.11 + # via + # cloudify-utilities-plugins-sdk + # gitpython +gitpython==3.1.40 + # via cloudify-utilities-plugins-sdk +google-auth==2.15.0 + # via + # cloudify-utilities-plugins-sdk + # kubernetes +idna==3.6 + # via + # requests + # yarl +isodate==0.6.1 + # via msrest +jinja2==3.1.2 + # via + # cloudify-utilities-plugins-sdk + # fusion-common +jmespath==1.0.1 + # via + # boto3 + # botocore +kubernetes==26.1.0 + # via cloudify-utilities-plugins-sdk +markupsafe==2.1.3 + # via jinja2 +msal==1.25.0 + # via + # azure-identity + # msal-extensions +msal-extensions==1.0.0 + # via azure-identity +msrest==0.7.1 + # via + # azure-mgmt-containerservice + # msrestazure +msrestazure==0.6.4 + # via cloudify-utilities-plugins-sdk +multidict==6.0.4 + # via + # aiohttp + # yarl +netaddr==0.9.0 + # via cloudify-vsphere-plugin (setup.py) +oauthlib==3.2.2 + # via requests-oauthlib +ordered-set==4.0.2 + # via deepdiff +packaging==21.3 + # via cloudify-utilities-plugins-sdk +paramiko==3.3.1 + # via cloudify-utilities-plugins-sdk +pika==1.3.2 + # via fusion-common +pkginfo==1.9.6 + # via wagon +portalocker==2.8.2 + # via msal-extensions +proxy-tools==0.1.0 + # via fusion-common +psutil==5.9.6 + # via cloudify-utilities-plugins-sdk +pyasn1==0.5.1 + # via + # pyasn1-modules + # rsa +pyasn1-modules==0.3.0 + # via google-auth +pycdlib==1.14.0 + # via cloudify-utilities-plugins-sdk +pycparser==2.21 + # via cffi +pyjwt[crypto]==2.8.0 + # via + # adal + # msal +pynacl==1.5.0 + # via paramiko +pyparsing==3.1.1 + # via packaging +python-dateutil==2.8.2 + # via + # adal + # botocore + # kubernetes +pytz==2023.3.post1 + # via fusion-common +pyvmomi==6.7.3 + # via + # -r requirements.in + # cloudify-vsphere-plugin (setup.py) +pyyaml==6.0.1 + # via + # -r requirements.in + # cloudify-utilities-plugins-sdk + # kubernetes +requests==2.31.0 + # via + # adal + # azure-core + # cloudify-utilities-plugins-sdk + # cloudify-vsphere-plugin (setup.py) + # fusion-common + # kubernetes + # msal + # msrest + # pyvmomi + # requests-oauthlib + # requests-toolbelt +requests-oauthlib==1.3.1 + # via + # kubernetes + # msrest +requests-toolbelt==1.0.0 + # via + # cloudify-utilities-plugins-sdk + # fusion-common +rsa==4.5 + # via + # -r requirements.in + # google-auth +s3transfer==0.8.2 + # via boto3 +six==1.16.0 + # via + # azure-core + # google-auth + # isodate + # kubernetes + # msrestazure + # python-dateutil + # pyvmomi +smmap==3.0.4 + # via + # -r requirements.in + # gitdb +typing-extensions==4.8.0 + # via azure-core +urllib3==2.0.7 + # via + # botocore + # kubernetes + # requests +wagon==1.0.1 + # via fusion-common +websocket-client==1.7.0 + # via kubernetes +wheel==0.42.0 + # via wagon +xmltodict==0.13.0 + # via cloudify-utilities-plugins-sdk +yarl==1.9.3 + # via aiohttp + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/setup.py b/setup.py index 8deafd48..4338d641 100755 --- a/setup.py +++ b/setup.py @@ -14,8 +14,9 @@ import os import re +import sys import pathlib -from setuptools import setup +from setuptools import setup, find_packages def get_version(): @@ -27,10 +28,14 @@ def get_version(): return re.search(r'\d+.\d+.\d+', var).group() -setup( - zip_safe=True, - name='cloudify-vsphere-plugin', - version=get_version(), +install_requires = [ + 'pyvmomi>=6.7.3,<8.0.0', + 'netaddr>=0.7.19', + 'cloudify-utilities-plugins-sdk', + 'requests', +] + +if sys.version_info.major == 3 and sys.version_info.minor == 6: packages=[ 'vsphere_plugin_common', 'vsphere_plugin_common.clients', @@ -47,15 +52,25 @@ def get_version(): 'cloudify_vsphere.resource_pool', 'cloudify_vsphere.vm_folder', 'cloudify_vsphere.ovf', - ], + ] + install_requires += [ + 'cloudify-common>=4.5,<7.0', + 'deepdiff==3.3.0', + ] +else: + packages = find_packages() + install_requires += [ + 'fusion-common', + 'deepdiff==5.7.0', + ] + + +setup( + zip_safe=True, + name='cloudify-vsphere-plugin', + version=get_version(), + packages=packages, license='LICENSE', description='Cloudify plugin for vSphere infrastructure.', - install_requires=[ - "cloudify-common>=4.5", - "pyvmomi>=6.7.3,<8.0.0", - "netaddr>=0.7.19", - "cloudify-utilities-plugins-sdk>=0.0.61", - "requests", - 'deepdiff==3.3.0' - ] + install_requires=install_requires ) diff --git a/tox.ini b/tox.ini index 27c5641a..368e9a62 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,7 @@ setenv = usedevelop = True install_command = pip install -U {opts} {packages} -deps = -r{toxinidir}/dev-requirements.txt +deps = -r{toxinidir}/requirements-3.6.txt -r{toxinidir}/test-requirements.txt whitelist_externals = bash diff --git a/v2_plugin.yaml b/v2_plugin.yaml index af635bcf..ab98faef 100755 --- a/v2_plugin.yaml +++ b/v2_plugin.yaml @@ -10,7 +10,7 @@ plugins: vsphere: executor: central_deployment_agent package_name: cloudify-vsphere-plugin - package_version: '2.20.11' + package_version: '2.20.12' data_types: diff --git a/vsphere_server_plugin/server.py b/vsphere_server_plugin/server.py index 41135ec2..6728f9f2 100644 --- a/vsphere_server_plugin/server.py +++ b/vsphere_server_plugin/server.py @@ -1102,6 +1102,10 @@ def check_drift(server_client, **_): resource_name=server_obj.name)) ctx.instance.refresh() + # if external we want to mark it as no drift , so we won't trigger upate + if ctx.node.properties.get('use_external_resource', False): + return False + expected_configuration = ctx.instance.runtime_properties.get( 'expected_configuration') current_configuration = {} diff --git a/vsphere_storage_plugin/storage.py b/vsphere_storage_plugin/storage.py index 38ed5034..d6aec14b 100644 --- a/vsphere_storage_plugin/storage.py +++ b/vsphere_storage_plugin/storage.py @@ -223,6 +223,11 @@ def check_drift(storage_client, **_): ctx.logger.info( 'Checking drift state for {resource_name}.'.format( resource_name=resource_name)) + + # if external we want to mark it as no drift , so we won't trigger upate + if ctx.node.properties.get('use_external_resource', False): + return False + # get new storage_size from update storage_size = ctx.node.properties['storage'].get('storage_size') current_size = ctx.instance.runtime_properties.get(VSPHERE_STORAGE_SIZE)