summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2016-08-23 18:58:57 +0100
committerGitHub <noreply@github.com>2016-08-23 18:58:57 +0100
commitc1b5fd3537383fd05e139878487cbc251ed9f742 (patch)
tree35bfc59bd838effc82a9eb7a37a6a7cf2b0da3bc
parent0a82ddc4700bee73cf393e1b4a3ea5081a136144 (diff)
parenta5e01ee189f010b5fdc4ae22c4ea1695031397d1 (diff)
downloadchef-c1b5fd3537383fd05e139878487cbc251ed9f742.tar.gz
Merge pull request #5210 from mal/systemd-unit-verify
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