@@ -80,30 +80,8 @@ def get_resource(self, filename):
8080
8181 return []
8282
83- def install_file_stub (self , target ):
84- """
85- Installs any data associated with the resource object that is going to be deployed from the **ecFlow** server.
86-
87- Parameters:
88- target(Deployment): The target deployment where the resource data should be installed.
89- """
90-
91- """
92- n.b. If a resource does not need to save data at deployment time, it should not do so (e.g. WebResource)
93- """
94- # Install path is for the suite, so we don't need to include the suite name
95- assert self .fullname .count ("/" ) > 1
96- subpath = self .fullname [self .fullname .find ("/" , 1 ) + 1 :]
97-
98- self ._server_filename = os .path .join (
99- target .files_install_path (), subpath , self .name
100- )
101-
102- super ().install_file_stub (target )
10383
104- self .save_data (target , self ._server_filename )
105-
106- def build_script (self ):
84+ def generate_script (self ):
10785 """
10886 Returns the installer script for the data resource.
10987
@@ -128,7 +106,7 @@ def build_script(self):
128106 for h in self ._hosts :
129107 lines += h .copy_file_to (self ._server_filename , self .location ()).split ("\n " )
130108
131- return lines
109+ return lines , []
132110
133111 def location (self ):
134112 """
@@ -141,6 +119,7 @@ def location(self):
141119 return os .path .join (self ._resource_directory , self .name )
142120
143121
122+
144123class DataResource (Resource ):
145124 """
146125 Provides a data resource to be deployed at suite generation time.
@@ -206,9 +185,8 @@ class FileResource(Resource):
206185 """
207186
208187 def __init__ (self , name , hosts , source_file ):
209- self ._source = source_file
210-
211188 super ().__init__ (name , hosts )
189+ self ._server_filename = source_file
212190
213191 def md5 (self ):
214192 """
@@ -219,19 +197,22 @@ def md5(self):
219197 """
220198
221199 m = hashlib .md5 ()
222- m .update (self .data () )
200+ m .update (self ._data )
223201 return m .hexdigest ()
224202
225- def data (self ):
203+ def get_resource (self , filename ):
226204 """
227205 Returns the resource data from the provided file.
228206
229207 Returns:
230208 The resource data.
231209 """
232210
233- with open (self ._source , "rb" ) as f :
234- return f .read ()
211+ with open (filename , "rb" ) as f :
212+ return [
213+ 'mkdir -p $(dirname "{}")' .format (filename ),
214+ f .read ()
215+ ]
235216
236217 def save_data (self , target , filename ):
237218 """
0 commit comments