Move Mysql-fixperms into slave
[hcoop/domtool2.git] / src / main.sml
index cf53af0..2800cbd 100644 (file)
@@ -735,7 +735,9 @@ fun requestSmtpLog domain =
 
 fun requestMysqlFixperms () =
     let
 
 fun requestMysqlFixperms () =
     let
-       val (_, bio) = requestBio (fn () => ())
+       val (_, context) = requestContext (fn () => ())
+       val bio = OpenSSL.connect true (context,
+                                       Config.Dbms.dbmsNode ^ ":" ^ Int.toString Config.slavePort)
     in
        Msg.send (bio, MsgMysqlFixperms);
        case Msg.recv bio of
     in
        Msg.send (bio, MsgMysqlFixperms);
        case Msg.recv bio of
@@ -1505,18 +1507,6 @@ fun service () =
                                                 (describeQuery q,
                                                  NONE)))
                                      (fn () => ())
                                                 (describeQuery q,
                                                  NONE)))
                                      (fn () => ())
-
-                              | MsgMysqlFixperms =>
-                                (print "Starting mysql-fixperms\n";
-                                 doIt (fn () => if OS.Process.isSuccess
-                                                       (OS.Process.system "/usr/bin/sudo -H /afs/hcoop.net/common/etc/scripts/mysql-grant-table-drop") then
-                                                    ("Requested mysql-fixperms",
-                                                     NONE)
-                                                else
-                                                    ("Requested mysql-fixperms, but execution failed!",
-                                                     SOME "Script execution failed."))
-                                      (fn () => ()))
-
                               | MsgDescribe dom =>
                                 doIt (fn () => if not (Domain.validDomain dom) then
                                                    ("Requested description of invalid domain " ^ dom,
                               | MsgDescribe dom =>
                                 doIt (fn () => if not (Domain.validDomain dom) then
                                                    ("Requested description of invalid domain " ^ dom,
@@ -1745,6 +1735,17 @@ fun slave () =
                                                  ("Invalid database name " ^ user ^ "_" ^ dbname,
                                                   SOME ("Invalid database name " ^ dbname)))
                                          (fn () => ())
                                                  ("Invalid database name " ^ user ^ "_" ^ dbname,
                                                   SOME ("Invalid database name " ^ dbname)))
                                          (fn () => ())
+                                  | MsgMysqlFixperms =>
+                                    (print "Starting mysql-fixperms\n";
+                                     doIt (fn () => if OS.Process.isSuccess
+                                                           (OS.Process.system "/usr/bin/sudo -H /afs/hcoop.net/common/etc/scripts/mysql-grant-table-drop") then
+                                                        ("Requested mysql-fixperms",
+                                                         NONE)
+                                                    else
+                                                        ("Requested mysql-fixperms, but execution failed!",
+                                                         SOME "Script execution failed."))
+                                          (fn () => ()))
+
                                   | _ => (OpenSSL.close bio;
                                           loop ())
                         end
                                   | _ => (OpenSSL.close bio;
                                           loop ())
                         end