rubrikinc / rubrik-sdk-for-python

Rubrik SDK for Python
https://build.rubrik.com/sdks/python/
MIT License
29 stars 38 forks source link

MSSQL Recovery Point Validation - strftime ValueError #268

Closed whocking closed 3 years ago

whocking commented 3 years ago

Expected Behavior

When providing correct fields based on the example from https://rubrik.gitbook.io/rubrik-sdk-for-python/data-management-functions/sql_db_export, the MSSQL DB Export should initiate the job.

Current Behavior When running the snippet on Python 2/3 within Windows Server 2019, ValueError is encountered when formulating recovery_timestamp variable.

Failure Information (for bugs) srftime %s is not mentioned on the official documentation, so we should likely look to switch all instances of this calculation method. https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior

I'll be submitting a PR shortly with the proposed fix.

[2021-02-08 10:50:29,778] [DEBUG] -- _date_time_conversion: Converting the provided time to the 24-hour clock. [2021-02-08 10:50:29,778] [DEBUG] -- _date_time_conversion: Creating a combined date/time variable. [2021-02-08 10:50:29,887] [DEBUG] -- _date_time_conversion: Converting the time to UTC.

Traceback (most recent call last): File ".\Desktop\test.py", line 22, in target_log_file_path) File "C:\Python27\lib\site-packages\rubrik_cdm\data_management.py", line 2514, in sql_db_export mssql_id, date, time) File "C:\Python27\lib\site-packages\rubrik_cdm\data_management.py", line 2077, in _validate_sql_recovery_point recovery_timestamp = int(recovery_date_time.strftime('%s')) * 1000 ValueError: Invalid format string PS C:\Users\Administrator>

Python 3.8.7 on Windows Server 2019

[2021-02-08 11:09:34,531] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:09:34,531] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:09:34,765] [DEBUG] -- <Response [200]>

[2021-02-08 11:09:34,765] [DEBUG] -- _date_time_conversion: Converting the provided time to the 24-hour clock. [2021-02-08 11:09:34,765] [DEBUG] -- _date_time_conversion: Creating a combined date/time variable. [2021-02-08 11:09:37,234] [DEBUG] -- _date_time_conversion: Converting the time to UTC.

Traceback (most recent call last): File ".\Desktop\test.py", line 13, in sql_db_export = rubrik.sql_db_export(db_name, File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\rubrik_cdm\data_management.py", line 2513, in sql_db_export recovery_point = self._validate_sql_recovery_point( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\rubrik_cdm\data_management.py", line 2077, in _validate_sql_recovery_point recovery_timestamp = int(recovery_date_time.strftime('%s')) * 1000 ValueError: Invalid format string


No issues on Python 2/3 on Ubuntu 20.04

[2021-02-08 16:58:47,824] [DEBUG] -- _date_time_conversion: Converting the provided time to the 24-hour clock. [2021-02-08 16:58:47,824] [DEBUG] -- _date_time_conversion: Creating a combined date/time variable. [2021-02-08 16:58:47,861] [DEBUG] -- _date_time_conversion: Converting the time to UTC. [2021-02-08 16:58:47,862] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point. [2021-02-08 16:58:47,863] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point.

**Steps to Reproduce**

1. Install Python 2/3 on Windows Server 2019.
2. Install newest version of `rubrik_cdm`.
3. Run snippet above to attempt MSSQL Database Export.

**Context**

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

* `rubrik_cdm` - 2.0.10
* Operating System - Windows Server 2019

**Failure Logs**

Python 2.7.18 on Windows Server 2019 is seeing this issue when attempting to formulate timestamp for SQL Export

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator> python -V Python 2.7.18 PS C:\Users\Administrator> pip install rubrik_cdm DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Collecting rubrik_cdm Using cached https://files.pythonhosted.org/packages/c1/ce/4e2cf1f75ecd532409930a0374483b2922c3a541cd714e526505fa43847b/rubrik_cdm-2.0.10.tar.gz Collecting requests!=2.22.0,>=2.18.4 (from rubrik_cdm) Using cached https://files.pythonhosted.org/packages/29/c1/24814557f1d22c56d50280771a17307e6bf87b70727d975fd6b2ce6b014a/requests-2.25.1-py2.py3-none-any.whl Collecting python-dateutil (from rubrik_cdm) Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl Collecting pytz (from rubrik_cdm) Using cached https://files.pythonhosted.org/packages/70/94/784178ca5dd892a98f113cdd923372024dc04b8d40abe77ca76b5fb90ca6/pytz-2021.1-py2.py3-none-any.whl Collecting idna<3,>=2.5 (from requests!=2.22.0,>=2.18.4->rubrik_cdm) Using cached https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl Collecting urllib3<1.27,>=1.21.1 (from requests!=2.22.0,>=2.18.4->rubrik_cdm) Using cached https://files.pythonhosted.org/packages/23/fc/8a49991f7905261f9ca9df5aa9b58363c3c821ce3e7f671895442b7100f2/urllib3-1.26.3-py2.py3-none-any.whl Collecting certifi>=2017.4.17 (from requests!=2.22.0,>=2.18.4->rubrik_cdm) Using cached https://files.pythonhosted.org/packages/5e/a0/5f06e1e1d463903cf0c0eebeb751791119ed7a4b3737fdc9a77f1cdfb51f/certifi-2020.12.5-py2.py3-none-any.whl Collecting chardet<5,>=3.0.2 (from requests!=2.22.0,>=2.18.4->rubrik_cdm) Using cached https://files.pythonhosted.org/packages/19/c7/fa589626997dd07bd87d9269342ccb74b1720384a4d739a1872bd84fbe68/chardet-4.0.0-py2.py3-none-any.whl Collecting six>=1.5 (from python-dateutil->rubrik_cdm) Using cached https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl Installing collected packages: idna, urllib3, certifi, chardet, requests, six, python-dateutil, pytz, rubrik-cdm Running setup.py install for rubrik-cdm ... done Successfully installed certifi-2020.12.5 chardet-4.0.0 idna-2.10 python-dateutil-2.8.1 pytz-2021.1 requests-2.25.1 rubrik-cdm-2.0.10 six-1.15.0 urllib3-1.26.3 WARNING: You are using pip version 19.2.3, however version 20.3.4 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

PS C:\Users\Administrator> python .\Desktop\test.py [2021-02-08 10:50:27,868] [DEBUG] -- Node IP: lfk-brik-01.support.rubrik.local [2021-02-08 10:50:27,868] [DEBUG] -- Username: admin [2021-02-08 10:50:27,884] [DEBUG] -- Password: ** [2021-02-08 10:50:27,884] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 10:50:27,884] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:50:27,884] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:50:28,431] [DEBUG] -- <Response [200]>

[2021-02-08 10:50:28,431] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-00'. [2021-02-08 10:50:28,431] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:50:28,431] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-00 C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:50:28,680] [DEBUG] -- <Response [200]>

[2021-02-08 10:50:28,680] [DEBUG] -- _validate_sql_db: Getting the list of instances on host lfk-sql14-sa-00. [2021-02-08 10:50:28,680] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:50:28,680] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::a12a359d-405e-40d4-a8ea-dbc501a560fc C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:50:29,056] [DEBUG] -- <Response [200]>

[2021-02-08 10:50:29,056] [DEBUG] -- _validate_sql_db: Getting the list of databases on the instance MSSQLSERVER, on host lfk-sql14-sa-00. [2021-02-08 10:50:29,056] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:50:29,056] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db?primary_cluster_id=local&instance_id=MssqlInstance:::890b796e-3a55-46b9-b8fd-ec2be4959c00 C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:50:29,312] [DEBUG] -- <Response [200]>

[2021-02-08 10:50:29,312] [DEBUG] -- _validate_sql_recovery_point: Getting the recoverable range for db ID:'MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1'. [2021-02-08 10:50:29,312] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:50:29,312] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/recoverable_range C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:50:29,542] [DEBUG] -- <Response [200]>

[2021-02-08 10:50:29,542] [DEBUG] -- _validate_sql_recovery_point: Converting the provided date/time into UTC. [2021-02-08 10:50:29,559] [DEBUG] -- _date_time_conversion: Getting the Rubrik cluster timezone. [2021-02-08 10:50:29,559] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:50:29,559] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:50:29,778] [DEBUG] -- <Response [200]>

[2021-02-08 10:50:29,778] [DEBUG] -- _date_time_conversion: Converting the provided time to the 24-hour clock. [2021-02-08 10:50:29,778] [DEBUG] -- _date_time_conversion: Creating a combined date/time variable. [2021-02-08 10:50:29,887] [DEBUG] -- _date_time_conversion: Converting the time to UTC.

Traceback (most recent call last): File ".\Desktop\test.py", line 22, in target_log_file_path) File "C:\Python27\lib\site-packages\rubrik_cdm\data_management.py", line 2514, in sql_db_export mssql_id, date, time) File "C:\Python27\lib\site-packages\rubrik_cdm\data_management.py", line 2077, in _validate_sql_recovery_point recovery_timestamp = int(recovery_date_time.strftime('%s')) * 1000 ValueError: Invalid format string PS C:\Users\Administrator>


Python 2.7.18 on Windows Server 2019 after fix

PS C:\Users\Administrator> python .\Desktop\test.py [2021-02-08 10:52:19,496] [DEBUG] -- Node IP: lfk-brik-01.support.rubrik.local [2021-02-08 10:52:19,512] [DEBUG] -- Username: admin [2021-02-08 10:52:19,528] [DEBUG] -- Password: ** [2021-02-08 10:52:19,528] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 10:52:19,528] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:19,528] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:20,105] [DEBUG] -- <Response [200]>

[2021-02-08 10:52:20,105] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-00'. [2021-02-08 10:52:20,105] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:20,105] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-00 C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:20,355] [DEBUG] -- <Response [200]>

[2021-02-08 10:52:20,355] [DEBUG] -- _validate_sql_db: Getting the list of instances on host lfk-sql14-sa-00. [2021-02-08 10:52:20,355] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:20,355] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::a12a359d-405e-40d4-a8ea-dbc501a560fc C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:20,700] [DEBUG] -- <Response [200]>

[2021-02-08 10:52:20,700] [DEBUG] -- _validate_sql_db: Getting the list of databases on the instance MSSQLSERVER, on host lfk-sql14-sa-00. [2021-02-08 10:52:20,700] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:20,700] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db?primary_cluster_id=local&instance_id=MssqlInstance:::890b796e-3a55-46b9-b8fd-ec2be4959c00 C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:20,903] [DEBUG] -- <Response [200]>

[2021-02-08 10:52:20,903] [DEBUG] -- _validate_sql_recovery_point: Getting the recoverable range for db ID:'MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1'. [2021-02-08 10:52:20,918] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:20,918] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/recoverable_range C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:21,153] [DEBUG] -- <Response [200]>

[2021-02-08 10:52:21,153] [DEBUG] -- _validate_sql_recovery_point: Converting the provided date/time into UTC. [2021-02-08 10:52:21,153] [DEBUG] -- _date_time_conversion: Getting the Rubrik cluster timezone. [2021-02-08 10:52:21,153] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:21,153] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:21,339] [DEBUG] -- <Response [200]>

[2021-02-08 10:52:21,339] [DEBUG] -- _date_time_conversion: Converting the provided time to the 24-hour clock. [2021-02-08 10:52:21,339] [DEBUG] -- _date_time_conversion: Creating a combined date/time variable. [2021-02-08 10:52:21,480] [DEBUG] -- _date_time_conversion: Converting the time to UTC.

[2021-02-08 10:52:21,480] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point. [2021-02-08 10:52:21,480] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point. [2021-02-08 10:52:21,480] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 10:52:21,480] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:21,480] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:21,653] [DEBUG] -- <Response [200]>

[2021-02-08 10:52:21,653] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-01'. [2021-02-08 10:52:21,653] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:21,653] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-01 C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:21,950] [DEBUG] -- <Response [200]>

[2021-02-08 10:52:21,950] [DEBUG] -- sql_db_export: Getting the instances on target host lfk-sql14-sa-01. [2021-02-08 10:52:21,950] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:21,950] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::92e28b89-fa0a-4335-a62a-5dd3732f4d94 C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:22,262] [DEBUG] -- <Response [200]>

[2021-02-08 10:52:22,262] [DEBUG] -- sql_db_export: Exporting the database 'AdventureWorks2014' from recovery_point on 2-8-2021 at 10:45 AM with new name 'Demo_Export'. [2021-02-08 10:52:22,262] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 10:52:22,262] [DEBUG] -- POST https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/export [2021-02-08 10:52:22,262] [DEBUG] -- Config: {"maxDataStreams": 2, "allowOverwrite": false, "targetDatabaseName": "Demo_Export", "targetDataFilePath": "D:\Restore", "finishRecovery": true, "recoveryPoint": {"timestampMs": 1612802700000.0}, "targetInstanceId": "MssqlInstance:::ba1a84b2-bcdd-47ea-8594-f643751bf7e5", "targetLogFilePath": "E:\Restore"} C:\Python27\lib\site-packages\urllib3\connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 10:52:22,849] [DEBUG] -- Response: {"id":"RESTORE_MSSQL_DB_6ed9838b-1b8c-4935-ba8e-0cf791b33c7f_14d407e6-38d9-464a-8160-8fb86eef8be1:::0","status":"QUEUED","progress":0.0,"startTime":"2021-02-08T18:52:25.498Z","links":[{"href":"https://lfk-brik-01.support.rubrik.local/api/v1/mssql/request/RESTORE_MSSQL_DB_6ed9838b-1b8c-4935-ba8e-0cf791b33c7f_14d407e6-38d9-464a-8160-8fb86eef8be1:::0","rel":"self"}]} [2021-02-08 10:52:22,849] [DEBUG] -- <Response [202]>

{u'status': u'QUEUED', u'progress': 0.0, u'links': [{u'href': u'https://lfk-brik-01.support.rubrik.local/api/v1/mssql/request/RESTORE_MSSQL_DB_6ed9838b-1b8c-4935-ba8e-0cf791b33c7f_14d407e6-38d9-464a-8160-8fb86eef8be1:::0', u'rel': u'self'}], u'id': u'RESTORE_MSSQL_DB_6ed9838b-1b8c-4935-ba8e-0cf791b33c7f_14d407e6-38d9-464a-8160-8fb86eef8be1:::0', u'startTime': u'2021-02-08T18:52:25.498Z'}


Similar error on Python 3.8.7 on Windows Server 2019

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator> python -V Python 3.8.7 PS C:\Users\Administrator> pip install rubrik_cdm --no-cache-dir Collecting rubrik_cdm Downloading rubrik_cdm-2.0.10.tar.gz (83 kB) |████████████████████████████████| 83 kB 794 kB/s Collecting requests!=2.22.0,>=2.18.4 Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB) |████████████████████████████████| 61 kB 3.8 MB/s Collecting python-dateutil Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB) |████████████████████████████████| 227 kB 3.3 MB/s Requirement already satisfied: pytz in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from rubrik_cdm) (2021.1) Collecting chardet<5,>=3.0.2 Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB) |████████████████████████████████| 178 kB ... Collecting urllib3<1.27,>=1.21.1 Downloading urllib3-1.26.3-py2.py3-none-any.whl (137 kB) |████████████████████████████████| 137 kB 6.8 MB/s Collecting idna<3,>=2.5 Downloading idna-2.10-py2.py3-none-any.whl (58 kB) |████████████████████████████████| 58 kB 3.8 MB/s Collecting certifi>=2017.4.17 Downloading certifi-2020.12.5-py2.py3-none-any.whl (147 kB) |████████████████████████████████| 147 kB 6.4 MB/s Collecting six>=1.5 Downloading six-1.15.0-py2.py3-none-any.whl (10 kB) Using legacy 'setup.py install' for rubrik-cdm, since package 'wheel' is not installed. Installing collected packages: chardet, urllib3, idna, certifi, requests, six, python-dateutil, rubrik-cdm Running setup.py install for rubrik-cdm ... done Successfully installed certifi-2020.12.5 chardet-4.0.0 idna-2.10 python-dateutil-2.8.1 requests-2.25.1 rubrik-cdm-2.0.10 six-1.15.0 urllib3-1.26.3 WARNING: You are using pip version 20.2.3; however, version 21.0.1 is available. You should consider upgrading via the 'c:\users\administrator\appdata\local\programs\python\python38\python.exe -m pip install --upgrade pip' command. PS C:\Users\Administrator> python .\Desktop\test.py [2021-02-08 11:09:33,083] [DEBUG] -- Node IP: lfk-brik-01.support.rubrik.local [2021-02-08 11:09:33,083] [DEBUG] -- Username: admin [2021-02-08 11:09:33,083] [DEBUG] -- Password: ** [2021-02-08 11:09:33,099] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 11:09:33,099] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:09:33,115] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:09:33,333] [DEBUG] -- <Response [200]>

[2021-02-08 11:09:33,333] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-00'. [2021-02-08 11:09:33,333] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:09:33,333] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-00 C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:09:33,630] [DEBUG] -- <Response [200]>

[2021-02-08 11:09:33,630] [DEBUG] -- _validate_sql_db: Getting the list of instances on host lfk-sql14-sa-00. [2021-02-08 11:09:33,630] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:09:33,630] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::a12a359d-405e-40d4-a8ea-dbc501a560fc C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:09:33,974] [DEBUG] -- <Response [200]>

[2021-02-08 11:09:33,974] [DEBUG] -- _validate_sql_db: Getting the list of databases on the instance MSSQLSERVER, on host lfk-sql14-sa-00. [2021-02-08 11:09:33,974] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:09:33,974] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db?primary_cluster_id=local&instance_id=MssqlInstance:::890b796e-3a55-46b9-b8fd-ec2be4959c00 C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:09:34,203] [DEBUG] -- <Response [200]>

[2021-02-08 11:09:34,218] [DEBUG] -- _validate_sql_recovery_point: Getting the recoverable range for db ID:'MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1'. [2021-02-08 11:09:34,218] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:09:34,218] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/recoverable_range C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:09:34,515] [DEBUG] -- <Response [200]>

[2021-02-08 11:09:34,515] [DEBUG] -- _validate_sql_recovery_point: Converting the provided date/time into UTC. [2021-02-08 11:09:34,531] [DEBUG] -- _date_time_conversion: Getting the Rubrik cluster timezone. [2021-02-08 11:09:34,531] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:09:34,531] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:09:34,765] [DEBUG] -- <Response [200]>

[2021-02-08 11:09:34,765] [DEBUG] -- _date_time_conversion: Converting the provided time to the 24-hour clock. [2021-02-08 11:09:34,765] [DEBUG] -- _date_time_conversion: Creating a combined date/time variable. [2021-02-08 11:09:37,234] [DEBUG] -- _date_time_conversion: Converting the time to UTC.

Traceback (most recent call last): File ".\Desktop\test.py", line 13, in sql_db_export = rubrik.sql_db_export(db_name, File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\rubrik_cdm\data_management.py", line 2513, in sql_db_export recovery_point = self._validate_sql_recovery_point( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\rubrik_cdm\data_management.py", line 2077, in _validate_sql_recovery_point recovery_timestamp = int(recovery_date_time.strftime('%s')) * 1000 ValueError: Invalid format string


Python 3.8.7 on Windows Server 2019 after fix

PS C:\Users\Administrator> python .\Desktop\test.py [2021-02-08 11:11:54,986] [DEBUG] -- Node IP: lfk-brik-01.support.rubrik.local [2021-02-08 11:11:54,986] [DEBUG] -- Username: admin [2021-02-08 11:11:55,002] [DEBUG] -- Password: ** [2021-02-08 11:11:55,002] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 11:11:55,002] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:55,002] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:55,414] [DEBUG] -- <Response [200]>

[2021-02-08 11:11:55,414] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-00'. [2021-02-08 11:11:55,414] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:55,414] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-00 C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:55,883] [DEBUG] -- <Response [200]>

[2021-02-08 11:11:55,883] [DEBUG] -- _validate_sql_db: Getting the list of instances on host lfk-sql14-sa-00. [2021-02-08 11:11:55,883] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:55,883] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::a12a359d-405e-40d4-a8ea-dbc501a560fc C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:56,279] [DEBUG] -- <Response [200]>

[2021-02-08 11:11:56,279] [DEBUG] -- _validate_sql_db: Getting the list of databases on the instance MSSQLSERVER, on host lfk-sql14-sa-00. [2021-02-08 11:11:56,279] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:56,279] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db?primary_cluster_id=local&instance_id=MssqlInstance:::890b796e-3a55-46b9-b8fd-ec2be4959c00 C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:56,607] [DEBUG] -- <Response [200]>

[2021-02-08 11:11:56,607] [DEBUG] -- _validate_sql_recovery_point: Getting the recoverable range for db ID:'MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1'. [2021-02-08 11:11:56,607] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:56,607] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/recoverable_range C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:56,935] [DEBUG] -- <Response [200]>

[2021-02-08 11:11:56,935] [DEBUG] -- _validate_sql_recovery_point: Converting the provided date/time into UTC. [2021-02-08 11:11:56,935] [DEBUG] -- _date_time_conversion: Getting the Rubrik cluster timezone. [2021-02-08 11:11:56,935] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:56,935] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:57,318] [DEBUG] -- <Response [200]>

[2021-02-08 11:11:57,318] [DEBUG] -- _date_time_conversion: Converting the provided time to the 24-hour clock. [2021-02-08 11:11:57,318] [DEBUG] -- _date_time_conversion: Creating a combined date/time variable. [2021-02-08 11:11:57,474] [DEBUG] -- _date_time_conversion: Converting the time to UTC.

[2021-02-08 11:11:57,474] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point. [2021-02-08 11:11:57,474] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point. [2021-02-08 11:11:57,474] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 11:11:57,474] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:57,474] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:57,693] [DEBUG] -- <Response [200]>

[2021-02-08 11:11:57,693] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-01'. [2021-02-08 11:11:57,693] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:57,693] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-01 C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:57,943] [DEBUG] -- <Response [200]>

[2021-02-08 11:11:57,943] [DEBUG] -- sql_db_export: Getting the instances on target host lfk-sql14-sa-01. [2021-02-08 11:11:57,943] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:57,943] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::92e28b89-fa0a-4335-a62a-5dd3732f4d94 C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:58,383] [DEBUG] -- <Response [200]>

[2021-02-08 11:11:58,383] [DEBUG] -- sql_db_export: Exporting the database 'AdventureWorks2014' from recovery_point on 2-8-2021 at 10:45 AM with new name 'Demo_Export'. [2021-02-08 11:11:58,383] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.7 [2021-02-08 11:11:58,383] [DEBUG] -- POST https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/export [2021-02-08 11:11:58,383] [DEBUG] -- Config: {"recoveryPoint": {"timestampMs": 1612802700000.0}, "targetInstanceId": "MssqlInstance:::ba1a84b2-bcdd-47ea-8594-f643751bf7e5", "targetDatabaseName": "Demo_Export", "targetDataFilePath": "D:\Restore", "targetLogFilePath": "E:\Restore", "finishRecovery": true, "maxDataStreams": 2, "allowOverwrite": false} C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 11:11:59,205] [DEBUG] -- Response: {"id":"RESTORE_MSSQL_DB_dba67e62-e389-4e37-a9a2-5b98d691b71d_d5521c11-eb08-46ff-a26f-6005b80aa908:::0","status":"QUEUED","progress":0.0,"startTime":"2021-02-08T19:12:01.730Z","links":[{"href":"https://lfk-brik-01.support.rubrik.local/api/v1/mssql/request/RESTORE_MSSQL_DB_dba67e62-e389-4e37-a9a2-5b98d691b71d_d5521c11-eb08-46ff-a26f-6005b80aa908:::0","rel":"self"}]} [2021-02-08 11:11:59,205] [DEBUG] -- <Response [202]>

{'id': 'RESTORE_MSSQL_DB_dba67e62-e389-4e37-a9a2-5b98d691b71d_d5521c11-eb08-46ff-a26f-6005b80aa908:::0', 'status': 'QUEUED', 'progress': 0.0, 'startTime': '2021-02-08T19:12:01.730Z', 'links': [{'href': 'https://lfk-brik-01.support.rubrik.local/api/v1/mssql/request/RESTORE_MSSQL_DB_dba67e62-e389-4e37-a9a2-5b98d691b71d_d5521c11-eb08-46ff-a26f-6005b80aa908:::0', 'rel': 'self'}]}


No issues on Python 3.8.5 / Ubuntu 20.04 prior/after fix

(sdktest) static@william-dev:~$ python test.py [2021-02-08 16:58:46,566] [DEBUG] -- Node IP: lfk-brik-01.support.rubrik.local [2021-02-08 16:58:46,567] [DEBUG] -- Username: admin [2021-02-08 16:58:46,567] [DEBUG] -- Password: ** [2021-02-08 16:58:46,567] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 16:58:46,567] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:46,568] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:46,701] [DEBUG] -- <Response [200]> [2021-02-08 16:58:46,702] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-00'. [2021-02-08 16:58:46,702] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:46,702] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-00 /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:46,870] [DEBUG] -- <Response [200]> [2021-02-08 16:58:46,870] [DEBUG] -- _validate_sql_db: Getting the list of instances on host lfk-sql14-sa-00. [2021-02-08 16:58:46,870] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:46,871] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::a12a359d-405e-40d4-a8ea-dbc501a560fc /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:47,380] [DEBUG] -- <Response [200]> [2021-02-08 16:58:47,381] [DEBUG] -- _validate_sql_db: Getting the list of databases on the instance MSSQLSERVER, on host lfk-sql14-sa-00. [2021-02-08 16:58:47,381] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:47,381] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db?primary_cluster_id=local&instance_id=MssqlInstance:::890b796e-3a55-46b9-b8fd-ec2be4959c00 /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:47,555] [DEBUG] -- <Response [200]> [2021-02-08 16:58:47,556] [DEBUG] -- _validate_sql_recovery_point: Getting the recoverable range for db ID:'MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1'. [2021-02-08 16:58:47,556] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:47,557] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/recoverable_range /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:47,710] [DEBUG] -- <Response [200]> [2021-02-08 16:58:47,711] [DEBUG] -- _validate_sql_recovery_point: Converting the provided date/time into UTC. [2021-02-08 16:58:47,717] [DEBUG] -- _date_time_conversion: Getting the Rubrik cluster timezone. [2021-02-08 16:58:47,717] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:47,718] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:47,824] [DEBUG] -- <Response [200]> [2021-02-08 16:58:47,824] [DEBUG] -- _date_time_conversion: Converting the provided time to the 24-hour clock. [2021-02-08 16:58:47,824] [DEBUG] -- _date_time_conversion: Creating a combined date/time variable. [2021-02-08 16:58:47,861] [DEBUG] -- _date_time_conversion: Converting the time to UTC. [2021-02-08 16:58:47,862] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point. [2021-02-08 16:58:47,863] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point. [2021-02-08 16:58:47,863] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 16:58:47,863] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:47,863] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:47,959] [DEBUG] -- <Response [200]> [2021-02-08 16:58:47,959] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-01'. [2021-02-08 16:58:47,959] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:47,960] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-01 /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:48,123] [DEBUG] -- <Response [200]> [2021-02-08 16:58:48,123] [DEBUG] -- sql_db_export: Getting the instances on target host lfk-sql14-sa-01. [2021-02-08 16:58:48,123] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:48,124] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::92e28b89-fa0a-4335-a62a-5dd3732f4d94 /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:48,288] [DEBUG] -- <Response [200]> [2021-02-08 16:58:48,289] [DEBUG] -- sql_db_export: Exporting the database 'AdventureWorks2014' from recovery_point on 2-8-2021 at 10:45 AM with new name 'Demo_Export'. [2021-02-08 16:58:48,289] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--3.8.5 [2021-02-08 16:58:48,289] [DEBUG] -- POST https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/export [2021-02-08 16:58:48,289] [DEBUG] -- Config: {"recoveryPoint": {"timestampMs": 1612802700000}, "targetInstanceId": "MssqlInstance:::ba1a84b2-bcdd-47ea-8594-f643751bf7e5", "targetDatabaseName": "Demo_Export", "targetDataFilePath": "D:\Restore", "targetLogFilePath": "E:\Restore", "finishRecovery": true, "maxDataStreams": 2, "allowOverwrite": false} /home/static/.virtualenvs/sdktest/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn( [2021-02-08 16:58:48,770] [DEBUG] -- Response: {"id":"RESTORE_MSSQL_DB_b4b7b6ae-3478-4b9a-af84-4dd857d33a34_7c748c49-7a03-4bd0-a65c-8ec87cba0276:::0","status":"QUEUED","progress":0.0,"startTime":"2021-02-08T16:58:51.417Z","links":[{"href":"https://lfk-brik-01.support.rubrik.local/api/v1/mssql/request/RESTORE_MSSQL_DB_b4b7b6ae-3478-4b9a-af84-4dd857d33a34_7c748c49-7a03-4bd0-a65c-8ec87cba0276:::0","rel":"self"}]} [2021-02-08 16:58:48,770] [DEBUG] -- <Response [202]> {'id': 'RESTORE_MSSQL_DB_b4b7b6ae-3478-4b9a-af84-4dd857d33a34_7c748c49-7a03-4bd0-a65c-8ec87cba0276:::0', 'status': 'QUEUED', 'progress': 0.0, 'startTime': '2021-02-08T16:58:51.417Z', 'links': [{'href': 'https://lfk-brik-01.support.rubrik.local/api/v1/mssql/request/RESTORE_MSSQL_DB_b4b7b6ae-3478-4b9a-af84-4dd857d33a34_7c748c49-7a03-4bd0-a65c-8ec87cba0276:::0', 'rel': 'self'}]}


No issues on Python 2.7.18 on Ubuntu 20.04 before/after fix

(sdk2) static@william-dev:~$ python test.py [2021-02-08 19:13:31,756] [DEBUG] -- Node IP: lfk-brik-01.support.rubrik.local [2021-02-08 19:13:31,756] [DEBUG] -- Username: admin [2021-02-08 19:13:31,757] [DEBUG] -- Password: ** [2021-02-08 19:13:31,757] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 19:13:31,757] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:31,757] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:31,898] [DEBUG] -- <Response [200]>

[2021-02-08 19:13:31,899] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-00'. [2021-02-08 19:13:31,899] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:31,900] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-00 /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:32,065] [DEBUG] -- <Response [200]>

[2021-02-08 19:13:32,066] [DEBUG] -- _validate_sql_db: Getting the list of instances on host lfk-sql14-sa-00. [2021-02-08 19:13:32,067] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:32,067] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::a12a359d-405e-40d4-a8ea-dbc501a560fc /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:32,297] [DEBUG] -- <Response [200]>

[2021-02-08 19:13:32,297] [DEBUG] -- _validate_sql_db: Getting the list of databases on the instance MSSQLSERVER, on host lfk-sql14-sa-00. [2021-02-08 19:13:32,298] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:32,298] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db?primary_cluster_id=local&instance_id=MssqlInstance:::890b796e-3a55-46b9-b8fd-ec2be4959c00 /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:32,483] [DEBUG] -- <Response [200]>

[2021-02-08 19:13:32,485] [DEBUG] -- _validate_sql_recovery_point: Getting the recoverable range for db ID:'MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1'. [2021-02-08 19:13:32,485] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:32,485] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/recoverable_range /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:32,631] [DEBUG] -- <Response [200]>

[2021-02-08 19:13:32,632] [DEBUG] -- _validate_sql_recovery_point: Converting the provided date/time into UTC. [2021-02-08 19:13:32,638] [DEBUG] -- _date_time_conversion: Getting the Rubrik cluster timezone. [2021-02-08 19:13:32,639] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:32,639] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:32,748] [DEBUG] -- <Response [200]>

[2021-02-08 19:13:32,749] [DEBUG] -- _date_time_conversion: Converting the provided time to the 24-hour clock. [2021-02-08 19:13:32,749] [DEBUG] -- _date_time_conversion: Creating a combined date/time variable. [2021-02-08 19:13:32,771] [DEBUG] -- _date_time_conversion: Converting the time to UTC.

[2021-02-08 19:13:32,773] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point. [2021-02-08 19:13:32,773] [DEBUG] -- _validate_sql_recovery_point: Searching for the provided recovery_point. [2021-02-08 19:13:32,774] [DEBUG] -- cluster_version: Getting the software version of the Rubrik cluster. [2021-02-08 19:13:32,774] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:32,774] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/cluster/me/version /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:33,007] [DEBUG] -- <Response [200]>

[2021-02-08 19:13:33,008] [DEBUG] -- object_id: Getting the object id for the physical_host object 'lfk-sql14-sa-01'. [2021-02-08 19:13:33,009] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:33,009] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/host?primary_cluster_id=local&name=lfk-sql14-sa-01 /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:33,150] [DEBUG] -- <Response [200]>

[2021-02-08 19:13:33,150] [DEBUG] -- sql_db_export: Getting the instances on target host lfk-sql14-sa-01. [2021-02-08 19:13:33,151] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:33,151] [DEBUG] -- GET https://lfk-brik-01.support.rubrik.local/api/v1/mssql/instance?primary_cluster_id=local&root_id=Host:::92e28b89-fa0a-4335-a62a-5dd3732f4d94 /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:33,307] [DEBUG] -- <Response [200]>

[2021-02-08 19:13:33,308] [DEBUG] -- sql_db_export: Exporting the database 'AdventureWorks2014' from recovery_point on 2-8-2021 at 10:45 AM with new name 'Demo_Export'. [2021-02-08 19:13:33,308] [DEBUG] -- User Agent: RubrikPythonSDK--2.0.10--2.7.18 [2021-02-08 19:13:33,309] [DEBUG] -- POST https://lfk-brik-01.support.rubrik.local/api/v1/mssql/db/MssqlDatabase:::b93b8fdd-5bb0-45bb-89ea-d384d545f4b1/export [2021-02-08 19:13:33,309] [DEBUG] -- Config: {"maxDataStreams": 2, "allowOverwrite": false, "targetDatabaseName": "Demo_Export", "targetDataFilePath": "D:\Restore", "finishRecovery": true, "recoveryPoint": {"timestampMs": 1612802700000.0}, "targetInstanceId": "MssqlInstance:::ba1a84b2-bcdd-47ea-8594-f643751bf7e5", "targetLogFilePath": "E:\Restore"} /home/static/.virtualenvs/sdk2/lib/python2.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'lfk-brik-01.support.rubrik.local'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, [2021-02-08 19:13:33,741] [DEBUG] -- Response: {"id":"RESTORE_MSSQL_DB_29b5cf3a-b6dc-4b62-8440-bd0200ef4fde_d7b0338c-b9ac-43aa-8103-5e12e33570a7:::0","status":"QUEUED","progress":0.0,"startTime":"2021-02-08T19:13:36.412Z","links":[{"href":"https://lfk-brik-01.support.rubrik.local/api/v1/mssql/request/RESTORE_MSSQL_DB_29b5cf3a-b6dc-4b62-8440-bd0200ef4fde_d7b0338c-b9ac-43aa-8103-5e12e33570a7:::0","rel":"self"}]} [2021-02-08 19:13:33,741] [DEBUG] -- <Response [202]>

{u'status': u'QUEUED', u'progress': 0.0, u'links': [{u'href': u'https://lfk-brik-01.support.rubrik.local/api/v1/mssql/request/RESTORE_MSSQL_DB_29b5cf3a-b6dc-4b62-8440-bd0200ef4fde_d7b0338c-b9ac-43aa-8103-5e12e33570a7:::0', u'rel': u'self'}], u'id': u'RESTORE_MSSQL_DB_29b5cf3a-b6dc-4b62-8440-bd0200ef4fde_d7b0338c-b9ac-43aa-8103-5e12e33570a7:::0', u'startTime': u'2021-02-08T19:13:36.412Z'}

jaapbrasser commented 3 years ago

Thanks for the fix @whocking! 🥇