change
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
package : comi-apps-to-update-on-wapt-server
|
package : comi-apps-to-update-on-wapt-server
|
||||||
version : 0-13
|
version : 0-16
|
||||||
architecture : all
|
architecture : all
|
||||||
section : base
|
section : base
|
||||||
priority : optional
|
priority : optional
|
||||||
@@ -29,15 +29,16 @@ editor :
|
|||||||
keywords :
|
keywords :
|
||||||
licence : opensource_free,wapt_public
|
licence : opensource_free,wapt_public
|
||||||
homepage :
|
homepage :
|
||||||
package_uuid :
|
package_uuid : 56be0e6d-4573-4d1f-ad99-1cc5d5d4c718
|
||||||
valid_from :
|
valid_from :
|
||||||
valid_until :
|
valid_until :
|
||||||
forced_install_on :
|
forced_install_on :
|
||||||
changelog :
|
changelog :
|
||||||
min_os_version :
|
min_os_version :
|
||||||
max_os_version :
|
max_os_version :
|
||||||
icon_sha256sum :
|
icon_sha256sum : d642b35ce6441158dc071677fb958ad01830271d373c332d64e48dec67f80834
|
||||||
signer :
|
signer : pcosson_key
|
||||||
signer_fingerprint:
|
signer_fingerprint: a25582410cf03bad179a60c189f459a0b03821c92c0cedf209e82448a66a9b4e
|
||||||
signature_date :
|
signature_date : 2024-04-30T15:04:28.000000
|
||||||
signed_attributes :
|
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
|
||||||
|
signature : MaKQmI6kWy/jfJDWUJ7FQlwYyIU0FyH6GHi06Tj7DcPOMJgkliC2zCrQtT+d2YGs1kC6HjkPFHMm4zOhk8j4IMUESQH+X7MgYIGizCAXTbyQfxecR9MwvRyQ7flF+d7+i5KHWBYNJmHz/4ng37a6viFyqPfK8uZ5kQC/w+BWMIV+kJFDmxtSWppSVLa27nq8N4sk6r+6R8Of/bY+o1rHpTbzr76b8WK48OFtEUNJ+2NM5l68bJB1t6lgF+4R0SDpMykL+/h4t77jpS8ZCAuoOuBVGrUuvwyIuXQx15Nk7zKgIQ60ePDY8rrTe4PsT5f+BK7ow/6Oe88rUu0Zw8WQ6g==
|
||||||
77
all/setup.py
77
all/setup.py
@@ -34,6 +34,14 @@ dict_host_capa = {
|
|||||||
tags=["debian-bullseye", "debian", "debian_based", "linux", "unix", "debian11", "debian-11"],
|
tags=["debian-bullseye", "debian", "debian_based", "linux", "unix", "debian11", "debian-11"],
|
||||||
os_version="11",
|
os_version="11",
|
||||||
),
|
),
|
||||||
|
"debian12frx64": HostCapabilities(
|
||||||
|
architecture="x64",
|
||||||
|
language="fr",
|
||||||
|
os="debian",
|
||||||
|
packages_locales=["fr", "en", "es", "de", "it"],
|
||||||
|
tags=["debian-bookworm", "debian", "debian_based", "linux", "unix", "debian12", "debian-12"],
|
||||||
|
os_version="11",
|
||||||
|
),
|
||||||
"win10x64fr": HostCapabilities(
|
"win10x64fr": HostCapabilities(
|
||||||
architecture="x64",
|
architecture="x64",
|
||||||
language="fr",
|
language="fr",
|
||||||
@@ -43,14 +51,14 @@ dict_host_capa = {
|
|||||||
os_version="10.0.19043",
|
os_version="10.0.19043",
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
webhook_url="https://chat.comitari.fr/hooks/64d4d02760b38508f62a5bcb/ncKSYRiLM9oNXagK5c7G3KWX2qEzET3kbFFXKnNAhtfZQEQ9"
|
||||||
|
|
||||||
def install():
|
def install():
|
||||||
plugin_inifile = makepath(WAPT.private_dir, "wapt_api.ini")
|
plugin_inifiles = glob.glob("*.ini")
|
||||||
|
|
||||||
if not isfile(plugin_inifile):
|
|
||||||
filecopyto("wapt_api.ini", WAPT.private_dir)
|
|
||||||
|
|
||||||
|
for file in plugin_plugin_inifiles:
|
||||||
|
if not isfile(makepath(WAPT.private_dir,file.split("\")[-1])):
|
||||||
|
filecopyto(file, WAPT.private_dir)
|
||||||
|
|
||||||
def audit():
|
def audit():
|
||||||
plugin_inifile = makepath(WAPT.private_dir, "wapt_api.ini")
|
plugin_inifile = makepath(WAPT.private_dir, "wapt_api.ini")
|
||||||
@@ -108,12 +116,63 @@ def audit():
|
|||||||
)
|
)
|
||||||
WAPT.write_audit_data_if_changed("apps_to_upgrade", "list", list_app_to_update, max_count=3)
|
WAPT.write_audit_data_if_changed("apps_to_upgrade", "list", list_app_to_update, max_count=3)
|
||||||
|
|
||||||
with open(app_to_update_json_path, "w") as json_file:
|
|
||||||
json.dump(list_app_to_update, json_file)
|
|
||||||
|
|
||||||
if not list_app_to_update:
|
if not list_app_to_update:
|
||||||
print("your repository seems up to date")
|
message="your repository seems up to date"
|
||||||
|
print(message)
|
||||||
|
send_to_rocket(webhook_url,message)
|
||||||
return "OK"
|
return "OK"
|
||||||
else:
|
else:
|
||||||
print("you need to update some packages")
|
message="you need to update some packages"
|
||||||
|
print(message)
|
||||||
|
send_to_rocket(webhook_url,message)
|
||||||
return "WARNING"
|
return "WARNING"
|
||||||
|
|
||||||
|
|
||||||
|
def send_to_rocket(webhook_url, message_text, attachments=None):
|
||||||
|
"""
|
||||||
|
Envoie un message à Rocket.Chat via un webhook.
|
||||||
|
|
||||||
|
:param webhook_url: URL du webhook Rocket.Chat
|
||||||
|
:param message_text: Texte du message à envoyer
|
||||||
|
:param attachments: Liste de pièces jointes (facultatif)
|
||||||
|
"""
|
||||||
|
# Construire le message
|
||||||
|
message = {
|
||||||
|
'text': message_text
|
||||||
|
}
|
||||||
|
if attachments:
|
||||||
|
message['attachments'] = attachments
|
||||||
|
|
||||||
|
# Envoyer la requête POST
|
||||||
|
response = requests.post(webhook_url, data=json.dumps(message), headers={'Content-Type': 'application/json'})
|
||||||
|
|
||||||
|
# Vérifier la réponse
|
||||||
|
if response.status_code == 200:
|
||||||
|
print('Message envoyé avec succès.')
|
||||||
|
else:
|
||||||
|
print(f'Échec de l\'envoi du message. Statut de la réponse : {response.status_code}')
|
||||||
|
print(f'Erreur : {response.text}')
|
||||||
|
|
||||||
|
|
||||||
|
def send_mail(body,subject):
|
||||||
|
|
||||||
|
smtp_inifile = makepath(WAPT.private_dir, "smtp.ini")
|
||||||
|
conf_wapt = ConfigParser()
|
||||||
|
conf_wapt.read(smtp_inifile)
|
||||||
|
|
||||||
|
from_addr = conf_wapt.get("wapt", "from_addr")
|
||||||
|
to_addr = conf_wapt.get("wapt", "to_addr")
|
||||||
|
password = conf_wapt.get("wapt", "password")
|
||||||
|
smtpserver = conf_wapt.get("wapt", "smtpserver")
|
||||||
|
|
||||||
|
print(from_addr)
|
||||||
|
|
||||||
|
|
||||||
|
message = f"Subject: {subject}\n\n{body}"
|
||||||
|
server = smtplib.SMTP(smtpserver, 587)
|
||||||
|
server.starttls()
|
||||||
|
server.login(from_addr, password)
|
||||||
|
server.sendmail(from_addr, to_addr, message)
|
||||||
|
server.quit()
|
||||||
|
return "OK"
|
||||||
5
all/smtp.ini
Normal file
5
all/smtp.ini
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[wapt]
|
||||||
|
from_addr =
|
||||||
|
to_addr =
|
||||||
|
password =
|
||||||
|
smtpserver =
|
||||||
Reference in New Issue
Block a user