@@ -63,11 +63,6 @@ def self.is_tasks_filename?(path)
63
63
end
64
64
65
65
def self . get_file_details ( path , mod )
66
- unless File . absolute_path ( path ) == File . path ( path )
67
- msg = _ ( "File pathnames cannot include relative paths" )
68
- raise InvalidMetadata . new ( msg , 'puppet.tasks/invalid-metadata' )
69
- end
70
-
71
66
# This gets the path from the starting point onward
72
67
# For files this should be the file subpath from the metadata
73
68
# For directories it should be the directory subpath plus whatever we globbed
@@ -90,17 +85,23 @@ def self.find_files(files, mod)
90
85
91
86
pup_module = Puppet ::Module . find ( module_name , env )
92
87
if pup_module . nil?
93
- raise Puppet ::Module ::MissingModule , _ ( "Module %{module_name} not found in environment %{environment_name}." ) %
94
- { module_name : pup_module . name , environment_name : env }
88
+ msg = _ ( "Could not find module %{module_name} containing task file %{filename}" %
89
+ { module_name : module_name , filename : endpath } )
90
+ raise InvalidMetadata . new ( msg , 'puppet.tasks/invalid-metadata' )
95
91
end
96
92
97
93
unless MOUNTS . include? mount
98
- msg = _ ( "Files must be saved in module directories that Puppet makes available via mount points: %{mounts}" %
94
+ msg = _ ( "Files must be saved in module directories that Puppet makes available via mount points: %{mounts}" %
99
95
{ mounts : MOUNTS . join ( ', ' ) } )
100
96
raise InvalidMetadata . new ( msg , 'puppet.tasks/invalid-metadata' )
101
97
end
102
98
103
99
path = File . join ( pup_module . path , mount , endpath )
100
+ unless File . absolute_path ( path ) == File . path ( path ) . chomp ( '/' )
101
+ msg = _ ( "File pathnames cannot include relative paths" )
102
+ raise InvalidMetadata . new ( msg , 'puppet.tasks/invalid-metadata' )
103
+ end
104
+
104
105
unless File . exist? ( path )
105
106
msg = _ ( "Could not find %{path} on disk" % { path : path } )
106
107
raise InvalidFile . new ( msg )
0 commit comments