[1977] in Moira Commits
/svn/moira r4116 - trunk/moira/clients/moira
daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Tue Jun 11 15:24:25 2013
Date: Tue, 11 Jun 2013 15:24:17 -0400
From: Garry Zacheiss <zacheiss@MIT.EDU>
Message-Id: <201306111924.r5BJOHhM018951@drugstore.mit.edu>
To: moira-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: zacheiss
Date: 2013-06-11 15:24:17 -0400 (Tue, 11 Jun 2013)
New Revision: 4116
Modified:
trunk/moira/clients/moira/attach.c
Log:
Generalize foo.lockertype logic so it applies to nfs lockers as well.
Modified: trunk/moira/clients/moira/attach.c
===================================================================
--- trunk/moira/clients/moira/attach.c 2013-06-10 13:47:42 UTC (rev 4115)
+++ trunk/moira/clients/moira/attach.c 2013-06-11 19:24:17 UTC (rev 4116)
@@ -57,7 +57,7 @@
#define DEFAULT_ACCESS ("w")
#define DEFAULT_COMMENTS DEFAULT_COMMENT
#define DEFAULT_OWNER (user)
-#define DEFAULT_OWNERS (user)
+#define DEFAULT_OWNERS ("wheel")
#define DEFAULT_CREATE DEFAULT_YES
#define DEFAULT_L_TYPE ("PROJECT")
#define DEFAULT_CELL ("athena.mit.edu")
@@ -383,13 +383,18 @@
}
if (!fsgroup)
{
+ char *p;
+ int fsltypelen, fsnamelen;
+
+ if (GetTypeFromUser("Filesystem's lockertype", "lockertype",
+ &info[FS_L_TYPE]) == SUB_ERROR)
+ return NULL;
+
if (!strcasecmp(info[FS_TYPE], "AFS"))
{
char *path, *args[3], *p;
- int status, depth, fsltypelen, fsnamelen;
- if (GetTypeFromUser("Filesystem's lockertype", "lockertype",
- &info[FS_L_TYPE]) == SUB_ERROR)
- return NULL;
+ int status, depth;
+
if (!name || newdefaults)
{
free(info[FS_PACK]);
@@ -457,21 +462,40 @@
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';
}
+
+ info[FS_PACK] = strdup(temp_buf);
+
+ }
+ else if (!strcasecmp(info[FS_TYPE], "NFS"))
+ {
+ char buf[BUFSIZ];
+
+ if (!strcasecmp(info[FS_L_TYPE], "SITE"))
+ {
+ sprintf(buf, "/site/%s", info[FS_NAME]);
+
+ free(info[FS_PACK]);
+ info[FS_PACK] = strdup(buf);
+
+ free(info[FS_M_POINT]);
+ info[FS_M_POINT] = strdup(buf);
+ }
}
+
+ /* 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(info[FS_PACK]);
+ p = (info[FS_PACK] + fsnamelen - fsltypelen);
+ if (!strcasecmp(p, info[FS_L_TYPE]) && *(p-1) == '.')
+ *(p-1) = '\0';
+ 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]) ==
SUB_ERROR)
return NULL;
@@ -496,12 +520,6 @@
if (GetYesNoValueFromUser("Propagate changes to fileserver",
&info[FS_CREATE]) == SUB_ERROR)
return NULL;
- if (strcasecmp(info[FS_TYPE], "AFS"))
- {
- if (GetTypeFromUser("Filesystem's lockertype", "lockertype",
- &info[FS_L_TYPE]) == SUB_ERROR)
- return NULL;
- }
FreeAndClear(&info[FS_MODTIME], TRUE);
FreeAndClear(&info[FS_MODBY], TRUE);