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
fs rename
command for modifying template values
#2743
Conversation
In order for an admin user to be able to move files server-side, RawAccessRequest needed to add a `mv` operation. In addition, CheckedPath objects need to expose renameTo and moveToDir methods.
In order to produce a lambda which takes just an ID, a default can now be passed to proxy_to_instance which will then be used if the proxy string does not contain the "Class:" prefix as otherwise required.
Now `rename Fileset:ID` will rename the OriginalFile.path fields of a Fileset to match the current template. This is restricted to the owner of the Fileset for the moment.
* print out all paths to be moved * save fileset change in the same transaction
In order to write the integration tests, we need to have context objects passed everywhere. This will also be of use when an admin wants to rename a fileset for a user.
A few comments from a brief run through:
A couple of these are clearly idiot-cases but are perhaps easily possible if using shell history laxly. Is there any way to recover other than trawling through history to work out what happened? |
Incidentally, also tested with a change to config:
where the dislocation of the logfile is more immediately apparent |
NB: I'll add in a move of the log file as well, but I do start to fear what's going to happen when we allow adding random data into these directories! |
What would you expect to happen?
Ditto. |
|
What is the rationale for a non-admin user to use this command? What is the rationale for not enforcing the move by default? |
For a user with in-place access, it could be useful; for anyone else, it's mostly dangerous. Having it The reason for not doing the move by default was mostly not really trusting the code. Error conditions like "move fails in the middle" aren't handled (nor are they easily testable!), whereas a sysadmin would know how to handle move errors on the command-line. Happy to swap the defaults; just trying to be careful at the last minute. /cc @kennethgillen |
`fs rename` followed by `fs sets --check` (without a move inbetween) was leading to a `CmdError` being printed before this change.
👍 for @joshmoore's |
@ximenesuk : urgh. Looking at the log files makes this all quite unseemly. Perhaps a chat tomorrow? |
@joshmoore Yes, for a chat. |
In preparation for also specifying a tomove for the log file, we need to specify where the file should be moved *to*, since the log file is a directory up from the actual fileset.
Log file move pushed. Looking at one example:
|
Looks good. Moves logfiles or asks for them to be moved. Fileset check works okay:
The first error here was a And non-admin users get a senible reply to admin options:
Any further commits to come or aspects that need reviewing? |
Probably just a decision about who is permitted and what are the defaults a la #2743 (comment) Post-lunch chat? |
Thoughts on talking to @ximenesuk:
|
In order to move the top level directory, first it was necessary to check that the empty directory would be removed from disk.
There are a number of error conditions where neither the handle nor the callback object from client.submit() will be returned to the user. Since the exceptions do not include the objects and it was not a part of the "API" to require a `close()` we will make a best effort at cleaning up resources when an exception occurs.
Previous changes to waitOnCmd and submit in BaseClient broke backwards-compatibility since the handle which was returned could possibly be closed. Now, close is called on the handle instance by default only if the invoker is `client.submit()` since in that case, the consumer has never held a reference to the handle proxy.
The addition of a new annotation with a different namespace was causing filesets to no longer be shown by `bin/omero fs sets`
Ready for re-review. (Move is now by default) |
@@ -652,8 +652,8 @@ def testCmdDeleteCantDeleteDirectories(self): | |||
gateway = BlitzGateway(client_obj=self.client) | |||
handle = gateway.deleteObjects("/OriginalFile", [id]) | |||
try: | |||
pytest.raises(Exception, | |||
gateway._waitOnCmd, handle, failonerror=True) | |||
with pytest.raises(CmdError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing from omero import CmdError
.
I will try to flake8 the remaining integration tests in between RCs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed
It all functions as expected with these revisions. With the final commit merged in all the modified and added tests pass. |
Waiting on travis to be green and then will merge. |
`fs rename` command for modifying template values
--rebased-to #2805 |
When the FS template is changed (for example to make use of the new features in #2701), sysadmins may want to rearrange their old data to match the new template. The
bin/omero fs rename Fileset:ID
command now does that.Testing as a regular user:
inplace_user
) outside of OMERO.Testing as admin:
--move
is passed, then the files should be moved "server-side" with no user interaction.