MCPcopy Create free account
hub / github.com/archlinux/archinstall / share_install_log

Function share_install_log

archinstall/lib/log.py:231–259  ·  view source on GitHub ↗
(
	paste_url: str,
	max_bytes: int | None = None,
)

Source from the content-addressed store, hash-verified

229
230
231def share_install_log(
232 paste_url: str,
233 max_bytes: int | None = None,
234) -> str | None:
235 log_path = logger.path
236
237 if not log_path.exists():
238 info(f'Log file not found: {log_path}')
239 return None
240
241 content = logger.get_content(max_bytes=max_bytes)
242
243 if len(content) == 0:
244 info(f'Log file is empty: {log_path}')
245 return None
246
247 try:
248 req = urllib.request.Request(paste_url, data=content)
249 with urllib.request.urlopen(req) as response:
250 url = response.read().decode().strip()
251 except urllib.error.URLError as e:
252 info(f'Upload failed: {e}')
253 return None
254
255 if not url.startswith('http'):
256 info(f'Unexpected response from {paste_url}: {url[:200]!r}')
257 return None
258
259 return url

Callers 7

test_file_not_foundFunction · 0.90
test_empty_fileFunction · 0.90
test_successful_uploadFunction · 0.90
test_truncationFunction · 0.90
test_network_errorFunction · 0.90
test_unexpected_responseFunction · 0.90
_share_log_commandFunction · 0.90

Calls 4

infoFunction · 0.85
get_contentMethod · 0.80
existsMethod · 0.45
decodeMethod · 0.45

Tested by 6

test_file_not_foundFunction · 0.72
test_empty_fileFunction · 0.72
test_successful_uploadFunction · 0.72
test_truncationFunction · 0.72
test_network_errorFunction · 0.72
test_unexpected_responseFunction · 0.72