2 # Cookbook Name:: systemd
3 # Resource:: systemd_path
5 # Copyright 2017, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 default_action :create
22 property :path, String, :name_property => true
23 property :description, String, :required => true
24 property :after, [String, Array]
25 property :wants, [String, Array]
26 property :path_exists, [String, Array]
27 property :path_exists_glob, [String, Array]
28 property :path_changed, [String, Array]
29 property :path_modified, [String, Array]
30 property :directory_not_empty, [String, Array]
31 property :unit, String
32 property :make_directory, [TrueClass, FalseClass]
33 property :directory_mode, Integer
36 path_variables = new_resource.to_hash
38 template "/etc/systemd/system/#{new_resource.path}.path" do
44 variables path_variables
47 execute "systemctl-reload-#{new_resource.path}.path" do
49 command "systemctl daemon-reload"
52 subscribes :run, "template[/etc/systemd/system/#{new_resource.path}.path]"
57 file "/etc/systemd/system/#{new_resource.path}.path" do
61 execute "systemctl-reload-#{new_resource.path}.path" do
63 command "systemctl daemon-reload"
66 subscribes :run, "file[/etc/systemd/system/#{new_resource.path}.path]"