@@ -125,7 +125,7 @@ func (q *QSFS) Mount(wlID string, cfg zos.QuantumSafeFS) (info pkg.QSFSInfo, err
125125 }
126126
127127 env := environment .MustGet ()
128- qsfsFlist , err := url .JoinPath (env .HubURL , "tf-autobuilder" , "qsfs-0.2.0-rc2 .flist" )
128+ qsfsFlist , err := url .JoinPath (env .HubURL , "tf-autobuilder" , "qsfs-0.2.0-rc1 .flist" )
129129 if err != nil {
130130 err = errors .Wrap (err , "failed to construct url" )
131131 return
@@ -142,6 +142,10 @@ func (q *QSFS) Mount(wlID string, cfg zos.QuantumSafeFS) (info pkg.QSFSInfo, err
142142 err = errors .Wrap (lerr , "couldn't write qsfs config" )
143143 return
144144 }
145+ if lerr := q .writeHosts (flistPath ); lerr != nil {
146+ err = errors .Wrap (lerr , "couldn't write /etc/hosts" )
147+ return
148+ }
145149 mountPath := q .mountPath (wlID )
146150 err = q .prepareMountPath (mountPath )
147151 if err != nil {
@@ -308,9 +312,16 @@ func (q *QSFS) prepareMountPath(path string) error {
308312 return nil
309313}
310314
315+ // for some reason hosts file was corrupted in the flist, we need to rewrite it for zstor to be able to resolve localhost
316+ func (q * QSFS ) writeHosts (root string ) error {
317+ hostsPath := filepath .Join (root , "etc/hosts" )
318+ const hosts = "127.0.0.1\t localhost\n ::1\t \t localhost ip6-localhost ip6-loopback\n "
319+ return os .WriteFile (hostsPath , []byte (hosts ), 0644 )
320+ }
321+
311322func (q * QSFS ) writeQSFSConfig (root string , cfg zstorConfig ) error {
312323 cfgPath := filepath .Join (root , "data/zstor.toml" )
313- f , err := os .OpenFile (cfgPath , os .O_WRONLY | os .O_CREATE , 0644 )
324+ f , err := os .OpenFile (cfgPath , os .O_WRONLY | os .O_CREATE | os . O_TRUNC , 0644 )
314325 if err != nil {
315326 return errors .Wrap (err , "couldn't open zstor config file" )
316327 }
0 commit comments