From 5d946ad2e5cf46391dd65cc8b06eafa270e645cb Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 13 Mar 2024 15:14:02 +0100 Subject: [PATCH 1/5] removed 'requests_get' and 'requests_post' from lib functions --- client/ayon_core/lib/__init__.py | 9 ------- client/ayon_core/lib/connections.py | 38 ----------------------------- 2 files changed, 47 deletions(-) delete mode 100644 client/ayon_core/lib/connections.py diff --git a/client/ayon_core/lib/__init__.py b/client/ayon_core/lib/__init__.py index ab6a604adc..acd960d9b5 100644 --- a/client/ayon_core/lib/__init__.py +++ b/client/ayon_core/lib/__init__.py @@ -161,12 +161,6 @@ from .ayon_info import ( is_in_tests, ) - -from .connections import ( - requests_get, - requests_post -) - terminal = Terminal __all__ = [ @@ -283,7 +277,4 @@ __all__ = [ "is_staging_enabled", "is_dev_mode_enabled", "is_in_tests", - - "requests_get", - "requests_post" ] diff --git a/client/ayon_core/lib/connections.py b/client/ayon_core/lib/connections.py deleted file mode 100644 index 6a0cf4ae1c..0000000000 --- a/client/ayon_core/lib/connections.py +++ /dev/null @@ -1,38 +0,0 @@ -import requests -import os - - -def requests_post(*args, **kwargs): - """Wrap request post method. - - Disabling SSL certificate validation if ``DONT_VERIFY_SSL`` environment - variable is found. This is useful when Deadline server is - running with self-signed certificates and its certificate is not - added to trusted certificates on client machines. - - Warning: - Disabling SSL certificate validation is defeating one line - of defense SSL is providing, and it is not recommended. - - """ - if "verify" not in kwargs: - kwargs["verify"] = not os.getenv("OPENPYPE_DONT_VERIFY_SSL", True) - return requests.post(*args, **kwargs) - - -def requests_get(*args, **kwargs): - """Wrap request get method. - - Disabling SSL certificate validation if ``DONT_VERIFY_SSL`` environment - variable is found. This is useful when Deadline server is - running with self-signed certificates and its certificate is not - added to trusted certificates on client machines. - - Warning: - Disabling SSL certificate validation is defeating one line - of defense SSL is providing, and it is not recommended. - - """ - if "verify" not in kwargs: - kwargs["verify"] = not os.getenv("OPENPYPE_DONT_VERIFY_SSL", True) - return requests.get(*args, **kwargs) From 72d4cdd629498885a78742dce8f82cae53487e57 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 13 Mar 2024 15:14:14 +0100 Subject: [PATCH 2/5] remove it's usage from deadline addon --- client/ayon_core/modules/deadline/deadline_module.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/modules/deadline/deadline_module.py b/client/ayon_core/modules/deadline/deadline_module.py index 97d346c287..d2f0e263d4 100644 --- a/client/ayon_core/modules/deadline/deadline_module.py +++ b/client/ayon_core/modules/deadline/deadline_module.py @@ -1,9 +1,10 @@ import os -import requests -import six import sys -from ayon_core.lib import requests_get, Logger +import requests +import six + +from ayon_core.lib import Logger from ayon_core.modules import AYONAddon, IPluginPaths @@ -56,6 +57,8 @@ class DeadlineModule(AYONAddon, IPluginPaths): RuntimeError: If deadline webservice is unreachable. """ + from .abstract_submit_deadline import requests_get + if not log: log = Logger.get_logger(__name__) From 85a022276f4d06867c6415393fd62603a813339d Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 13 Mar 2024 15:14:22 +0100 Subject: [PATCH 3/5] added todo comment --- client/ayon_core/modules/deadline/abstract_submit_deadline.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/ayon_core/modules/deadline/abstract_submit_deadline.py b/client/ayon_core/modules/deadline/abstract_submit_deadline.py index b2da4d1398..2e0518ae20 100644 --- a/client/ayon_core/modules/deadline/abstract_submit_deadline.py +++ b/client/ayon_core/modules/deadline/abstract_submit_deadline.py @@ -29,6 +29,10 @@ from ayon_core.pipeline.publish.lib import ( JSONDecodeError = getattr(json.decoder, "JSONDecodeError", ValueError) +# TODO both 'requests_post' and 'requests_get' should not set 'verify' based +# on environment variable. This should be done in a more controlled way, +# e.g. each deadline url could have checkbox to enabled/disable +# ssl verification. def requests_post(*args, **kwargs): """Wrap request post method. From 4944f956700704d2ac969fd40a3a9521d5815fcd Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 14 Mar 2024 19:23:49 +0800 Subject: [PATCH 4/5] check if there is the name endswith 'Main' in the renderlayer --- .../ayon_core/hosts/maya/plugins/publish/collect_inputs.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/ayon_core/hosts/maya/plugins/publish/collect_inputs.py b/client/ayon_core/hosts/maya/plugins/publish/collect_inputs.py index d0b1029a03..6dff64681f 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/collect_inputs.py +++ b/client/ayon_core/hosts/maya/plugins/publish/collect_inputs.py @@ -180,6 +180,11 @@ class CollectUpstreamInputs(pyblish.api.InstancePlugin): return copy.deepcopy(scene_containers) else: # Get the members of the layer + renderlayer = next((i for i in cmds.ls(type='renderLayer') + if i.endswith(renderlayer)), None) + if renderlayer is None: + return copy.deepcopy(scene_containers) + members = cmds.editRenderLayerMembers(renderlayer, query=True, fullNames=True) or [] From eb981d83c2a2df8a537ea29479c0439a700b5076 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 14 Mar 2024 19:49:51 +0800 Subject: [PATCH 5/5] use setMembers instead of renderlayer --- .../ayon_core/hosts/maya/plugins/publish/collect_inputs.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/client/ayon_core/hosts/maya/plugins/publish/collect_inputs.py b/client/ayon_core/hosts/maya/plugins/publish/collect_inputs.py index 6dff64681f..d084804e05 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/collect_inputs.py +++ b/client/ayon_core/hosts/maya/plugins/publish/collect_inputs.py @@ -172,7 +172,7 @@ class CollectUpstreamInputs(pyblish.api.InstancePlugin): """Collects inputs from nodes in renderlayer, incl. shaders + camera""" # Get the renderlayer - renderlayer = instance.data.get("renderlayer") + renderlayer = instance.data.get("setMembers") if renderlayer == "defaultRenderLayer": # Assume all loaded containers in the scene are inputs @@ -180,11 +180,6 @@ class CollectUpstreamInputs(pyblish.api.InstancePlugin): return copy.deepcopy(scene_containers) else: # Get the members of the layer - renderlayer = next((i for i in cmds.ls(type='renderLayer') - if i.endswith(renderlayer)), None) - if renderlayer is None: - return copy.deepcopy(scene_containers) - members = cmds.editRenderLayerMembers(renderlayer, query=True, fullNames=True) or []