在exec环境中设置的puppetvariables不能在课程的其他地方访问
我正在尝试使用基于检查的日志path来configuration日志configuration,以查看该日志文件是否存在。 但是,if语句总是返回true,即使我知道/var/log/hermes/hermes.log不存在。 我已经testing了exec {“service_log_check”onlyif正在工作,所以这与if语句有关。 我曾想过在每个exec中添加像environment => [“FOO = true”的内容,然后将if语句更改为if FOO == true,但似乎在exec环境中设置的variables只能在exec中访问,而不是整个类。 这让我疯狂!!! 我们正在使用木偶v3.7 class hermes :: fluentd($ service_name ='hermes',$ logs ='/ var / log / test / test.log'){ exec {"service_log_check": command => '/bin/true', onlyif => '/usr/bin/test -e /var/log/hermes/hermes.log', } exec {"service_log_json_check": command => '/bin/true', onlyif => '/usr/bin/test -e /var/log/hermes/hermes-json.log', } exec {"request_log_check": command => […]