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 # https://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.
 
  22 default_action :create
 
  24 property :path, String, :name_property => true
 
  25 property :description, String, :required => [:create]
 
  26 property :after, [String, Array]
 
  27 property :wants, [String, Array]
 
  28 property :path_exists, [String, Array]
 
  29 property :path_exists_glob, [String, Array]
 
  30 property :path_changed, [String, Array]
 
  31 property :path_modified, [String, Array]
 
  32 property :directory_not_empty, [String, Array]
 
  33 property :unit, String
 
  34 property :make_directory, [true, false]
 
  35 property :directory_mode, Integer
 
  38   path_variables = new_resource.to_hash
 
  40   template "/etc/systemd/system/#{new_resource.path}.path" do
 
  46     variables path_variables
 
  49   execute "systemctl-reload-#{new_resource.path}.path" do
 
  51     command "systemctl daemon-reload"
 
  54     subscribes :run, "template[/etc/systemd/system/#{new_resource.path}.path]"
 
  59   file "/etc/systemd/system/#{new_resource.path}.path" do
 
  63   execute "systemctl-reload-#{new_resource.path}.path" do
 
  65     command "systemctl daemon-reload"
 
  68     subscribes :run, "file[/etc/systemd/system/#{new_resource.path}.path]"