Nimbus user tools can fail when var/ and services/ are on different partitions #65

Closed
labisso opened this Issue Jul 5, 2011 · 0 comments

Projects

None yet

2 participants

@labisso
Member
labisso commented Jul 5, 2011

One known instance of this is in nimbus-edit-user when the gridmap file is edited. It first creates a modified copy of the gridmap in a tempfile (in $NIMBUS_HOME/var/) then deletes the existing file and uses os.rename() to move the new one in place. This fails if the source and destination are not on the same partition:

WARNING! user not found in /O=Auto/OU=FermiCloudNimbus/CN=yocum@fnal.gov
Traceback (most recent call last):
 File "/opt/nimbus/libexec/nimbus_edit_user.py", line 251, in <module>
   rc = main()
 File "/opt/nimbus/libexec/nimbus_edit_user.py", line 242, in main
   edit_user(o, db)
 File "/opt/nimbus/libexec/nimbus_edit_user.py", line 219, in edit_user
   remove_gridmap(old_dn)
 File "/opt/nimbus/libexec/nimbus_edit_user.py", line 144, in remove_gridmap
   os.rename(new_name, gmf)
OSError: [Errno 18] Invalid cross-device link

More importantly, this failure leaves the installation without a gridmap. Because there could be other failures, we should avoid deleting the gridmap and instead move the modified copy over top of it. I think shutil.move() will accomplish this (as well as allow cross-partition move).

I expect the same bug is in the other user tools as they also edit a gridmap. We should also check the group-authz file writing for this bug.

@buzztroll buzztroll added a commit that referenced this issue Jul 12, 2011
@buzztroll buzztroll patch for GH-65 374bb2e
@buzztroll buzztroll closed this Jul 13, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment