]> andersk Git - moira.git/blobdiff - clients/moira/cluster.c
Support contact and account_number columns in subnet table.
[moira.git] / clients / moira / cluster.c
index d256cd2d96857aa9aee940883b54dbec0dffbc78..85b6c8f45ca24ed3f7ca41b11265a89877eb2edd 100644 (file)
@@ -191,6 +191,8 @@ static char **SetSubnetDefaults(char **info, char *name)
   info[SN_NAME] = strdup(name);
   info[SN_DESC] = strdup("");
   info[SN_STATUS] = strdup("1");
+  info[SN_CONTACT] = strdup(DEFAULT_NONE);
+  info[SN_ACCT_NUMBER] = strdup("");
   sprintf(buf, "%ld", ntohl(inet_addr("18.255.0.0")));
   info[SN_ADDRESS] = strdup(buf);
   sprintf(buf, "%ld", ntohl(inet_addr("255.255.0.0")));
@@ -286,6 +288,22 @@ static char *PrintMachInfo(char **info)
   Put_message(buf);
   sprintf(buf, MOD_FORMAT, info[M_MODBY], info[M_MODTIME], info[M_MODWITH]);
   Put_message(buf);
+  /* Do a get_subnet for the machine's subnet.  We need to know if it's
+   *  Private.
+   */
+  args[0] = info[M_SUBNET];
+  stat = do_mr_query("get_subnet", 1, args, StoreInfo, &elem);
+  if (stat)
+    com_err(program_name, stat, " looking up subnet info");
+  if (atoi(((char **)elem->q_data)[2]) == SNET_STATUS_PRIVATE)
+    {
+      Put_message("");
+      sprintf(buf, "Warning:  This host is on a private subnet.");
+      Put_message(buf);
+      sprintf(buf, "Billing information shown is superceded by billing information for the subnet.");
+      Put_message(buf);
+    }
+
   return info[M_NAME];
 }
 
@@ -392,6 +410,10 @@ static char *PrintSubnetInfo(char **info)
   Put_message(buf);
   sprintf(buf, "         Status:  %s", SubnetState(atoi(info[SN_STATUS])));
   Put_message(buf);
+  sprintf(buf, "        Contact:  %s", info[SN_CONTACT]);
+  Put_message(buf);
+  sprintf(buf, " Account Number:  %s", info[SN_ACCT_NUMBER]);
+  Put_message(buf);
   addr.s_addr = htonl(atoi(info[SN_ADDRESS]));
   mask.s_addr = htonl(atoi(info[SN_MASK]));
   low.s_addr = htonl(atoi(info[SN_LOW]));
@@ -711,6 +733,11 @@ char **AskMCDInfo(char **info, int type, Bool name)
          for (i = 0; i < 5; i++)
            Put_message(subnet_states[i]);
        }
+      if (GetValueFromUser("Network's contact", &info[SN_CONTACT]) == SUB_ERROR)
+       return NULL;
+      if (GetValueFromUser("Network's billing account number", 
+                          &info[SN_ACCT_NUMBER]) == SUB_ERROR)
+       return NULL;
       if (GetAddressFromUser("Network address", &info[SN_ADDRESS]) == SUB_ERROR)
        return NULL;
       if (GetAddressFromUser("Network mask", &info[SN_MASK]) == SUB_ERROR)
This page took 1.548032 seconds and 4 git commands to generate.