Class Chef::FileCache
In: lib/chef/file_cache.rb
Parent: Object

Methods

create_cache_path   delete   find   has_key?   list   load   move_to   store  

Included Modules

Chef::Mixin::ParamsValidate Chef::Mixin::CreatePath

Public Class methods

Create a full path to a given file in the cache. By default, also creates the path if it does not exist.

Parameters

path:The path to create, relative to file_cache_path
create_if_missing:True by default - whether to create the path if it does not exist

Returns

String:The fully expanded path

Delete a file from the File Cache

Parameters

path<String>:The path to the file you want to delete - should
  be relative to file_cache_path

Returns

true

Find files in the cache by glob_pattern

Returns

String
- An array of file cache keys matching the glob

Whether or not this file exists in the Cache

Parameters

path:The path to the file you want to check - is relative
  to file_cache_path

Returns

True:If the file exists
False:If it does not

List all the files in the Cache

Returns

Array:An array of files in the cache, suitable for use with load, delete and store

Read a file from the File Cache

Parameters

path<String>:The path to the file you want to load - should
  be relative to file_cache_path
read<True/False>:Whether to return the file contents, or the path.
  Defaults to true.

Returns

String:A string with the file contents, or the path to the file.

Raises

Chef::Exceptions::FileNotFound:If it cannot find the file in the cache

Move a file into the cache. Useful with the REST raw file output.

Parameters

file<String>:The path to the file you want in the cache
path<String>:The relative name you want the new file to use

Write a file to the File Cache.

Parameters

path<String>:The path to the file you want to put in the cache - should
  be relative to file_cache_path
contents<String>:A string with the contents you want written to the file

Returns

true

[Validate]