From 9d3b8345cd2940c12a4e2b8c91a6ec7a211a7d81 Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Tue, 20 Aug 2024 23:14:22 +0530 Subject: [PATCH 01/13] turning off logger for SdkApi Signed-off-by: aadityasinha-dotcom --- src/core/zowe/core_for_zowe_sdk/sdk_api.py | 5 ++++- src/zos_console/zowe/zos_console_for_zowe_sdk/console.py | 2 +- src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py | 2 +- src/zos_files/zowe/zos_files_for_zowe_sdk/files.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/zowe/core_for_zowe_sdk/sdk_api.py b/src/core/zowe/core_for_zowe_sdk/sdk_api.py index 31494889..1e0ff001 100644 --- a/src/core/zowe/core_for_zowe_sdk/sdk_api.py +++ b/src/core/zowe/core_for_zowe_sdk/sdk_api.py @@ -33,12 +33,15 @@ class SdkApi: Name of the logger (same as the filename by default) """ - def __init__(self, profile: dict, default_url: str, logger_name: str = __name__): + def __init__(self, profile: dict, default_url: str, logger_name: str = __name__, log = False): session = Session(profile) self.session: ISession = session.load() self.logger = Log.register_logger(logger_name) + if log == False: + Log.close(logger) + self._default_service_url = default_url self._default_headers = { "Content-Type": "application/json", diff --git a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py index a7fdfb38..369e3e04 100644 --- a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py +++ b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py @@ -27,7 +27,7 @@ class Console(SdkApi): A profile in dict (json) format """ - def __init__(self, connection: dict): + def __init__(self, connection: dict, log = False): super().__init__(connection, "/zosmf/restconsoles/consoles/defcn", logger_name=__name__) def issue_command(self, command: str, console: Optional[str] = None) -> IssueCommandResponse: diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py index 6e2d120b..1a05d208 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py @@ -303,7 +303,7 @@ class Datasets(SdkApi): A profile for connection in dict (json) format """ - def __init__(self, connection: dict): + def __init__(self, connection: dict, log = False): super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__) self._default_headers["Accept-Encoding"] = "gzip" diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py index d0713d5d..797379b8 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py @@ -45,7 +45,7 @@ class Files(SdkApi): uss: USSFiles fs: FileSystems - def __init__(self, connection: dict): + def __init__(self, connection: dict, log = False): super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__) self._default_headers["Accept-Encoding"] = "gzip" self.ds = Datasets(connection) From 9571c8c48be83019202b6fc29114f425a4248393 Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Wed, 21 Aug 2024 22:38:02 +0530 Subject: [PATCH 02/13] fix test failing Signed-off-by: aadityasinha-dotcom --- src/core/zowe/core_for_zowe_sdk/sdk_api.py | 2 +- src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py | 2 +- src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py | 2 +- src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py | 2 +- src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/zowe/core_for_zowe_sdk/sdk_api.py b/src/core/zowe/core_for_zowe_sdk/sdk_api.py index 1e0ff001..9b761370 100644 --- a/src/core/zowe/core_for_zowe_sdk/sdk_api.py +++ b/src/core/zowe/core_for_zowe_sdk/sdk_api.py @@ -40,7 +40,7 @@ def __init__(self, profile: dict, default_url: str, logger_name: str = __name__, self.logger = Log.register_logger(logger_name) if log == False: - Log.close(logger) + Log.close(self.logger) self._default_service_url = default_url self._default_headers = { diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py index e694e807..101a8ba1 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py @@ -34,7 +34,7 @@ class USSFiles(SdkApi): The z/OSMF connection object (generated by the ZoweSDK object) """ - def __init__(self, connection: dict): + def __init__(self, connection: dict, log = False): super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__) self._default_headers["Accept-Encoding"] = "gzip" diff --git a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py index 65659d9e..95aad52b 100644 --- a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py +++ b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py @@ -30,7 +30,7 @@ class Jobs(SdkApi): A profile for connection in dict (json) format """ - def __init__(self, connection: dict): + def __init__(self, connection: dict, log = False): super().__init__(connection, "/zosmf/restjobs/jobs/", logger_name=__name__) def get_job_status(self, jobname: str, jobid: str) -> JobResponse: diff --git a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py index f67f7c15..9b2937bf 100644 --- a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py +++ b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py @@ -30,7 +30,7 @@ class Tso(SdkApi): Profile used for tso connection """ - def __init__(self, connection: dict, tso_profile: Optional[dict] = None): + def __init__(self, connection: dict, tso_profile: Optional[dict] = None, log = False): super().__init__(connection, "/zosmf/tsoApp/tso", logger_name=__name__) self.session_not_found = constants["TsoSessionNotFound"] self.tso_profile = tso_profile or {} diff --git a/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py b/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py index 05691827..31386953 100644 --- a/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py +++ b/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py @@ -25,7 +25,7 @@ class Zosmf(SdkApi): The z/OSMF connection object (generated by the ZoweSDK object) """ - def __init__(self, connection: dict): + def __init__(self, connection: dict, log = False): super().__init__(connection, "/zosmf/info", logger_name=__name__) def get_info(self) -> ZosmfResponse: From 420388ec5fe81b0b536c32d91e26384ec2f667ee Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Sun, 25 Aug 2024 23:25:37 +0530 Subject: [PATCH 03/13] changes to the SdkApi classes Signed-off-by: aadityasinha-dotcom --- src/core/zowe/core_for_zowe_sdk/sdk_api.py | 2 +- src/zos_console/zowe/zos_console_for_zowe_sdk/console.py | 2 +- src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py | 4 ++-- src/zos_files/zowe/zos_files_for_zowe_sdk/files.py | 4 ++-- src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py | 4 ++-- src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py | 4 ++-- src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/zowe/core_for_zowe_sdk/sdk_api.py b/src/core/zowe/core_for_zowe_sdk/sdk_api.py index 9b761370..4fe8e0f2 100644 --- a/src/core/zowe/core_for_zowe_sdk/sdk_api.py +++ b/src/core/zowe/core_for_zowe_sdk/sdk_api.py @@ -33,7 +33,7 @@ class SdkApi: Name of the logger (same as the filename by default) """ - def __init__(self, profile: dict, default_url: str, logger_name: str = __name__, log = False): + def __init__(self, profile: dict, default_url: str, logger_name: str = __name__, log = True): session = Session(profile) self.session: ISession = session.load() diff --git a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py index 369e3e04..5f33dd1c 100644 --- a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py +++ b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py @@ -28,7 +28,7 @@ class Console(SdkApi): """ def __init__(self, connection: dict, log = False): - super().__init__(connection, "/zosmf/restconsoles/consoles/defcn", logger_name=__name__) + super().__init__(connection, "/zosmf/restconsoles/consoles/defcn", logger_name=__name__, log=log) def issue_command(self, command: str, console: Optional[str] = None) -> IssueCommandResponse: """Issues a command on z/OS Console. diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py index eb0bc99f..23d0f0e0 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py @@ -32,8 +32,8 @@ class FileSystems(SdkApi): A profile for connection in dict (json) format """ - def __init__(self, connection: dict): - super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__) + def __init__(self, connection: dict, log=True): + super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__, log=log) self._default_headers["Accept-Encoding"] = "gzip" def create(self, file_system_name: str, options: dict = {}) -> dict: diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py index 797379b8..cecf90aa 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py @@ -45,8 +45,8 @@ class Files(SdkApi): uss: USSFiles fs: FileSystems - def __init__(self, connection: dict, log = False): - super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__) + def __init__(self, connection: dict, log = True): + super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__, log=log) self._default_headers["Accept-Encoding"] = "gzip" self.ds = Datasets(connection) self.uss = USSFiles(connection) diff --git a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py index 95aad52b..7c818631 100644 --- a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py +++ b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py @@ -30,8 +30,8 @@ class Jobs(SdkApi): A profile for connection in dict (json) format """ - def __init__(self, connection: dict, log = False): - super().__init__(connection, "/zosmf/restjobs/jobs/", logger_name=__name__) + def __init__(self, connection: dict, log = True): + super().__init__(connection, "/zosmf/restjobs/jobs/", logger_name=__name__, log=log) def get_job_status(self, jobname: str, jobid: str) -> JobResponse: """ diff --git a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py index 9b2937bf..b7510893 100644 --- a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py +++ b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py @@ -30,8 +30,8 @@ class Tso(SdkApi): Profile used for tso connection """ - def __init__(self, connection: dict, tso_profile: Optional[dict] = None, log = False): - super().__init__(connection, "/zosmf/tsoApp/tso", logger_name=__name__) + def __init__(self, connection: dict, tso_profile: Optional[dict] = None, log = True): + super().__init__(connection, "/zosmf/tsoApp/tso", logger_name=__name__, log=log) self.session_not_found = constants["TsoSessionNotFound"] self.tso_profile = tso_profile or {} diff --git a/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py b/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py index 31386953..99fbedf0 100644 --- a/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py +++ b/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py @@ -25,8 +25,8 @@ class Zosmf(SdkApi): The z/OSMF connection object (generated by the ZoweSDK object) """ - def __init__(self, connection: dict, log = False): - super().__init__(connection, "/zosmf/info", logger_name=__name__) + def __init__(self, connection: dict, log = True): + super().__init__(connection, "/zosmf/info", logger_name=__name__, log=log) def get_info(self) -> ZosmfResponse: """ From c831f9cc746e415d0755c18729507c1d54b50e9d Mon Sep 17 00:00:00 2001 From: Aaditya Sinha <75474786+aadityasinha-dotcom@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:19:19 +0530 Subject: [PATCH 04/13] Update src/zos_console/zowe/zos_console_for_zowe_sdk/console.py Co-authored-by: Trae Yelovich Signed-off-by: Aaditya Sinha <75474786+aadityasinha-dotcom@users.noreply.github.com> --- src/zos_console/zowe/zos_console_for_zowe_sdk/console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py index 5f33dd1c..42ebe323 100644 --- a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py +++ b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py @@ -27,7 +27,7 @@ class Console(SdkApi): A profile in dict (json) format """ - def __init__(self, connection: dict, log = False): + def __init__(self, connection: dict, log = True): super().__init__(connection, "/zosmf/restconsoles/consoles/defcn", logger_name=__name__, log=log) def issue_command(self, command: str, console: Optional[str] = None) -> IssueCommandResponse: From 9ac8717ba1b9e2caf39780019be14e085e3dfe82 Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Tue, 27 Aug 2024 23:28:22 +0530 Subject: [PATCH 05/13] changes according to the reviews Signed-off-by: aadityasinha-dotcom --- src/zos_console/zowe/zos_console_for_zowe_sdk/console.py | 2 +- src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py index 5f33dd1c..42ebe323 100644 --- a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py +++ b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py @@ -27,7 +27,7 @@ class Console(SdkApi): A profile in dict (json) format """ - def __init__(self, connection: dict, log = False): + def __init__(self, connection: dict, log = True): super().__init__(connection, "/zosmf/restconsoles/consoles/defcn", logger_name=__name__, log=log) def issue_command(self, command: str, console: Optional[str] = None) -> IssueCommandResponse: diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py index 101a8ba1..a55003ef 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py @@ -34,7 +34,7 @@ class USSFiles(SdkApi): The z/OSMF connection object (generated by the ZoweSDK object) """ - def __init__(self, connection: dict, log = False): + def __init__(self, connection: dict, log = True): super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__) self._default_headers["Accept-Encoding"] = "gzip" From 149a5e350951f794a4c49d68167850f8bb7fa7fc Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Tue, 27 Aug 2024 23:30:45 +0530 Subject: [PATCH 06/13] log true for datasets Signed-off-by: aadityasinha-dotcom --- src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py index 1a05d208..b8b922df 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py @@ -303,7 +303,7 @@ class Datasets(SdkApi): A profile for connection in dict (json) format """ - def __init__(self, connection: dict, log = False): + def __init__(self, connection: dict, log = True): super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__) self._default_headers["Accept-Encoding"] = "gzip" From b3dfaed5580a499dd8dc54e307dbabb2971f43e5 Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Wed, 28 Aug 2024 22:16:47 +0530 Subject: [PATCH 07/13] changes Signed-off-by: aadityasinha-dotcom --- src/core/zowe/core_for_zowe_sdk/sdk_api.py | 2 ++ src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py | 2 +- src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/zowe/core_for_zowe_sdk/sdk_api.py b/src/core/zowe/core_for_zowe_sdk/sdk_api.py index 4fe8e0f2..6bdecfe0 100644 --- a/src/core/zowe/core_for_zowe_sdk/sdk_api.py +++ b/src/core/zowe/core_for_zowe_sdk/sdk_api.py @@ -31,6 +31,8 @@ class SdkApi: Default url used for session logger_name : str Name of the logger (same as the filename by default) + log : boolean + Flag to disable logger """ def __init__(self, profile: dict, default_url: str, logger_name: str = __name__, log = True): diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py index b8b922df..bbe236ce 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py @@ -304,7 +304,7 @@ class Datasets(SdkApi): """ def __init__(self, connection: dict, log = True): - super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__) + super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__, log=log) self._default_headers["Accept-Encoding"] = "gzip" def list(self, name_pattern: str, return_attributes: bool = False) -> DatasetListResponse: diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py index a55003ef..b0eb6356 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py @@ -35,7 +35,7 @@ class USSFiles(SdkApi): """ def __init__(self, connection: dict, log = True): - super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__) + super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__, log=log) self._default_headers["Accept-Encoding"] = "gzip" def list(self, path: str) -> USSListResponse: From bb74d88267ee6ac3085ab9fb03403a81d4d85435 Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Sun, 1 Sep 2024 18:13:05 +0530 Subject: [PATCH 08/13] added test for logger Signed-off-by: aadityasinha-dotcom --- tests/unit/core/test_sdk_api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/unit/core/test_sdk_api.py b/tests/unit/core/test_sdk_api.py index 374225dd..0505382b 100644 --- a/tests/unit/core/test_sdk_api.py +++ b/tests/unit/core/test_sdk_api.py @@ -25,6 +25,11 @@ def test_object_should_be_instance_of_class(self): sdk_api = SdkApi(self.basic_props, self.default_url) self.assertIsInstance(sdk_api, SdkApi) + def test_object_should_be_instance_with_logger_set_to_false(self): + """Created object should be instance with logger set to False of SdkApi class.""" + sdk_api = SdkApi(self.basic_props, self.default_url, log=False) + self.assertIsInstance(sdk_api, SdkApi) + @mock.patch("requests.Session.close") def test_context_manager_closes_session(self, mock_close_request): From fbfe2a264a13f4c92f0d93bcb003779708befdcd Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Fri, 6 Sep 2024 22:36:23 +0530 Subject: [PATCH 09/13] added changes to the unit test for logger Signed-off-by: aadityasinha-dotcom --- tests/unit/core/test_sdk_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/core/test_sdk_api.py b/tests/unit/core/test_sdk_api.py index 0505382b..174fd522 100644 --- a/tests/unit/core/test_sdk_api.py +++ b/tests/unit/core/test_sdk_api.py @@ -28,7 +28,7 @@ def test_object_should_be_instance_of_class(self): def test_object_should_be_instance_with_logger_set_to_false(self): """Created object should be instance with logger set to False of SdkApi class.""" sdk_api = SdkApi(self.basic_props, self.default_url, log=False) - self.assertIsInstance(sdk_api, SdkApi) + self.assertEqual(sdk_api.logger.disabled, True) @mock.patch("requests.Session.close") def test_context_manager_closes_session(self, mock_close_request): From 0a95c7e27a66923ac016a6f3bab28b75ba0fc4f4 Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Thu, 12 Sep 2024 23:13:36 +0530 Subject: [PATCH 10/13] added changes to the docstrings Signed-off-by: aadityasinha-dotcom --- src/zos_console/zowe/zos_console_for_zowe_sdk/console.py | 2 ++ src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py | 2 ++ src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py | 2 ++ src/zos_files/zowe/zos_files_for_zowe_sdk/files.py | 2 ++ src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py | 2 ++ src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py | 2 ++ src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py | 2 ++ src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py | 2 ++ 8 files changed, 16 insertions(+) diff --git a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py index 42ebe323..185ca33d 100644 --- a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py +++ b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py @@ -25,6 +25,8 @@ class Console(SdkApi): ---------- connection : dict A profile in dict (json) format + log : boolean + Flag to disable logger """ def __init__(self, connection: dict, log = True): diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py index bbe236ce..20eb0d34 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py @@ -301,6 +301,8 @@ class Datasets(SdkApi): ---------- connection : dict A profile for connection in dict (json) format + log : boolean + Flag to disable logger """ def __init__(self, connection: dict, log = True): diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py index 23d0f0e0..928bc42b 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py @@ -30,6 +30,8 @@ class FileSystems(SdkApi): ---------- connection : dict A profile for connection in dict (json) format + log : boolean + Flag to disable logger """ def __init__(self, connection: dict, log=True): diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py index cecf90aa..adca47d7 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py @@ -39,6 +39,8 @@ class Files(SdkApi): ---------- connection: dict The z/OSMF connection object (generated by the ZoweSDK object) + log : boolean + Flag to disable logger """ ds: Datasets diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py index b0eb6356..b1dfbaed 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py @@ -32,6 +32,8 @@ class USSFiles(SdkApi): ---------- connection: dict The z/OSMF connection object (generated by the ZoweSDK object) + log : boolean + Flag to disable logger """ def __init__(self, connection: dict, log = True): diff --git a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py index 7c818631..b79aa209 100644 --- a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py +++ b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py @@ -28,6 +28,8 @@ class Jobs(SdkApi): ---------- connection : dict A profile for connection in dict (json) format + log : boolean + Flag to disable logger """ def __init__(self, connection: dict, log = True): diff --git a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py index b7510893..d1b0485e 100644 --- a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py +++ b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py @@ -26,6 +26,8 @@ class Tso(SdkApi): ---------- connection: dict Connection object + log : boolean + Flag to disable logger tso_profile: Optional[dict] Profile used for tso connection """ diff --git a/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py b/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py index 99fbedf0..bb4350d0 100644 --- a/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py +++ b/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py @@ -23,6 +23,8 @@ class Zosmf(SdkApi): ---------- connection: dict The z/OSMF connection object (generated by the ZoweSDK object) + log : boolean + Flag to disable logger """ def __init__(self, connection: dict, log = True): From 6333c1a6d8a42811db09fa8e48f7d23468c93d5c Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Wed, 18 Sep 2024 10:43:51 +0530 Subject: [PATCH 11/13] fix pylint errors Signed-off-by: aadityasinha-dotcom --- src/core/zowe/core_for_zowe_sdk/logger.py | 4 ++-- src/core/zowe/core_for_zowe_sdk/sdk_api.py | 4 ++-- src/zos_console/zowe/zos_console_for_zowe_sdk/console.py | 4 ++-- src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py | 4 ++-- src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py | 4 ++-- src/zos_files/zowe/zos_files_for_zowe_sdk/files.py | 4 ++-- src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py | 4 ++-- src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py | 4 ++-- src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py | 6 +++--- src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py | 4 ++-- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/core/zowe/core_for_zowe_sdk/logger.py b/src/core/zowe/core_for_zowe_sdk/logger.py index c3f2cd7c..06421d62 100644 --- a/src/core/zowe/core_for_zowe_sdk/logger.py +++ b/src/core/zowe/core_for_zowe_sdk/logger.py @@ -20,8 +20,6 @@ class Log: Attributes ---------- - loggers: set - The set of all loggers dirname: str Path where the log file is saved file_handler: logging.FileHandler @@ -32,6 +30,8 @@ class Log: Specifies whether log messages would be saved to a file. True by default. console_output: bool Specifies whether log messages would be printed out on console. True by default. + loggers: set + The set of all loggers """ dirname: str = os.path.join(os.path.expanduser("~"), ".zowe/logs") diff --git a/src/core/zowe/core_for_zowe_sdk/sdk_api.py b/src/core/zowe/core_for_zowe_sdk/sdk_api.py index 6bdecfe0..c11a6948 100644 --- a/src/core/zowe/core_for_zowe_sdk/sdk_api.py +++ b/src/core/zowe/core_for_zowe_sdk/sdk_api.py @@ -31,11 +31,11 @@ class SdkApi: Default url used for session logger_name : str Name of the logger (same as the filename by default) - log : boolean + log : bool Flag to disable logger """ - def __init__(self, profile: dict, default_url: str, logger_name: str = __name__, log = True): + def __init__(self, profile: dict, default_url: str, logger_name: str = __name__, log: bool = True): session = Session(profile) self.session: ISession = session.load() diff --git a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py index 185ca33d..7f14050f 100644 --- a/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py +++ b/src/zos_console/zowe/zos_console_for_zowe_sdk/console.py @@ -25,11 +25,11 @@ class Console(SdkApi): ---------- connection : dict A profile in dict (json) format - log : boolean + log : bool Flag to disable logger """ - def __init__(self, connection: dict, log = True): + def __init__(self, connection: dict, log: bool = True): super().__init__(connection, "/zosmf/restconsoles/consoles/defcn", logger_name=__name__, log=log) def issue_command(self, command: str, console: Optional[str] = None) -> IssueCommandResponse: diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py index 20eb0d34..32057878 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py @@ -301,11 +301,11 @@ class Datasets(SdkApi): ---------- connection : dict A profile for connection in dict (json) format - log : boolean + log : bool Flag to disable logger """ - def __init__(self, connection: dict, log = True): + def __init__(self, connection: dict, log: bool = True): super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__, log=log) self._default_headers["Accept-Encoding"] = "gzip" diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py index 928bc42b..db007dca 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/file_system.py @@ -30,11 +30,11 @@ class FileSystems(SdkApi): ---------- connection : dict A profile for connection in dict (json) format - log : boolean + log : bool Flag to disable logger """ - def __init__(self, connection: dict, log=True): + def __init__(self, connection: dict, log: bool = True): super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__, log=log) self._default_headers["Accept-Encoding"] = "gzip" diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py index adca47d7..0bf56c86 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py @@ -39,7 +39,7 @@ class Files(SdkApi): ---------- connection: dict The z/OSMF connection object (generated by the ZoweSDK object) - log : boolean + log : bool Flag to disable logger """ @@ -47,7 +47,7 @@ class Files(SdkApi): uss: USSFiles fs: FileSystems - def __init__(self, connection: dict, log = True): + def __init__(self, connection: dict, log: bool = True): super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__, log=log) self._default_headers["Accept-Encoding"] = "gzip" self.ds = Datasets(connection) diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py index b1dfbaed..4be1f732 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py @@ -32,11 +32,11 @@ class USSFiles(SdkApi): ---------- connection: dict The z/OSMF connection object (generated by the ZoweSDK object) - log : boolean + log : bool Flag to disable logger """ - def __init__(self, connection: dict, log = True): + def __init__(self, connection: dict, log: bool = True): super().__init__(connection, "/zosmf/restfiles/", logger_name=__name__, log=log) self._default_headers["Accept-Encoding"] = "gzip" diff --git a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py index b79aa209..1ae81fab 100644 --- a/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py +++ b/src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py @@ -28,11 +28,11 @@ class Jobs(SdkApi): ---------- connection : dict A profile for connection in dict (json) format - log : boolean + log : bool Flag to disable logger """ - def __init__(self, connection: dict, log = True): + def __init__(self, connection: dict, log: bool = True): super().__init__(connection, "/zosmf/restjobs/jobs/", logger_name=__name__, log=log) def get_job_status(self, jobname: str, jobid: str) -> JobResponse: diff --git a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py index d1b0485e..b0e16471 100644 --- a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py +++ b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py @@ -26,13 +26,13 @@ class Tso(SdkApi): ---------- connection: dict Connection object - log : boolean - Flag to disable logger tso_profile: Optional[dict] Profile used for tso connection + log : bool + Flag to disable logger """ - def __init__(self, connection: dict, tso_profile: Optional[dict] = None, log = True): + def __init__(self, connection: dict, tso_profile: Optional[dict] = None, log: bool = True): super().__init__(connection, "/zosmf/tsoApp/tso", logger_name=__name__, log=log) self.session_not_found = constants["TsoSessionNotFound"] self.tso_profile = tso_profile or {} diff --git a/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py b/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py index bb4350d0..5c4f26b1 100644 --- a/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py +++ b/src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py @@ -23,11 +23,11 @@ class Zosmf(SdkApi): ---------- connection: dict The z/OSMF connection object (generated by the ZoweSDK object) - log : boolean + log : bool Flag to disable logger """ - def __init__(self, connection: dict, log = True): + def __init__(self, connection: dict, log: bool = True): super().__init__(connection, "/zosmf/info", logger_name=__name__, log=log) def get_info(self) -> ZosmfResponse: From 0a1020a70b82ee5fc57d58752c60099c995a84f0 Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Tue, 24 Sep 2024 23:19:21 +0530 Subject: [PATCH 12/13] changelog Signed-off-by: aadityasinha-dotcom --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96698cd6..3533bd4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ All notable changes to the Zowe Client Python SDK will be documented in this fil - Fixed Core SDK package referencing a non-existent version of Secrets SDK. +### Enhancements + +- Turning of logger at the class-constructor level [#316] (https://github.com/zowe/zowe-client-python-sdk/issues/316) + ## `1.0.0-dev20` ### Enhancements From de453097a3f9d07cf2dee776c15a6f8ccf78edcc Mon Sep 17 00:00:00 2001 From: aadityasinha-dotcom Date: Tue, 24 Sep 2024 23:48:25 +0530 Subject: [PATCH 13/13] changes Signed-off-by: aadityasinha-dotcom --- CHANGELOG.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3533bd4a..d118fa03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,18 @@ All notable changes to the Zowe Client Python SDK will be documented in this file. +## Recent Changes + +### Enhancements + +- Turning of logger at the class-constructor level [#316] (https://github.com/zowe/zowe-client-python-sdk/issues/316) + ## `1.0.0-dev21` ### Bug Fixes - Fixed Core SDK package referencing a non-existent version of Secrets SDK. -### Enhancements - -- Turning of logger at the class-constructor level [#316] (https://github.com/zowe/zowe-client-python-sdk/issues/316) ## `1.0.0-dev20`