Exec module runs commands multiple times, ingoring the 'creates' value
Created by: wouterdb
Due to semantic changes in the reload mechanism and some the very old base classes used by exec, it now triggers reloads too often and incorrectly
This resource
postgresql_initdb_script = exec::Run(host=self.host,
creates="/var/lib/pgsql/10/data/pg_hba.conf",
command=exec::in_shell("sudo su -c '/usr/pgsql-10/bin/initdb /var/lib/pgsql/10/data' - postgres"),
requires=[install_postgresql_contrib_package, install_postgresql_package])
From the prostgresql module
Now fails on first deploy because:
- it executes
- then it executes the reload logic because it receives events from it's dependents
- this second execution ignores the 'creates', causing failure
Work around
- set reload to
/usr/bin/true
postgresql_initdb_script = exec::Run(host=self.host,
creates="/var/lib/pgsql/10/data/pg_hba.conf",
reload="/usr/bin/true", # fix for https://github.com/inmanta/exec/issues/185
command=exec::in_shell("sudo su -c '/usr/pgsql-10/bin/initdb /var/lib/pgsql/10/data' - postgres"),
requires=[install_postgresql_contrib_package, install_postgresql_package])
Edited by Bart Vanbrabant