2
# Created by Luke Kanies on 2007-10-16.
3
# Copyright (c) 2007. All rights reserved.
5
require 'puppet/indirector'
6
require 'puppet/file_serving'
7
require 'puppet/file_serving/file_base'
8
require 'puppet/file_serving/indirection_hooks'
10
# A class that handles retrieving file contents.
11
# It only reads the file when its content is specifically
13
class Puppet::FileServing::Content < Puppet::FileServing::FileBase
14
extend Puppet::Indirector
15
indirects :file_content, :extend => Puppet::FileServing::IndirectionHooks
19
# Read the content of our file in.
21
# This stat can raise an exception, too.
22
raise(ArgumentError, "Cannot read the contents of links unless following links") if stat().ftype == "symlink"
24
::File.read(full_path())
27
# Just return the file contents as the yaml. This allows us to
28
# avoid escaping or any such thing. LAK:NOTE Not really sure how
29
# this will behave if the file contains yaml... I think the far
30
# side needs to understand that it's a plain string.