@@ -237,21 +237,21 @@ impl<'a> VolumeApi<'a> {
237237 pub async fn populate_volume (
238238 & self ,
239239 target_dir : TargetDir ,
240- xxx : VolumeFilesSpec ,
240+ volume_file : VolumeFilesSpec ,
241241 uid : Option < & str > ,
242242 ) -> Result < ( ) , AnyError > {
243243 self . ensure_file (
244- xxx . volume_name . as_str ( ) ,
244+ volume_file . volume_name . as_str ( ) ,
245245 target_dir. as_str ( ) ,
246- & xxx . clone ( )
246+ & volume_file . clone ( )
247247 . files
248248 . into_iter ( )
249249 . map ( |file| RoozVolumeFile {
250250 file_path : file. target_file . as_str ( ) . to_string ( ) ,
251251 data : file. content ,
252252 } )
253253 . collect :: < Vec < _ > > ( ) ,
254- Self :: mount ( & target_dir, & xxx ) ,
254+ Self :: mount ( & target_dir, & volume_file ) ,
255255 uid,
256256 )
257257 . await
@@ -373,20 +373,21 @@ impl<'a> VolumeApi<'a> {
373373 async fn ensure_file (
374374 & self ,
375375 volume_name : & str ,
376- path : & str ,
376+ parent_dir : & str ,
377377 files : & Vec < RoozVolumeFile > ,
378378 mount : Mount ,
379379 uid : Option < & str > ,
380380 ) -> Result < ( ) , AnyError > {
381381 let mut cmd = files
382382 . iter ( )
383383 . map ( |f| {
384- let p = Path :: new ( path )
384+ let p = Path :: new ( parent_dir )
385385 . join ( & f. file_path )
386386 . to_string_lossy ( )
387387 . to_string ( ) ;
388388 format ! (
389- "echo '{}' | base64 -d > {}" ,
389+ "mkdir -p {} && echo '{}' | base64 -d > {}" ,
390+ parent_dir,
390391 general_purpose:: STANDARD . encode( f. data. trim( ) ) ,
391392 p,
392393 )
@@ -395,7 +396,7 @@ impl<'a> VolumeApi<'a> {
395396 . join ( " && " . into ( ) ) ;
396397
397398 if let Some ( uid) = uid {
398- let chown = format ! ( "chown -R {}:{} {}" , uid, uid, path ) ;
399+ let chown = format ! ( "chown -R {}:{} {}" , uid, uid, parent_dir ) ;
399400 cmd = format ! (
400401 "{}{}{}" ,
401402 cmd,
0 commit comments