Updated both scripts to use AirwatchAPI and GLPIAPI modules
This commit is contained in:
43
scripts/functions.py
Normal file
43
scripts/functions.py
Normal file
@ -0,0 +1,43 @@
|
||||
import os
|
||||
import toml
|
||||
|
||||
def getSettings(settingsPath):
|
||||
settingsDefault ="""
|
||||
[AIRWATCH]
|
||||
Server = "https://airwatchServer"
|
||||
APIKey = "APIKEY"
|
||||
|
||||
# Méthode d'authentification (CMSURL or PASSWORD)
|
||||
# CMSURL permet l'authentification avec un certificat utilisateur
|
||||
# PASSWORD permet l'authentification avec un nom d'utilisateur et un mot de passe (APIUser, APIPassword)
|
||||
AuthenticationMethod = "CMSURL"
|
||||
CertificatePath = "/path/to/cert"
|
||||
CertificatePassword = "12345"
|
||||
APIUser = "UserAPI"
|
||||
APIPassword = "PasswordUserAPI"
|
||||
|
||||
# Utilisateur de staging que l'on va remplacer par l'utilisateur trouvé dans GLPI
|
||||
StagingUser = "staging-pr"
|
||||
|
||||
[GLPI]
|
||||
Server = "http://127.0.0.1/glpi"
|
||||
AppToken = "GLPIAppToken"
|
||||
UserToken = "GLPIUserToken"
|
||||
# User agent qui sera visible sur GLPI lors de la synchronisation
|
||||
UserAgent = "Airwatch Synchronizer"
|
||||
|
||||
[LOGS]
|
||||
Enabled = true
|
||||
Path = "./logs/"
|
||||
Debug = false
|
||||
"""
|
||||
|
||||
settings = None
|
||||
|
||||
if(not os.path.isfile(settingsPath)):
|
||||
f = open(settingsPath, "w")
|
||||
f.write(settingsDefault)
|
||||
f.close()
|
||||
with open(settingsPath, "r") as f:
|
||||
settings = toml.load(f)
|
||||
return settings
|
||||
Reference in New Issue
Block a user