[1942] in Moira Commits

home help back first fref pref prev next nref lref last post

/svn/moira r4081 - trunk/moira/clients/moira

daemon@ATHENA.MIT.EDU (Jonathon Weiss)
Fri Jun 1 10:33:36 2012

Date: Fri, 1 Jun 2012 10:33:35 -0400
From: Jonathon Weiss <jweiss@MIT.EDU>
Message-Id: <201206011433.q51EXZfm026241@drugstore.mit.edu>
To: moira-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jweiss
Date: 2012-06-01 10:33:35 -0400 (Fri, 01 Jun 2012)
New Revision: 4081

Modified:
   trunk/moira/clients/moira/attach.c
Log:
adjust defaults when creating AFS lockers of type SITE.


Modified: trunk/moira/clients/moira/attach.c
===================================================================
--- trunk/moira/clients/moira/attach.c	2012-05-30 16:30:24 UTC (rev 4080)
+++ trunk/moira/clients/moira/attach.c	2012-06-01 14:33:35 UTC (rev 4081)
@@ -386,7 +386,7 @@
       if (!strcasecmp(info[FS_TYPE], "AFS"))
 	{
 	  char *path, *args[3], *p;
-	  int status, depth;
+	  int status, depth, fsltypelen, fsnamelen;
 	  if (GetTypeFromUser("Filesystem's lockertype", "lockertype",
 			      &info[FS_L_TYPE]) == SUB_ERROR)
 	    return NULL;
@@ -457,7 +457,19 @@
 		  sprintf(temp_buf, "/afs/%s/%s/%s", info[FS_MACHINE],
 			  lowercase(info[FS_L_TYPE]), info[FS_NAME]);
 		}
+	      /* If the lockername ends in ".lockertype" strip that.
+	       * eg.  the SITE locker "foo.site" becomes just "foo"
+	       */
+	      fsltypelen = strlen(info[FS_L_TYPE]);
+	      fsnamelen = strlen(temp_buf);
+	      p = (temp_buf + fsnamelen - fsltypelen);
+	      if (!strcasecmp(p, info[FS_L_TYPE]) && *(p-1) == '.')
+		*(p-1) = '\0';
 	      info[FS_PACK] = strdup(temp_buf);
+	      fsnamelen = strlen(info[FS_M_POINT]);
+	      p = (info[FS_M_POINT] + fsnamelen - fsltypelen);
+	      if (!strcasecmp(p, info[FS_L_TYPE]) && *(p-1) == '.')
+		*(p-1) = '\0';
 	    }
 	}
       if (GetValueFromUser("Filesystem's Pack Name", &info[FS_PACK]) ==


home help back first fref pref prev next nref lref last post