@@ -900,19 +900,21 @@ func UpdateInstalledPDSCFiles(pidxXML, cidxXML *xml.PidxXML, updatePrivatePdsc,
900900func UpdatePublicIndexIfOnline () error {
901901 // If public index already exists then first check if online, then its timestamp
902902 // if we are online and it is too old then download a current version
903+
903904 if utils .FileExists (Installation .PublicIndex ) {
904905 err := utils .CheckConnection (ConnectionTryURL , 0 )
905906 if err != nil && errors .Unwrap (err ) != errs .ErrOffline {
906- return err
907+ log . Warnf ( "Cannot check for public index update: %v" , err )
907908 }
908909 if errors .Unwrap (err ) != errs .ErrOffline {
909910 var updateConf updateCfg
910- err = Installation .checkUpdateCfg (& updateConf )
911+ err = Installation .checkUpdateCfg (& updateConf , true )
911912 if err != nil {
912913 UnlockPackRoot ()
913914 err1 := UpdatePublicIndex (ActualPublicIndex , false , false , false , false , false , 0 , 0 )
914915 if err1 != nil {
915- return err1
916+ log .Warnf ("Cannot update public index: %v" , err1 )
917+ return nil
916918 }
917919 _ = Installation .updateUpdateCfg (& updateConf )
918920 }
@@ -925,7 +927,8 @@ func UpdatePublicIndexIfOnline() error {
925927 UnlockPackRoot ()
926928 err1 := UpdatePublicIndex (ActualPublicIndex , false , false , false , false , false , 0 , 0 )
927929 if err1 != nil {
928- return err1
930+ log .Warnf ("Cannot update public index: %v" , err1 )
931+ return nil
929932 }
930933 var updateConf updateCfg
931934 updateConf .Auto = true
@@ -1385,9 +1388,9 @@ func ListInstalledPacks(listCached, listPublic, listUpdates, listRequirements, t
13851388// 1.2.1. if pack's pdsc file not found in Installation.LocalDir then raise errs.ErrPackURLCannotBeFound
13861389// 1.2.2. read .Local/PDSC file into pdscXML
13871390// 1.2.3. releastTag = pdscXML.FindReleaseTagByVersion(pack.Version)
1388- // 1.2.3 . if releaseTag == nil then raise ErrPackVersionNotFoundInPdsc
1389- // 1.2.4 . if releaseTag.URL != "", return releaseTag.URL
1390- // 1.2.5 . return pdscTag.URL + pack.Vendor + "." + pack.Name + "." + pack.Version + ".pack"
1391+ // 1.2.4 . if releaseTag == nil then raise ErrPackVersionNotFoundInPdsc
1392+ // 1.2.5 . if releaseTag.URL != "", return releaseTag.URL
1393+ // 1.2.6 . return pdscTag.URL + pack.Vendor + "." + pack.Name + "." + pack.Version + ".pack"
13911394//
13921395// The function resolves the version modifier to determine the correct version of the pack to fetch.
13931396// It then checks the release tag for the specified version and returns the URL if found.
@@ -1747,14 +1750,18 @@ type updateCfg struct {
17471750// Parameters:
17481751// - conf (*updateCfg): A pointer to the updateCfg structure that will be populated
17491752// with the parsed configuration values.
1753+ // - WarningInsteadOfErrors (bool): A flag indicating whether to log warnings instead of returning errors.
17501754//
17511755// Returns:
17521756// - error: An error is returned if the "update.cfg" file cannot be opened, if the
17531757// "Date" field cannot be parsed, or if the timestamp in the "Date" field is older
17541758// than 24 hours. If no errors occur, nil is returned.
1755- func (p * PacksInstallationType ) checkUpdateCfg (conf * updateCfg ) error {
1759+ func (p * PacksInstallationType ) checkUpdateCfg (conf * updateCfg , WarningInsteadOfErrors bool ) error {
17561760 f , err := os .Open (filepath .Join (p .WebDir , "update.cfg" ))
17571761 if err != nil {
1762+ if WarningInsteadOfErrors {
1763+ log .Debugf ("Could not open update.cfg: %v" , err )
1764+ }
17581765 return err
17591766 }
17601767 defer f .Close ()
0 commit comments