/usr/lib/ruby/vendor_ruby/chef/resource/chef_container.rb is in ruby-cheffish 4.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | require 'cheffish'
require 'cheffish/base_resource'
require 'chef/chef_fs/data_handler/container_data_handler'
class Chef
class Resource
class ChefContainer < Cheffish::BaseResource
resource_name :chef_container
property :name, Cheffish::NAME_REGEX, name_property: true
action :create do
if !@current_exists
converge_by "create container #{new_resource.name} at #{rest.url}" do
rest.post("containers", normalize_for_post(new_json))
end
end
end
action :delete do
if @current_exists
converge_by "delete container #{new_resource.name} at #{rest.url}" do
rest.delete("containers/#{new_resource.name}")
end
end
end
action_class.class_eval do
def load_current_resource
begin
@current_exists = rest.get("containers/#{new_resource.name}")
rescue Net::HTTPServerException => e
if e.response.code == "404"
@current_exists = false
else
raise
end
end
end
def new_json
{}
end
def data_handler
Chef::ChefFS::DataHandler::ContainerDataHandler.new
end
def keys
{ 'containername' => :name, 'containerpath' => :name }
end
end
end
end
end
|