@@ -42,6 +42,9 @@ const DefaultPublicCacheIndex = KeilDefaultPackRoot + PublicCacheIndex
4242// would be reset to the public index URL when reading the public index
4343var ActualPublicIndex = DefaultPublicIndex
4444
45+ // flag for update public index if online to show no error but a warning instead
46+ var WarningInsteadOfErrors = false
47+
4548type lockedSlice struct {
4649 lock sync.Mutex
4750 slice []xml.PdscTag
@@ -900,10 +903,17 @@ func UpdateInstalledPDSCFiles(pidxXML, cidxXML *xml.PidxXML, updatePrivatePdsc,
900903func UpdatePublicIndexIfOnline () error {
901904 // If public index already exists then first check if online, then its timestamp
902905 // if we are online and it is too old then download a current version
906+
907+ WarningInsteadOfErrors = true
908+
903909 if utils .FileExists (Installation .PublicIndex ) {
904910 err := utils .CheckConnection (ConnectionTryURL , 0 )
905911 if err != nil && errors .Unwrap (err ) != errs .ErrOffline {
906- return err
912+ if WarningInsteadOfErrors {
913+ log .Warnf ("Cannot check for public index update: %v" , err )
914+ } else {
915+ return err
916+ }
907917 }
908918 if errors .Unwrap (err ) != errs .ErrOffline {
909919 var updateConf updateCfg
@@ -925,6 +935,10 @@ func UpdatePublicIndexIfOnline() error {
925935 UnlockPackRoot ()
926936 err1 := UpdatePublicIndex (ActualPublicIndex , false , false , false , false , false , 0 , 0 )
927937 if err1 != nil {
938+ if WarningInsteadOfErrors {
939+ log .Warnf ("Cannot update public index: %v" , err1 )
940+ return nil
941+ }
928942 return err1
929943 }
930944 var updateConf updateCfg
@@ -1385,9 +1399,9 @@ func ListInstalledPacks(listCached, listPublic, listUpdates, listRequirements, t
13851399// 1.2.1. if pack's pdsc file not found in Installation.LocalDir then raise errs.ErrPackURLCannotBeFound
13861400// 1.2.2. read .Local/PDSC file into pdscXML
13871401// 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"
1402+ // 1.2.4 . if releaseTag == nil then raise ErrPackVersionNotFoundInPdsc
1403+ // 1.2.5 . if releaseTag.URL != "", return releaseTag.URL
1404+ // 1.2.6 . return pdscTag.URL + pack.Vendor + "." + pack.Name + "." + pack.Version + ".pack"
13911405//
13921406// The function resolves the version modifier to determine the correct version of the pack to fetch.
13931407// It then checks the release tag for the specified version and returns the URL if found.
@@ -1755,6 +1769,10 @@ type updateCfg struct {
17551769func (p * PacksInstallationType ) checkUpdateCfg (conf * updateCfg ) error {
17561770 f , err := os .Open (filepath .Join (p .WebDir , "update.cfg" ))
17571771 if err != nil {
1772+ if WarningInsteadOfErrors {
1773+ log .Warnf ("Could not open update.cfg: %v" , err )
1774+ return nil
1775+ }
17581776 return err
17591777 }
17601778 defer f .Close ()
0 commit comments