Isilon / isilon_sdk_python

Official generated source of the Isilon SDK Python language bindings.
36 stars 33 forks source link

Connecting Errors #37

Closed NICWELLER98 closed 1 year ago

NICWELLER98 commented 3 years ago

I am trying to use Isilon's SDK in order to connect to our Isilon system. This script below gets a response from our server which is password is wrong when I run it locally. This response makes sense because the password I supplied it was not the correct password. The issue arises when I try running this script on a server. When I try running the script on a server the script does seem to ever find the specified host. Note: the script that I'm using locally is the same as the one on the server (meaning I specify the same host). I'm reaching out for help because I'm trying to understand what could possibly be causing the SDK to work locally but not otherwise. Script (with changed password, hostname, and path) `from pprint import pprint import time import urllib3

import isi_sdk_8_2_2 from isi_sdk_8_2_2.rest import ApiException

urllib3.disable_warnings()

username = "password" password = "username"

configuration = isi_sdk_8_2_2.Configuration() configuration.host = 'https://hostname:8080' configuration.username = username configuration.password = password configuration.verify_ssl = False

api_instance = isi_sdk_8_2_2.NamespaceApi(isi_sdk_8_2_2.ApiClient(configuration))

directory_copy_target = 'directory_copy_target_example' # str | Directory copy destination relative to /. x_isi_ifs_copy_source = 'x_isi_ifs_copy_source_example' # str | Specifies the full path to the source directory. overwrite = True # bool | Deletes and replaces the existing user attributes and ACLs of the directory with user-specified attributes and ACLS from the header, when set to true. (optional) merge = True # bool | Specifies if the contents of a directory should be merged with an existing directory with the same name. (optional) _continue = True # bool | Specifies whether to continue the copy operation on remaining objects when there is a conflict or error. (optional)

directory_path = 'path' # str | Directory path relative to /.

try: api_response = api_instance.get_directory_contents(directory_path) print(api_response) except ApiException as e: print("Exception when calling NamespaceApi->get_directory_contents: %s\n" % e) `
Error (when ran on server): File "", line 50, in File "/usr/local/lib/python3.8/site-packages/isi_sdk_8_2_2/api/namespace_api.py", line 1422, in get_directory_contents (data) = self.get_directory_contents_with_http_info(directory_path, kwargs) # noqa: E501 File "/usr/local/lib/python3.8/site-packages/isi_sdk_8_2_2/api/namespace_api.py", line 1507, in get_directory_contents_with_http_info return self.api_client.call_api( File "/usr/local/lib/python3.8/site-packages/isi_sdk_8_2_2/api_client.py", line 341, in call_api return self.__call_api(resource_path, method, File "/usr/local/lib/python3.8/site-packages/isi_sdk_8_2_2/api_client.py", line 162, in __call_api self.update_params_for_auth( File "/usr/local/lib/python3.8/site-packages/isi_sdk_8_2_2/api_client.py", line 542, in update_params_for_auth response_data = self.rest_client.POST( File "/usr/local/lib/python3.8/site-packages/isi_sdk_8_2_2/rest.py", line 353, in POST return self.request("POST", url, File "/usr/local/lib/python3.8/site-packages/isi_sdk_8_2_2/rest.py", line 165, in request r = self._submit_requests( File "/usr/local/lib/python3.8/site-packages/isi_sdk_8_2_2/rest.py", line 307, in _submit_requests r = self.pool_manager.request(method, File "/usr/local/lib/python3.8/site-packages/urllib3/request.py", line 79, in request return self.request_encode_body( File "/usr/local/lib/python3.8/site-packages/urllib3/request.py", line 171, in request_encode_body return self.urlopen(method, url, extra_kw) File "/usr/local/lib/python3.8/site-packages/urllib3/poolmanager.py", line 330, in urlopen response = conn.urlopen(method, u.request_uri, **kw) File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 747, in urlopen return self.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 747, in urlopen return self.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 747, in urlopen return self.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 719, in urlopen retries = retries.increment( File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 436, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='prmwfp01', port=8080): Max retries exceeded with url: /session/1/session (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7ada289d60>: Failed to establish a new connection: [Errno -2] Name or service not known')) ] Stderr: 2020-12-07 13:52:28,801 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7ada289910>: Failed to establish a new connection: [Errno -2] Name or service not known')': /session/1/session 2020-12-07 13:52:28,808 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7ada289ac0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /session/1/session 2020-12-07 13:52:28,816 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7ada289c10>: Failed to establish a new connection: [Errno -2] Name or service not known')': /session/1/session (2604) (2603)

tucked commented 3 years ago

[Errno -2] Name or service not known

This suggests a DNS issue to me. That aligns with the symptoms you describe as the cluster is very likely to be able to resolve itself, whereas other servers may rely on environmental configuration.

Are you able to resolve prmwfp01 with dig or host on the server producing this error?

NICWELLER98 commented 3 years ago

Thank you for your response!! I ended up using both host and dig and found that for prmwfp01 neither produced a good result. I changed the host and ended up getting a response from dig and host which showed the IP address.

I still seem to be getting a connection error though.

Timeout Error: Docker code script failed due to timeout, consider changing timeout value for this automation, Stderr: 2020-12-04 19:19:49,708 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f93026a4910>: Failed to establish a new connection: [Errno 110] Connection timed out')': /session/1/session 2020-12-04 19:21:56,940 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f93026a4ac0>: Failed to establish a new connection: [Errno 110] Connection timed out')': /session/1/session (2604) (2603)

NICWELLER98 commented 3 years ago

I was able to figure out the other issues but I'm struggling to gain authorization. I'm just trying to run the getting started script and It seems to produce the response seen below. Any Ideas as to what might be causing this? Reason: Unauthorized HTTP response headers: HTTPHeaderDict({'Date': 'Wed, 09 Dec 2020 17:57:58 GMT', 'Server': 'Apache', 'X-Frame-Options': 'sameorigin', 'Strict-Transport-Security': 'max-age=31536000;', 'Content-Length': '49', 'Content-Type': 'application/json'}) HTTP response body: {"message":"Username or password is incorrect."}

tucked commented 3 years ago

Glad you were able to figure out the connection timeouts... Some things to try for the auth issue:

NICWELLER98 commented 3 years ago

Sorry I missed your response.

I'm still trying to work on through some issues with this. They are in the same System zone. I believe it has that privilege, but I'll double check that.

Here is the updated status for where I am currently at.

Code: (host, pass, username are all specified when I actually run it. Also I've tried a lot of different varients for path but they all seem to produce the same response shown below)

#from __future__ import print_function
import time
import isi_sdk_8_2_2
from isi_sdk_8_2_2.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basicAuth
configuration = isi_sdk_8_2_2.Configuration()
configuration.host = '*'
configuration.username = '*'
configuration.password = '*'
configuration.verify_ssl = False

# create an instance of the API class
api_instance = isi_sdk_8_2_2.NamespaceApi(isi_sdk_8_2_2.ApiClient(configuration))
directory_path = '/ifs' # str | Directory path relative to /.
detail = 'detail_example' # str | Specifies which object attributes are displayed. (optional)
limit = 56 # int | Specifies the maximum number of objects to send to the client. (optional)
resume = 'resume_example' # str | Specifies a token to return in the JSON result to indicate when there is a next page. (optional)
sort = 'sort_example' # str | Specifies one or more attributes to sort on the directory entries. (optional)
dir = 'dir_example' # str | Specifies the sort direction. This value can be either ascending (ASC) or descending (DESC). (optional)
type = 'type_example' # str | Specifies the object type to return, which can be one of the following values: container, object, pipe, character_device, block_device, symbolic_link, socket, or whiteout_file. (optional)
hidden = True # bool | Specifies if hidden objects are returned. (optional)

try:
    api_response = api_instance.get_directory_contents(directory_path)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling NamespaceApi->create_access_point: %s\n" % e)

The response:

Exception when calling NamespaceApi->create_access_point: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Date': 'Wed, 16 Dec 2020 18:19:14 GMT', 'Server': 'Apache', 'Allow': 'GET, PUT, POST, DELETE, HEAD', 'x-isi-ifs-spec-version': '1.0', 'X-Frame-Options': 'sameorigin', 'Strict-Transport-Security': 'max-age=31536000;', 'Content-Security-Policy': "default-src 'none'", 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json'})
HTTP response body:
{
"errors" :
[

{
"code" : "AEC_FORBIDDEN",
"message" : "Unable to open the store '' -- Is a directory."
}
]
}
tucked commented 3 years ago

Hey there, sorry for the confusion on that... The first element of directory_path is actually the namespace (which the Namespace API distinguishes from paths in that namepsace). Could you give this a try?

directory_path = "ifs/"
NICWELLER98 commented 3 years ago

Thank you for your help! I was able to get directory contents. Do you know what might be going wrong with copy_file

#from __future__ import print_function
import time
import isi_sdk_8_2_2
from isi_sdk_8_2_2.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basicAuth
configuration = isi_sdk_8_2_2.Configuration()
configuration.host = '*'
configuration.username = '*'
configuration.password = '*'
configuration.verify_ssl = False

# create an instance of the API class
api_instance = isi_sdk_8_2_2.NamespaceApi(isi_sdk_8_2_2.ApiClient(configuration))
file_copy_target = 'ifs/something/file1.txt' # str | File copy destination relative to /.
x_isi_ifs_copy_source = 'ifs/something/TEST_CV' # str | Specifies the full path to the source file.
clone = True # bool | You must set this parameter to true in order to clone a file. (optional)
snapshot = 'snapshot_example' # str | Specifies a snapshot name to clone the file from. (optional)
overwrite = True # bool | Specifies if an existing file should be overwritten by a new file with the same name. (optional)

try:
    api_response = api_instance.copy_file(file_copy_target, x_isi_ifs_copy_source)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling NamespaceApi->copy_file: %s\n" % e)

Response:

Exception when calling NamespaceApi->copy_file: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Date': 'Wed, 16 Dec 2020 20:10:02 GMT', 'Server': 'Apache', 'X-Frame-Options': 'sameorigin', 'Strict-Transport-Security': 'max-age=31536000;', 'Content-Length': '49', 'Content-Type': 'application/json'})
HTTP response body: {"message":"Username or password is incorrect."}
NICWELLER98 commented 3 years ago

Here is another update.

Can you offer an example for x_isi_ifs_copy_source? Thanks!

#from __future__ import print_function
import time
import isi_sdk_8_2_2
from isi_sdk_8_2_2.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basicAuth
configuration = isi_sdk_8_2_2.Configuration()
configuration.host = '*'
configuration.username = '*'
configuration.password = '*'
configuration.verify_ssl = False

# create an instance of the API class
api_instance = isi_sdk_8_2_2.NamespaceApi(isi_sdk_8_2_2.ApiClient(configuration))
file_copy_target = 'ifs/dest_something/TEST_CV' # str | File copy destination relative to /.
x_isi_ifs_copy_source = 'ifs/source_something/file1.txt' # str | Specifies the full path to the source file.
clone = False # bool | You must set this parameter to true in order to clone a file. (optional)
snapshot = 'snapshot_example' # str | Specifies a snapshot name to clone the file from. (optional)
overwrite = True # bool | Specifies if an existing file should be overwritten by a new file with the same name. (optional)

try:
    api_response = api_instance.copy_file(file_copy_target, x_isi_ifs_copy_source, clone=clone)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling NamespaceApi->copy_file: %s\n" % e)

Response:

Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 17 Dec 2020 16:34:26 GMT', 'Server': 'Apache', 'Allow': 'GET, PUT, POST, DELETE, HEAD', 'x-isi-ifs-spec-version': '1.0', 'X-Frame-Options': 'sameorigin', 'Strict-Transport-Security': 'max-age=31536000;', 'Content-Security-Policy': "default-src 'none'", 'Connection': 'close', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json'})
HTTP response body:
{
"errors" :
[

{
"code" : "AEC_BAD_REQUEST",
"message" : "x-isi-ifs-copy-source '/ifs/prmnas01/WFP/Test/file1.txt' is invalid."
}
]
}

I went and check to make sure that the file actually exists:

#from __future__ import print_function
import time
import isi_sdk_8_2_2
from isi_sdk_8_2_2.rest import ApiException
from pprint import pprint
import urllib3

# Configure HTTP basic authorization: basicAuth
configuration = isi_sdk_8_2_2.Configuration()
configuration.host = '*'
configuration.username = '*'
configuration.password = '*'
configuration.verify_ssl = False

# create an instance of the API class
api_instance = isi_sdk_8_2_2.NamespaceApi(isi_sdk_8_2_2.ApiClient(configuration))
directory_path = 'ifs/source_something' # str | Directory path relative to /.
detail = 'detail_example' # str | Specifies which object attributes are displayed. (optional)
limit = 56 # int | Specifies the maximum number of objects to send to the client. (optional)
resume = 'resume_example' # str | Specifies a token to return in the JSON result to indicate when there is a next page. (optional)
sort = 'sort_example' # str | Specifies one or more attributes to sort on the directory entries. (optional)
dir = 'dir_example' # str | Specifies the sort direction. This value can be either ascending (ASC) or descending (DESC). (optional)
type = 'type_example' # str | Specifies the object type to return, which can be one of the following values: container, object, pipe, character_device, block_device, symbolic_link, socket, or whiteout_file. (optional)
hidden = True # bool | Specifies if hidden objects are returned. (optional)

try:
    api_response = api_instance.get_directory_contents(directory_path)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling NamespaceApi->create_access_point: %s\n" % e)

Part of Response:

{'children': [{'access_time': None,
               'atime_val': None,
               'block_size': None,
               'blocks': None,
               'btime_val': None,
               'change_time': None,
               'container': None,
               'container_path': None,
               'create_time': None,
               'ctime_val': None,
               'gid': None,
               'group': None,
               'id': None,
               'is_hidden': None,
               'last_modified': None,
               'mode': None,
               'mtime_val': None,
               'name': 'file1.txt',
               'nlink': None,
               'owner': None,
               'size': None,
               'stub': None,
               'type': None,
               'uid': None},
nalinkanwar commented 1 year ago

Closing as inactive; Please open a separate issue if you still require help related to SDK.