123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #
- # Cookbook Name:: sysrc
- # Provider:: default
- #
- # Copyright 2012, Douglas Thrift
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #
- require 'chef/mixin/shell_out'
- include Chef::Mixin::ShellOut
- def load_current_resource
- current_resource = Chef::Resource::Sysrc.new(new_resource.name)
- current_resource.sysrc_name(new_resource.sysrc_name)
- current_resource.file(new_resource.file)
- current_resource.jail(new_resource.jail)
- current_resource.root(new_resource.root)
- current_resource
- end
- action :create do
- end
- action :delete do
- end
- private
- def sysrc_command(resource, *args)
- command = ['sysrc']
- if resource.file
- files = resource.file.kind_of?(Array) ? resource.file : [resource.file]
- files.each {|file| command += ['-f', file]}
- end
- command += ['-j', resource.jail.to_s] if resource.jail
- command += ['-R', resource.root] if resource.root
- command + args
- end
|