@@ -97,14 +97,36 @@ def _ensure_board_urls(self):
9797 capture_output = True , text = True
9898 )
9999
100- # Refresh index so new cores are discoverable
101- print ("[arduino-cli] Updating core index..." )
102- subprocess .run (
100+ # Always refresh the full index so missing/corrupt index files
101+ # are re-downloaded. Log stderr so warnings (like unreachable
102+ # third-party servers) are visible in the container logs.
103+ print ("[arduino-cli] Refreshing core indexes..." )
104+ result = subprocess .run (
103105 [self .cli_path , "core" , "update-index" ],
104106 capture_output = True , text = True
105107 )
108+ if result .returncode != 0 :
109+ print (f"[arduino-cli] core update-index exited { result .returncode } " )
110+ if result .stderr :
111+ print (f"[arduino-cli] stderr: { result .stderr .strip ()} " )
112+
113+ # Fallback: if the Drazzy index file is still missing, download it
114+ # directly. Some environments have transient DNS / network issues
115+ # and arduino-cli silently skips unavailable indexes.
116+ drazzy_path = Path ("/root/.arduino15/package_drazzy.com_index.json" )
117+ if not drazzy_path .exists ():
118+ print ("[arduino-cli] Drazzy index missing — fetching directly..." )
119+ import urllib .request
120+ try :
121+ urllib .request .urlretrieve (
122+ "http://drazzy.com/package_drazzy.com_index.json" ,
123+ str (drazzy_path ),
124+ )
125+ print ("[arduino-cli] Drazzy index downloaded." )
126+ except Exception as fetch_err :
127+ print (f"[arduino-cli] Direct fetch failed: { fetch_err } " )
106128 except Exception as e :
107- print (f"Warning: Could not configure board URLs: { e } " )
129+ print (f"[arduino-cli] Warning: Could not configure board URLs: { e } " )
108130
109131 def _ensure_core_installed (self ):
110132 """
0 commit comments