summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2011-03-25 16:10:03 -0700
committerJesse Wolfe <jes5199@gmail.com>2011-03-25 16:10:03 -0700
commita2ac367c2bea2b94b88f739250edb828da0091d4 (patch)
treec8abe56ae0baf82ef51c5a27a3814bec42a8f890 /lib
parent0fec21fcd887685cf8421fdc309b878088f9fc48 (diff)
parent7c60db5d9db8eeda46f7041100759e69aed120a8 (diff)
downloadpuppet-a2ac367c2bea2b94b88f739250edb828da0091d4.tar.gz
puppet-a2ac367c2bea2b94b88f739250edb828da0091d4.tar.xz
puppet-a2ac367c2bea2b94b88f739250edb828da0091d4.zip
Merge branch 'ticket/2.6.next/5477' into 2.6.next
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/lexer.rb5
-rw-r--r--lib/puppet/parser/parser_support.rb1
-rw-r--r--lib/puppet/resource/type_collection.rb1
-rw-r--r--lib/puppet/simple_graph.rb2
-rwxr-xr-xlib/puppet/util/loadedfile.rb6
5 files changed, 5 insertions, 10 deletions
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index 9a25263f6..71d9440ff 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -312,7 +312,8 @@ class Puppet::Parser::Lexer
def file=(file)
@file = file
@line = 1
- @scanner = StringScanner.new(File.read(file))
+ contents = File.exists?(file) ? File.read(file) : ""
+ @scanner = StringScanner.new(contents)
end
def shift_token
@@ -547,7 +548,7 @@ class Puppet::Parser::Lexer
value,terminator = slurpstring('"$')
token_queue << [TOKENS[token_type[terminator]],preamble+value]
if terminator != '$' or @scanner.scan(/\{/)
- token_queue.shift
+ token_queue.shift
elsif var_name = @scanner.scan(%r{(\w*::)*\w+|[0-9]})
token_queue << [TOKENS[:VARIABLE],var_name]
tokenize_interpolated_string(DQ_continuation_token_types)
diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb
index 7a0aa2601..9e580efb2 100644
--- a/lib/puppet/parser/parser_support.rb
+++ b/lib/puppet/parser/parser_support.rb
@@ -88,7 +88,6 @@ class Puppet::Parser::Parser
unless file =~ /\.pp$/
file = file + ".pp"
end
- raise Puppet::Error, "Could not find file #{file}" unless FileTest.exist?(file)
end
raise Puppet::AlreadyImportedError, "Import loop detected" if known_resource_types.watching_file?(file)
diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb
index 277d37b18..347e1c0e0 100644
--- a/lib/puppet/resource/type_collection.rb
+++ b/lib/puppet/resource/type_collection.rb
@@ -162,7 +162,6 @@ class Puppet::Resource::TypeCollection
parser.string = code
else
file = Puppet.settings.value(:manifest, environment.to_s)
- return unless File.exist?(file)
parser.file = file
end
parser.parse
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index c5dac0f6c..c658b3b92 100644
--- a/lib/puppet/simple_graph.rb
+++ b/lib/puppet/simple_graph.rb
@@ -329,7 +329,7 @@ class Puppet::SimpleGraph
children = other.adjacent(container, :direction => :out)
# MQR TODO: Luke suggests that it should be possible to refactor the system so that
- # container nodes are retained, thus obviating the need for the whit.
+ # container nodes are retained, thus obviating the need for the whit.
children = [whit_class.new(:name => container.name, :catalog => other)] if children.empty?
# First create new edges for each of the :in edges
diff --git a/lib/puppet/util/loadedfile.rb b/lib/puppet/util/loadedfile.rb
index 735dba459..d2f5d0923 100755
--- a/lib/puppet/util/loadedfile.rb
+++ b/lib/puppet/util/loadedfile.rb
@@ -34,10 +34,6 @@ module Puppet
# Create the file. Must be passed the file path.
def initialize(file)
@file = file
- unless FileTest.exists?(@file)
- raise Puppet::NoSuchFile,
- "Can not use a non-existent file for parsing"
- end
@statted = 0
@stamp = nil
@tstamp = stamp
@@ -50,7 +46,7 @@ module Puppet
@statted = Time.now.to_i
begin
@stamp = File.stat(@file).ctime
- rescue Errno::ENOENT
+ rescue Errno::ENOENT, Errno::ENOTDIR
@stamp = Time.now
end
end