Skip to content

Commit 09a380c

Browse files
committed
(MODULES-2023) - autorequire the file we are generating
concat_file generates a file resource which will manage the content, while the interface for requirements is Concat[] or at least Concat_file[]. The file is currently flowing within the graph without any dependency. However, so that require and notifies are working properly, the file must be present before the concat_file resource is finished being managed and potentially other resources depending on that one are being managed. This also makes the copy & paste from looking for the parent directory as originaly described within MODULES-2023 obsolete, as this will be handled by the file itself.
1 parent 8d7d427 commit 09a380c

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

lib/puppet/type/concat_file.rb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,9 @@ def exists?
8989
end.compact
9090
end
9191

92-
# Copied from puppet's file type
93-
# Autorequire the nearest ancestor directory found in the catalog.
92+
# Autorequire the file we are generating below
9493
autorequire(:file) do
95-
req = []
96-
path = Pathname.new(self[:path])
97-
if !path.root?
98-
# Start at our parent, to avoid autorequiring ourself
99-
parents = path.parent.enum_for(:ascend)
100-
if found = parents.find { |p| catalog.resource(:file, p.to_s) }
101-
req << found.to_s
102-
end
103-
end
104-
105-
req
94+
[self[:path]]
10695
end
10796

10897
def should_content

0 commit comments

Comments
 (0)