summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMal Graty <mal.graty@googlemail.com>2016-08-15 10:45:39 +0100
committerMal Graty <mal.graty@googlemail.com>2016-08-21 18:42:32 +0100
commita5e01ee189f010b5fdc4ae22c4ea1695031397d1 (patch)
tree733c24daacceec5e710a3eaa2336a43d07b6e4fe
parent251b953c4366e52ef7782aed9bdabb8c28a10f6f (diff)
downloadchef-a5e01ee189f010b5fdc4ae22c4ea1695031397d1.tar.gz
Verify systemd_unit file during create
-rw-r--r--lib/chef/provider/systemd_unit.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb
index b96a336765..5b558ba335 100644
--- a/lib/chef/provider/systemd_unit.rb
+++ b/lib/chef/provider/systemd_unit.rb
@@ -193,6 +193,7 @@ class Chef
f.group "root"
f.mode "0644"
f.content new_resource.to_ini
+ f.verify systemd_analyze_cmd if systemd_analyze_path
end.run_action(action)
end
@@ -233,6 +234,14 @@ class Chef
{}
end
end
+
+ def systemd_analyze_cmd
+ @systemd_analyze_cmd ||= "#{systemd_analyze_path} verify %{path}"
+ end
+
+ def systemd_analyze_path
+ @systemd_analyze_path ||= which("systemd-analyze")
+ end
end
end
end