Commit 220411a0 authored by Alain Takoudjou's avatar Alain Takoudjou

slaprunner: do not try to chdir if not a directory while building exclude list

If instance/slappartXX is not a folder but file, skip chdir else import/export fail with a message like:

    /srv/slapgrid/slappart18/bin/runner-exporter run at : Thu Oct  4 04:30:03 CEST 2018
    Traceback (most recent call last):
      File "<stdin>", line 17, in <module>
    OSError: [Errno 20] Not a directory: '/srv/slapgrid/slappart18/srv//runner/instance/slappart5-mariadb.dump.sql.gz'
parent a7cbd5c5
...@@ -22,7 +22,7 @@ md5sum = e12255a8c946b3eb8c6373fff481339f ...@@ -22,7 +22,7 @@ md5sum = e12255a8c946b3eb8c6373fff481339f
[template-runner-import-script] [template-runner-import-script]
filename = template/runner-import.sh.jinja2 filename = template/runner-import.sh.jinja2
md5sum = 92ac3f6982dec97e3b2df90f97111bd3 md5sum = bdfcf6edc20cc9f390b3e34e2531377b
[instance-runner-import] [instance-runner-import]
filename = instance-runner-import.cfg.in filename = instance-runner-import.cfg.in
...@@ -30,7 +30,7 @@ md5sum = 7a879739afe55320ee96409bcc8a52ab ...@@ -30,7 +30,7 @@ md5sum = 7a879739afe55320ee96409bcc8a52ab
[template-runner-export-script] [template-runner-export-script]
filename = template/runner-export.sh.jinja2 filename = template/runner-export.sh.jinja2
md5sum = d9b110db2a35c88c9eb8f87c2d2cad21 md5sum = be47acbe610305982168cff6a9eeb9ec
[instance-runner-export] [instance-runner-export]
filename = instance-runner-export.cfg.in filename = instance-runner-export.cfg.in
......
...@@ -56,7 +56,12 @@ if 1: ...@@ -56,7 +56,12 @@ if 1:
print("*.pid") print("*.pid")
print(".installed*.cfg") print(".installed*.cfg")
for partition in glob.glob(path + "/instance/slappart*"): for partition in glob.glob(path + "/instance/slappart*"):
try:
os.chdir(partition) os.chdir(partition)
except OSError as e:
if e.errno != errno.ENOTDIR:
raise
continue
try: try:
with open("srv/exporter.exclude") as f: with open("srv/exporter.exclude") as f:
exclude = f.readlines() exclude = f.readlines()
......
...@@ -69,7 +69,12 @@ if 1: ...@@ -69,7 +69,12 @@ if 1:
print("*.pid") print("*.pid")
print(".installed*.cfg") print(".installed*.cfg")
for partition in glob.glob(path + "/instance/slappart*"): for partition in glob.glob(path + "/instance/slappart*"):
try:
os.chdir(partition) os.chdir(partition)
except OSError as e:
if e.errno != errno.ENOTDIR:
raise
continue
try: try:
with open("srv/exporter.exclude") as f: with open("srv/exporter.exclude") as f:
exclude = f.readlines() exclude = f.readlines()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment