Commit 2baa2125 authored by Jérome Perrin's avatar Jérome Perrin

standalone: fix support of recursive slapos

When having more than one read_only_shared_part_list, the template was
first rendered with indentation and then dedented, but since dedent only
remove the common indentation, we ended up with slapos.cfg like this:

```
$ cat /data/slappart11_testnode/cqg/inst/test0-9/tmp/etc/slapos.cfg

            [slapos]
            software_root = /data/slappart11_testnode/cqg/inst/test0-9/tmp/soft
            instance_root = /data/slappart11_testnode/cqg/inst/test0-9/tmp/inst
            shared_part_list =
              /srv/slapgrid/slappart11/srv/shared
/srv/slapgrid/slappart11/srv/testnode/cqg/shared
              /data/slappart11_testnode/cqg/inst/test0-9/tmp/shared
            master_url = http://10.0.12.198:46312
            computer_id = local
            root_check = False
```

First dedent, then render the template to prevent this issue. Apply this to
other uses of textwrap.dedent for consistency.

/reviewed-on !140
parent 229dd31e
Pipeline #6265 passed with stage
in 0 seconds
...@@ -102,7 +102,7 @@ class SupervisorConfigWriter(ConfigWriter): ...@@ -102,7 +102,7 @@ class SupervisorConfigWriter(ConfigWriter):
stdout_logfile_maxbytes = 5MB stdout_logfile_maxbytes = 5MB
stdout_logfile_backups = 10 stdout_logfile_backups = 10
""".format(**locals())) """).format(**locals())
def _getSupervisorConfigParts(self): def _getSupervisorConfigParts(self):
"""Iterator on parts of formatted config. """Iterator on parts of formatted config.
...@@ -129,7 +129,7 @@ class SupervisorConfigWriter(ConfigWriter): ...@@ -129,7 +129,7 @@ class SupervisorConfigWriter(ConfigWriter):
startretries = 0 startretries = 0
startsecs = 0 startsecs = 0
redirect_stderr = true redirect_stderr = true
""".format(**locals())) """).format(**locals())
for program, program_config in standalone_slapos._slapos_commands.items(): for program, program_config in standalone_slapos._slapos_commands.items():
yield self._getProgramConfig( yield self._getProgramConfig(
...@@ -173,7 +173,7 @@ class SlapOSConfigWriter(ConfigWriter): ...@@ -173,7 +173,7 @@ class SlapOSConfigWriter(ConfigWriter):
host = {standalone_slapos._server_ip} host = {standalone_slapos._server_ip}
port = {standalone_slapos._server_port} port = {standalone_slapos._server_port}
database_uri = {standalone_slapos._proxy_database} database_uri = {standalone_slapos._proxy_database}
""".format(**locals()))) """).format(**locals()))
class SlapOSCommandWriter(ConfigWriter): class SlapOSCommandWriter(ConfigWriter):
...@@ -188,7 +188,7 @@ class SlapOSCommandWriter(ConfigWriter): ...@@ -188,7 +188,7 @@ class SlapOSCommandWriter(ConfigWriter):
SLAPOS_CONFIGURATION={self._standalone_slapos._slapos_config} \\ SLAPOS_CONFIGURATION={self._standalone_slapos._slapos_config} \\
SLAPOS_CLIENT_CONFIGURATION=$SLAPOS_CONFIGURATION \\ SLAPOS_CLIENT_CONFIGURATION=$SLAPOS_CONFIGURATION \\
exec slapos "$@" exec slapos "$@"
""".format(**locals()))) """).format(**locals()))
os.chmod(path, 0o755) os.chmod(path, 0o755)
......
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