tidy up endpoints
This commit is contained in:
parent
ff0475f4ef
commit
0f8f59d32d
@ -1,10 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
---
|
||||
$schema: https://json-schema.org/schema#
|
||||
$id: https://calamares.io/schemas/installreport
|
||||
additionalProperties: false
|
||||
type: object
|
||||
properties:
|
||||
skip_if_no_internet: { type: boolean, default: true }
|
||||
|
@ -5,7 +5,8 @@ import requests
|
||||
import libcalamares
|
||||
from libcalamares.utils import host_env_process_output
|
||||
|
||||
timeout = 3
|
||||
TIMEOUT = 3
|
||||
|
||||
|
||||
def get_chassis():
|
||||
result = []
|
||||
@ -13,46 +14,49 @@ def get_chassis():
|
||||
host_env_process_output(
|
||||
['hostnamectl'],
|
||||
result,
|
||||
timeout=timeout
|
||||
timeout=TIMEOUT
|
||||
)
|
||||
for i in result:
|
||||
if "Chassis" in i:
|
||||
return i.replace("Chassis:", "").replace("\n", "").strip()
|
||||
print("result",result)
|
||||
|
||||
return result
|
||||
except subprocess.CalledProcessError as e:
|
||||
libcalamares.utils.warning(f"InstallReport failed: {e.output}")
|
||||
return e.returncode
|
||||
|
||||
|
||||
def pretty_name():
|
||||
return ""
|
||||
|
||||
def get_cala_version():
|
||||
|
||||
def cala_version():
|
||||
result = []
|
||||
try:
|
||||
host_env_process_output(
|
||||
['calamares', '-v'],
|
||||
result,
|
||||
timeout=timeout
|
||||
timeout=TIMEOUT
|
||||
)
|
||||
return result[-1].split()[1]
|
||||
except subprocess.CalledProcessError as e:
|
||||
libcalamares.utils.warning(f"InstallReport failed: {e.output}")
|
||||
return e.returncode
|
||||
|
||||
|
||||
def run():
|
||||
libcalamares.job.setprogress(0.5)
|
||||
headers = {'user-agent': f"Calamares/{get_cala_version()}"}
|
||||
endpoint = "http://ping.manjaro.org/calamares"
|
||||
|
||||
headers = {'user-agent': f"Calamares/{cala_version()}"}
|
||||
endpoint = "http://ping.manjaro.org/calamares/"
|
||||
|
||||
if "vm" in get_chassis():
|
||||
endpoint = f"{endpoint}vm"
|
||||
|
||||
url = f"{endpoint}virtual-tesdrive"
|
||||
else:
|
||||
url = f"{endpoint}new-install"
|
||||
|
||||
try:
|
||||
res = requests.get(endpoint, headers=headers, timeout=3)
|
||||
print(res)
|
||||
requests.get(url, headers=headers, timeout=3)
|
||||
except Exception as e:
|
||||
return ("error", e)
|
||||
|
||||
libcalamares.job.setprogress(1.0)
|
||||
|
||||
libcalamares.job.setprogress(1.0)
|
||||
|
Loading…
Reference in New Issue
Block a user