Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using FileInfo does not work. #45

Closed
brussell4 opened this issue Sep 25, 2023 · 3 comments
Closed

Using FileInfo does not work. #45

brussell4 opened this issue Sep 25, 2023 · 3 comments
Labels
question Further information is requested

Comments

@brussell4
Copy link

SCENARIO

Move a file from /alice/bob/bb.txt to /alice/bob/charlie/bb.txt using FileInfo

Docs and file_info.py line 972-985 suggest to rename a file as follows:

from netapp_ontap.host_connection import HostConnection
from netapp_ontap.resources import FileInfo

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = FileInfo(
        "7da9eb81-6daa-4323-9eab-7bbce73da0f2", path="alice/bob/bb.txt"
    )
    resource.path = "alice/bob/charlie.txt"
    resource.patch()

EXPECTED BEHAVIOUR

File is renamed/ moved.

OBSERVED BEHAVIOUR

Caused by HTTPError('500 Server Error: Internal Server Error for url: https://server.domain:443/api/storage/volumes/7da9eb81-6daa-4323-9eab-7bbce73da0f2/files/%2Falice%2Fbob'): Failed to rename "/alice/bob" to 
"/alice/bob/charlie". Reason: Invalid argument

The library correctly identifies the change in path and forms the correct body for the patch but fails to append the file name to the URL. Resulting a REST call attempting to rename the parent directory of the file to the new filename and HTTP500 error.

ENVIRONMENT

netapp-ontap 9.13.1.0
Python 3.11.2

@github-actions
Copy link

Thank you for reporting an issue! If you haven't already joined our Discord community,
then we invite you to do so. This is a great place to get help and ask questions from our community.

@noorbuchi
Copy link
Contributor

Hello,

It would be very helpful to know what the requests and responses from your example look like. Can you please enabled debug logging and share the output. You can do that by including this in your script:

import logging
from netapp_ontap import config, utils
utils.LOG_ALL_API_CALLS = 1
utils.DEBUG = 1
logging.basicConfig(level=logging.DEBUG)

-Noor

@noorbuchi noorbuchi added the question Further information is requested label Sep 25, 2023
@brussell4
Copy link
Author

Thanks @noorbuchi. I don't know what changed, apart from me taking a day leave but it seems to be working now... Will close the issue. I thought it may have been to do with leading / on source or destination but no. Perplexed but happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants