]> andersk Git - moira.git/blobdiff - clients/stella/stella.c
If get_host returns MR_NO_MATCH, check host aliases. Fixes the common
[moira.git] / clients / stella / stella.c
index 1df37978c1dd23eb19322170fccf8cdc8367b787..7011e4300f23e54ff98e104ac198e76544e6c084 100644 (file)
@@ -243,7 +243,7 @@ int main(int argc, char **argv)
            } else
              usage(argv);
          }
-         else if (argis("a", "aliasadd")) {
+         else if (argis("a", "addalias")) {
            if (arg - argv < argc - 1) {
              arg++;
              alias_add_queue=add_to_string_list(alias_add_queue, *arg);
@@ -251,7 +251,7 @@ int main(int argc, char **argv)
              usage(argv);
            update_alias_flag++;
          }
-         else if (argis("d", "aliasdelete")) {
+         else if (argis("d", "deletealias")) {
            if (arg - argv < argc - 1) {
              arg++;
              alias_remove_queue=add_to_string_list(alias_remove_queue, *arg);
@@ -423,6 +423,8 @@ int main(int argc, char **argv)
              status = mrcl_validate_kerberos_member(argv[13], &argv[13]);
              if (mrcl_get_message())
                mrcl_com_err(whoami);
+             if (status == MRCL_REJECT)
+               exit(1);
              status = wrap_mr_query("add_host", 16, argv, NULL, NULL);
              break;
 
@@ -530,6 +532,8 @@ int main(int argc, char **argv)
              status = mrcl_validate_kerberos_member(argv[14], &argv[14]);
              if (mrcl_get_message())
                mrcl_com_err(whoami);
+             if (status == MRCL_REJECT)
+               exit(1);
              status = wrap_mr_query("update_host", 17, argv, NULL, NULL);
              break;
 
@@ -682,10 +686,21 @@ int main(int argc, char **argv)
     args[0] = canonicalize_hostname(strdup(hostname));
     args[1] = args[2] = args[3] = "*";
     status = wrap_mr_query("get_host", 4, args, store_host_info, argv);
+
+    /* We might be looking for an alias of a deleted host. */
+    if (status && status == MR_NO_MATCH) {
+      status = wrap_mr_query("get_hostalias", 2, args, store_host_info, argv);
+      if (!status) {
+       args[0] = strdup(argv[1]);
+       status = wrap_mr_query("get_host", 4, args, store_host_info, argv);
+      }
+    }
+
     if (status) {
       com_err(whoami, status, "while getting host information");
       exit(1);
     }
+
     if (unformatted_flag)
       show_host_info_unformatted(argv);
     else
@@ -694,10 +709,12 @@ int main(int argc, char **argv)
     status = wrap_mr_query("get_subnet", 1, args, store_host_info, argv);
     if (status)
       com_err(whoami, status, "while getting subnet information");
-    if (atoi(argv[SN_STATUS]) == SNET_STATUS_PRIVATE)
+    if (atoi(argv[SN_STATUS]) == SNET_STATUS_PRIVATE_10MBPS ||
+       atoi(argv[SN_STATUS]) == SNET_STATUS_PRIVATE_100MBPS ||
+       atoi(argv[SN_STATUS]) == SNET_STATUS_PRIVATE_1000MBPS)
       {
        fprintf(stderr, "\nWarning:  This host is on a private subnet.\n");
-       fprintf(stderr, "Billing information shown is superceded by billing information for the subnet.\n");
+       fprintf(stderr, "Billing information shown is superseded by billing information for the subnet.\n");
       }
   }
 
@@ -910,6 +927,7 @@ void show_host_info_unformatted(char **argv)
   printf("Location:         %s\n", argv[M_LOC]);
   printf("Contact:          %s\n", argv[M_CONTACT]);
   printf("Billing Contact:  %s\n", argv[M_BILL_CONTACT]);
+  printf("Account Number:   %s\n", argv[M_ACCT_NUMBER]);
   printf("Opt:              %s\n", argv[M_USE]);
   printf("Adm cmt:          %s\n", argv[M_ACOMMENT]);
   printf("Op cmt:           %s\n", argv[M_OCOMMENT]);
This page took 0.033018 seconds and 4 git commands to generate.