Make copying of SSL certs conditional

If the certs exist, they are not copied. This makes testing slightly
faster.
This commit is contained in:
Markus Mäkelä 2018-10-05 10:49:21 +03:00
parent 8029bdff4f
commit fed5037081
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -695,39 +695,33 @@ void TestConnections::init_maxscale(int m)
const char* template_name = get_template_name(test_name);
process_template(m, template_name, maxscales->access_homedir[m]);
maxscales->ssh_node_f(m,
true,
"rm -rf %s/certs;mkdir -m a+wrx %s/certs;",
maxscales->access_homedir[m],
maxscales->access_homedir[m]);
char str[4096];
char dtr[4096];
sprintf(str, "%s/ssl-cert/*", test_dir);
sprintf(dtr, "%s/certs/", maxscales->access_homedir[m]);
maxscales->copy_to_node_legacy(str, dtr, m);
sprintf(str, "cp %s/ssl-cert/* .", test_dir);
system(str);
if (maxscales->ssh_node_f(m, true, "test -d %s/certs", maxscales->access_homedir[m]))
{
tprintf("SSL certificates not found, copying to maxscale");
maxscales->ssh_node_f(m,
true,
"rm -rf %s/certs;mkdir -m a+wrx %s/certs;",
maxscales->access_homedir[m],
maxscales->access_homedir[m]);
char str[4096];
char dtr[4096];
sprintf(str, "%s/ssl-cert/*", test_dir);
sprintf(dtr, "%s/certs/", maxscales->access_homedir[m]);
maxscales->copy_to_node_legacy(str, dtr, m);
sprintf(str, "cp %s/ssl-cert/* .", test_dir);
system(str);
maxscales->ssh_node_f(m, true, "chmod -R a+rx %s;", maxscales->access_homedir[m]);
}
maxscales->ssh_node_f(m,
true,
"chown maxscale:maxscale -R %s/certs;"
"chmod 664 %s/certs/*.pem;"
"chmod a+x %s;"
"%s"
"iptables -F INPUT;"
"rm -f %s/maxscale.log;"
"rm -f %s/maxscale1.log;"
"rm -rf /tmp/core* /dev/shm/* /var/lib/maxscale/maxscale.cnf.d/ /var/lib/maxscale/*;"
"rm -rf %s/*.log /tmp/core* /dev/shm/* /var/lib/maxscale/maxscale.cnf.d/ /var/lib/maxscale/*;"
"%s",
maxscales->access_homedir[m],
maxscales->access_homedir[m],
maxscales->access_homedir[m],
maxscale::start ? "killall -9 maxscale;" : "",
maxscales->maxscale_log_dir[m],
maxscales->maxscale_log_dir[m],
maxscale::start ? "service maxscale restart" : "");
fflush(stdout);
maxscale::start ? "service maxscale start;" : "");
if (maxscale::start)
{